In cima allo script:
new counton = 0; forward CountDown(time);
Sotto OnPlayerCommandText:
if ((strcmp(cmd, "/cdown", true) == 0) || (strcmp(cmd, "/count", true) == 0) || (strcmp(cmd, "/countdown", true) == 0)) { new tmp[256]; if (counton == 1) { SendClientMessage(playerid, 0x00E800FF, "C'è già un countdown attivo"); return 1; } tmp = strtok(cmdtext, idx); if (!strlen(tmp)) { counton = 1; CountDown(3); return 1; } new time = strval(tmp); if ((time < 3) || (time > 10)) { SendClientMessage(playerid, 0x00E800FF, "Scegli un tempo tra 3 e 10 secondi."); return 1; } counton = 1; CountDown(time); return 1; }
In fondo allo script:
public CountDown(time) { new string[32]; if (time > 0) { format(string, 32, "Count: %d", time); } else { format(string, 32, "Count: VIA!!"); counton = 0; } SendClientMessageToAll(0x00E800FF, string); if (counton == 0) return 1; SetTimerEx("CountDown", 1000, 0, "d", time - 1); return 1; }
Ora (skiaffo)
Sotto OnPlayerCommandText:
if (strcmp(cmd, "/time", true) == 0) {
new hour,minute,second;
new string[256];
gettime(hour,minute,second);
format(string, sizeof(string), "~g~|~w~%d:0%d~g~|", hour, minute);
GameTextForPlayer(playerid, string, 5000, 1);
return 1;
}
FreezeAll / UnFreezeAll (skiaffo)
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/freezeall",true) == 0) {
for (new i=0; i<MAX_PLAYERS; i++) {
if (IsPlayerConnected(i)) {
TogglePlayerControllable(i,0);
}
}
}
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/sfreezeall",true) == 0) {
for (new i=0; i<MAX_PLAYERS; i++) {
if (IsPlayerConnected(i)) {
TogglePlayerControllable(i,1);
}
}
}
Mute / Unmute ID (skiaffo)
In testa allo script
new mute[MAX_PLAYER_NAME];
OnPlayerConnect:
public OnPlayerConnect(playerid) {
mute[playerid] = 0;
}
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/mute",true) == 0) {
if(IsPlayerAdmin(playerid) == 1) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /mute [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
format(string,sizeof(string),"L'admin %s ha mutato %s .",name,playername);
SendClientMessageToAll(0xFF8A00AA,string);
mute[pid] = 1;
return 1;
} else {
SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin");
}
}
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/unmute",true) == 0) {
if(IsPlayerAdmin(playerid) == 1) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /mute [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
format(string,sizeof(string),"L'admin %s ha smutato %s .",name,playername);
SendClientMessageToAll(0xFF8A00AA,string);
mute[pid] = 0;
return 1;
} else {
SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin");
}
}
OnPlayerText:
public OnPlayerText(playerid, text[]) {
if(mute[playerid] == 1) {
SendClientMessage(playerid, 0xFF8A00AA, "Non puoi parlare, sei stato mutato da un'admin");
return 0;
}
return 1;
}
Gethere per Admins (skiaffo)
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/gethere",true) == 0) {
if(IsPlayerAdmin(playerid) == 1) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
new Float:plx;
new Float:ply;
new Float:plz;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /gethere [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
GetPlayerPos(playerid, plx, ply, plz);
if (IsPlayerInAnyVehicle(pid) == 0) {
SetPlayerPos(pid, plx, ply, plz);
} else {
SetVehiclePos(GetPlayerVehicleID(pid),plx,ply,plz);
}
format(string,sizeof(string),"%s ha teletrasportato a se %s .",name,playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
} else {
SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin");
}
}
Gethere per tutti (skiaffo)
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/gethere",true) == 0) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
new Float:plx;
new Float:ply;
new Float:plz;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /gethere [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
GetPlayerPos(playerid, plx, ply, plz);
if (IsPlayerInAnyVehicle(pid) == 0) {
SetPlayerPos(pid, plx, ply, plz);
} else {
SetVehiclePos(GetPlayerVehicleID(pid),plx,ply,plz);
}
format(string,sizeof(string),"%s ha teletrasportato a se %s .",name,playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
Goto per tutti (skiaffo)
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/goto",true) == 0) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
new Float:pix;
new Float:piy;
new Float:piz;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /goto [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
GetPlayerPos(pid, pix, piy, piz);
if (IsPlayerInAnyVehicle(playerid) == 0) {
SetPlayerPos(playerid, pix, piy, piz);
} else {
SetVehiclePos(GetPlayerVehicleID(playerid),pix,piy,piz);
}
format(string,sizeof(string),"%s si e' teletrasportato da %s .",name,playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
Goto per admins (skiaffo)
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/goto",true) == 0) {
if(IsPlayerAdmin(playerid) == 1) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
new Float:pix;
new Float:piy;
new Float:piz;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /goto [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
GetPlayerPos(pid, pix, piy, piz);
if (IsPlayerInAnyVehicle(playerid) == 0) {
SetPlayerPos(playerid, pix, piy, piz);
} else {
SetVehiclePos(GetPlayerVehicleID(playerid),pix,piy,piz);
}
format(string,sizeof(string),"%s si e' teletrasportato da %s .",name,playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
} else {
SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin");
}
}
Freeze / Unfreeze ID (skiaffo)
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/freeze",true) == 0) {
if(IsPlayerAdmin(playerid) == 1) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /freeze [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
TogglePlayerControllable(pid,0);
format(string,sizeof(string),"%s e' stato freezato da %s .",playername,name);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
} else {
SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin");
}
}
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/sfreeze",true) == 0) {
if(IsPlayerAdmin(playerid) == 1) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /sfreeze [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
TogglePlayerControllable(pid,1);
format(string,sizeof(string),"%s e' stato sfreezato da %s .",playername,name);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
} else {
SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin");
}
}
Distanza (skiaffo)
In Fondo allo script:
public GetDistanceBetweenPlayers(playerid,playerid2) {
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:dis;
if (!IsPlayerConnected(playerid) || !IsPlayerConnected(playerid2)) {
return -1;
}
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(playerid2,x2,y2,z2);
dis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(dis);
}
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/dist",true) == 0) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
new dis;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessageToAll(0xFF8A00AA,"Utilizzo: /dist [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessageToAll(0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
dis = GetDistanceBetweenPlayers(playerid,pid);
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
format(string,sizeof(string),"%s e' lontano %d metri da %s .",playername,dis,name);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
GodMode (skiaffo)
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/god",true) == 0) {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name, sizeof(name));
SetPlayerHealth(playerid, 100000);
format(string,sizeof(string),"ATTENZIONE! %s ha attivato la God-Mode !!",name);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
Heal ID (skiaffo)
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/heal",true) == 0) {
if(IsPlayerAdmin(playerid) == 1) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /heal [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
SetPlayerHealth(pid,100);
format(string,sizeof(string),"%s e' stato curato da %s .",playername,name);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
} else {
SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin");
}
}
5 SetMark e GotoMark differenti (skiaffo)
In Testa allo Script:
new Float:TD1[3];
new Float:TD2[3];
new Float:TD3[3];
new Float:TD4[3];
new Float:TD5[3];
Sotto OnPlayerCommandText:
if (strcmp(cmd, "/mark1", true) == 0) {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name, sizeof(name));
GetPlayerPos(playerid, TD1[0],TD1[1],TD1[2]);
format(string, sizeof(string), " %s ha stabilito un nuovo mark: X = %f | Y = %f | Z = %f", name, TD1[0],TD1[1],TD1[2]);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (strcmp(cmd, "/gmark1", true) == 0) {
SetPlayerPos(playerid, TD1[0],TD1[1],TD1[2]);
return 1;
}
if (strcmp(cmd, "/mark2", true) == 0) {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name, sizeof(name));
GetPlayerPos(playerid, TD2[0],TD2[1],TD2[2]);
format(string, sizeof(string), " %s ha stabilito un nuovo mark: X = %f | Y = %f | Z = %f", name, TD2[0],TD2[1],TD2[2]);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (strcmp(cmd, "/gmark2", true) == 0) {
SetPlayerPos(playerid, TD2[0],TD2[1],TD2[2]);
return 1;
}
if (strcmp(cmd, "/mark3", true) == 0) {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name, sizeof(name));
GetPlayerPos(playerid, TD3[0],TD3[1],TD3[2]);
format(string, sizeof(string), " %s ha stabilito un nuovo mark: X = %f | Y = %f | Z = %f", name, TD3[0],TD3[1],TD3[2]);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (strcmp(cmd, "/gmark3", true) == 0) {
SetPlayerPos(playerid, TD3[0],TD3[1],TD3[2]);
return 1;
}
if (strcmp(cmd, "/mark4", true) == 0) {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name, sizeof(name));
GetPlayerPos(playerid, TD4[0],TD4[1],TD4[2]);
format(string, sizeof(string), " %s ha stabilito un nuovo mark: X = %f | Y = %f | Z = %f", name, TD4[0],TD4[1],TD4[2]);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (strcmp(cmd, "/gmark4", true) == 0) {
SetPlayerPos(playerid, TD4[0],TD4[1],TD4[2]);
return 1;
}
if (strcmp(cmd, "/mark5", true) == 0) {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name, sizeof(name));
GetPlayerPos(playerid, TD5[0],TD5[1],TD5[2]);
format(string, sizeof(string), " %s ha stabilito un nuovo mark: X = %f | Y = %f | Z = %f", name, TD5[0],TD5[1],TD5[2]);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (strcmp(cmd, "/gmark5", true) == 0) {
SetPlayerPos(playerid, TD5[0],TD5[1],TD5[2]);
return 1;
}
Ramp Spawn (markgta)
Sotto OnPlayerCommandText:
if(strcmp(cmdtext,"/ramphelp",true) == 0) {
SendClientMessage(playerid,0xFFFF00AA,"|____________________|");
SendClientMessage(playerid,0xAFAFAFAA,"/sramp 1");
SendClientMessage(playerid,0xAFAFAFAA,"/sramp 2");
SendClientMessage(playerid,0xAFAFAFAA,"/sramp 3");
SendClientMessage(playerid,0xAFAFAFAA,"/sramp 4");
SendClientMessage(playerid,0xAFAFAFAA,"/sramp 5");
SendClientMessage(playerid,0xAFAFAFAA,"/sramp 6");
SendClientMessage(playerid,0xFFFF00AA,"|____________________|");
return 1;
}
if(strcmp(cmdtext,"/sramp 1",true) == 0) {
new Float:x;
new Float:y;
new Float:z;
GetPlayerPos(playerid,x,y,z);
CreateObject(1503,x,y+3,z-0.6,0,0,0);
return 1;
}
if(strcmp(cmdtext,"/sramp 2",true) == 0) {
new Float:x;
new Float:y;
new Float:z;
GetPlayerPos(playerid,x,y,z);
CreateObject(1660,x,y+3,z-2,0,0,0);
return 1;
}
if(strcmp(cmdtext,"/sramp 3",true) == 0) {
new Float:x;
new Float:y;
new Float:z;
GetPlayerPos(playerid,x,y,z);
CreateObject(1245,x,y+3,z,0,0,0);
return 1;
}
if(strcmp(cmdtext,"/sramp 4",true) == 0) {
new Float:x;
new Float:y;
new Float:z;
GetPlayerPos(playerid,x,y,z);
CreateObject(1631,x,y+3,z,0,0,0);
return 1;
}
if(strcmp(cmdtext,"/sramp 5",true) == 0) {
new Float:x;
new Float:y;
new Float:z;
GetPlayerPos(playerid,x,y,z);
CreateObject(1632,x,y+3,z,0,0,0);
return 1;
}
if(strcmp(cmdtext,"/sramp 6",true) == 0) {
new Float:x;
new Float:y;
new Float:z;
GetPlayerPos(playerid,x,y,z);
CreateObject(1655,x,y+3,z,0,0,0);
return 1;
}
Heal / Car Repair / Armor / Weapons (markgta)
Sotto OnPlayerCommandText:
if(strcmp(cmdtext,"/extra",true) == 0) {
if (IsPlayerInAnyVehicle(playerid) == 1) {
new name[MAX_PLAYER_NAME];
new string[256];
GetPlayerName(playerid,name, sizeof(name));
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
SetVehicleHealth(GetPlayerVehicleID(playerid),1000);
format(string,sizeof(string),"%s ha riparato l'auto ed è armato e pericoloso!.", name);
GivePlayerWeapon(playerid,22,250);
GivePlayerWeapon(playerid,31,400);
GivePlayerWeapon(playerid,28,999);
GivePlayerWeapon(playerid,26,999);
GivePlayerWeapon(playerid,33,999);
GivePlayerWeapon(playerid,41,99999);
SendClientMessageToAll(0x1111AAFF,string);
} else {
new name[MAX_PLAYER_NAME];
new string[256];
GetPlayerName(playerid,name, sizeof(name));
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
format(string,sizeof(string),"%s si è curato,ora è armato e pericoloso!.", name);
GivePlayerWeapon(playerid,22,250);
GivePlayerWeapon(playerid,31,400);
GivePlayerWeapon(playerid,28,999);
GivePlayerWeapon(playerid,26,999);
GivePlayerWeapon(playerid,33,999);
GivePlayerWeapon(playerid,41,99999);
SendClientMessageToAll(0x1111AAFF,string);
}
return 1;
}
Kamikaze (markgta)
Sotto OnPlayerCommandText:
if(strcmp(cmdtext,"/kamikaze",true) == 0) {
new Float:x;
new Float:y;
new Float:z;
GetPlayerPos(playerid,x,y,z);
CreateExplosion(x,y,z,100,9999);
CreateExplosion(x+2,y+2,z+2,10,100);
CreateExplosion(x+4,y+4,z+4,10,100);
CreateExplosion(x+6,y+6,z+6,10,100);
CreateExplosion(x+8,y+8,z+8,10,100);
CreateExplosion(x+10,y+10,z+10,10,100);
CreateExplosion(x+12,y+12,z,10,100);
CreateExplosion(x+14,y+14,z,10,100);
CreateExplosion(x+16,y+16,z,10,100);
CreateExplosion(x+18,y+18,z,10,100);
CreateExplosion(x+20,y+20,z,10,100);
CreateExplosion(x-2,y-2,z,10,100);
CreateExplosion(x-4,y-4,z,10,100);
CreateExplosion(x-6,y-6,z,10,100);
CreateExplosion(x-8,y-8,z,10,100);
CreateExplosion(x-10,y-10,z,10,100);
CreateExplosion(x-12,y-12,z,10,100);
CreateExplosion(x-14,y-14,z,10,100);
CreateExplosion(x-16,y-16,z,10,100);
CreateExplosion(x-18,y-18,z,10,100);
CreateExplosion(x-20,y-10,z,10,100);
return 1;
}
Spawn rampe tramite tasto(sa-mp forum & Markgta)
Conversione da FS
In testa allo script
#include <a_samp>
new keydown[MAX_PLAYERS] = {false, ...};
new rampid[MAX_PLAYERS] = {-1, ...};
forward Keys();
forward RemoveRamp(playerid);
forward Float:GetOptimumRampDistance(playerid);
forward Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance);
new ramptypes[] = {
1503,1660,1245,1631,1632,1655,
};
new playerramptypes[MAX_PLAYERS] = {0, ...};
Float:GetOptimumRampDistance(playerid)
{
new ping = GetPlayerPing(playerid), Float:dist;
dist = floatpower(ping, 0.25);
dist = dist*4.0;
dist = dist+5.0;
return dist;
}
Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
if (IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
else GetPlayerFacingAngle(playerid, a);
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
return a;
}
public Keys()
{
new keys, updown, leftright, playerid;
new Float:x, Float:y, Float:z, Float:angle;
for (playerid = 0; playerid < MAX_PLAYERS; playerid++) {
if (IsPlayerConnected(playerid)) {
GetPlayerKeys(playerid, keys, updown, leftright);
if (keys & KEY_ACTION && IsPlayerInAnyVehicle(playerid)) {
if (!keydown[playerid]) {
keydown[playerid] = true;
if (rampid[playerid] == -1) {
GetPlayerPos(playerid, x, y, z);
angle = GetXYInFrontOfPlayer(playerid, x, y, GetOptimumRampDistance(playerid));
switch (playerramptypes[playerid]) {
case 2:
{
angle -= 90.0;
if (angle < 0.0) angle += 360.0;
z += 0.5;
}
case 1:
{
z -= 0.5;
}
}
rampid[playerid] = CreateObject(ramptypes[playerramptypes[playerid]], x, y, z - 0.5, 0.0, 0.0, angle);
SetTimerEx("RemoveRamp", 2000, 0, "d", playerid);
}
}
} else keydown[playerid] = false;
}
}
}
public RemoveRamp(playerid)
{
if (rampid[playerid] != -1) {
DestroyObject(rampid[playerid]);
rampid[playerid] = -1;
}
}
In OnGameModeInit
SetTimer("Keys", 100, 1);
OnGameModeExit
for (new i=0; i<MAX_PLAYERS; i++)
{
if (rampid[i] != -1) DestroyObject(rampid[i]);
}
sotto OnPlayerCommandText
if (strcmp("/setramp ", cmdtext, true, 9) == 0)
{
new ramp = strval(cmdtext[9]);
if (ramp < 0 || ramp >= sizeof(ramptypes)) {
SendClientMessage(playerid, 0xFFFFFFAA, "Invalid ramp ID.");
} else {
playerramptypes[playerid] = ramp;
}
return 1;
}
if(strcmp(cmdtext,"/setramp",true) == 0) {
SendClientMessage(playerid,0xFFFF00AA,"|______________________________________|");
SendClientMessage(playerid,0xAFAFAFAA,"Seleziona una rampa e quando sei in un veicolo premi ctrl");
SendClientMessage(playerid,0xAFAFAFAA,"/setramp 1 - /setramp 2");
SendClientMessage(playerid,0xAFAFAFAA,"/setramp 3 - /setramp 4");
SendClientMessage(playerid,0xAFAFAFAA,"/setramp 5 - /setramp 6");
SendClientMessage(playerid,0xFFFF00AA,"|______________________________________|");
return 1;
}
Fate /setramp in-game
questo è preso dal forum di samp,convertito da Fitlerscript ,aggiunto il comando "/setramp" senza l'id della rampa per info
god ID (Skiaffo)
Sotto OnPlayerCommandText
if(strcmp(cmd,"/god",true) == 0) {
if(IsPlayerAdmin(playerid) == 1) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /god [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
SetPlayerHealth(pid, 100000);
format(string,sizeof(string),"!!WARNING!! %s e' stato fatto Dio da %s .",playername,name);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
} else {
SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin");
}
}
Proiettili Esplosivi (Chiarboss)
E' consigliato attivare l'Instagib.
In testa alla GM:
#include <a_samp>
#pragma tabsize 0 //per evitare i warnings delle spaziature errate
new exguns;
Sotto OnPlayerDeath:
new Float:x;
new Float:y;
new Float:z;
if(exguns == 1) {
GetPlayerPos(playerid, x, y, z); CreateExplosion(x, y, z, 10, 40);
}
if(exguns >= 22 && reason >= 22) {
GetPlayerPos(playerid, x, y, z); CreateExplosion(x, y, z, 10, 40);
}
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/exguns",true)==0) {
if(IsPlayerAdmin(playerid) == 1) {
exguns = 1;
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername, sizeof(playername));
format(string,sizeof(string),"L'admin %s ha rifornito tutte le armi di Proiettili Esplosivi",playername);
SendClientMessageToAll(0xFF8A00AA,string);
} else {
SendClientMessage(playerid, 0xFF8A00AA, "Devi essere un admin...");
}
return 1;
}
//Per interrompere il rifornimento di Proiettili Esplosivi:
if(strcmp(cmd,"/noexguns",true)==0) {
if(IsPlayerAdmin(playerid) == 1) {
if(exguns == 1) {
exguns = 0;
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername, sizeof(playername));
format(string,sizeof(string),"L'admin %s ha interrotto il rifornimento di Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
} else {
SendClientMessage(playerid, 0xFF8A00AA, "Devi essere un admin...");
}
} else {
SendClientMessage(playerid, 0xFF8A00AA, "Attualmente non c'è nessun rifornimento di Proiettili Esplosivi in corso.");
}
return 1;
}
//Per selezionare l'arma da rifornire di Proiettili Esplosivi:
if(strcmp(cmd,"/exguns",true) == 0) {
if(IsPlayerAdmin(playerid) == 1) {
new playername[MAX_PLAYER_NAME];
new tmp[256];
new wep;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /exguns [weaponid]");
return 1;
}
wep = strval(tmp);
GetPlayerName(playerid,playername,sizeof(playername));
if (wep == 22) {
exguns = 22;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -Pistola- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep == 23) {
exguns = 23;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -Pistola Silenziata- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep == 24) {
exguns = 24;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -Desert Eagle- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep == 25) {
exguns = 25;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -Fucile a Pompa- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep == 26) {
exguns = 26;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -Fucile a Canne Mozze- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep == 27) {
exguns = 27;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -Fucile da Combattimento- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep == 28) {
exguns = 28;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -Mac10- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep == 29) {
exguns = 29;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -MP5- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep == 30) {
exguns = 30;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -AK47- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep == 31) {
exguns = 31;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -M4- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep == 32) {
exguns = 32;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -Tec9- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep == 33) {
exguns = 33;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -Fucile- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep == 34) {
exguns = 34;
format(string,sizeof(string),"L'admin %s ha rifornito l'arma -Fucile di Precisione- con Proiettili Esplosivi.",playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
if (wep > 34) {
SendClientMessage(playerid, 0xFF8A00AA, "Puoi selezionare le armi solamente da 22 and 34.");
return 1;
}
if (wep < 22) {
SendClientMessage(playerid, 0xFF8A00AA, "Puoi selezionare le armi solamente da 22 a 34.");
return 1;
}
return 1;
} else {
SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin...");
return 1;
}
}
P.S.: Inutile dire che serve avere lo strtok impostato per far compilare il codice.
P.S.2: Consiglio: Mettete l'instagib sul server, e questa funzione diventerà veramente realistica...
Controllo Esplosione (Chiarboss & Markgta)
Sotto OnPlayerCommandText
if(strcmp(cmd,"/exto",true) == 0) {
if(IsPlayerAdmin(playerid) == 1) {
new Float:x;
new Float:y;
new Float:z;
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /exto [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,name,sizeof(name));
GetPlayerName(playerid,playername, sizeof(playername));
GetPlayerPos(pid,x,y,z);
CreateExplosion(x,y,z,100,9999);
CreateExplosion(x+2,y+2,z+2,10,100);
CreateExplosion(x+4,y+4,z+4,10,100);
CreateExplosion(x+6,y+6,z+6,10,100);
CreateExplosion(x+8,y+8,z+8,10,100);
CreateExplosion(x+10,y+10,z+10,10,100);
CreateExplosion(x+12,y+12,z,10,100);
CreateExplosion(x+14,y+14,z,10,100);
CreateExplosion(x+16,y+16,z,10,100);
CreateExplosion(x+18,y+18,z,10,100);
CreateExplosion(x+20,y+20,z,10,100);
CreateExplosion(x-2,y-2,z,10,100);
CreateExplosion(x-4,y-4,z,10,100);
CreateExplosion(x-6,y-6,z,10,100);
CreateExplosion(x-8,y-8,z,10,100);
CreateExplosion(x-10,y-10,z,10,100);
CreateExplosion(x-12,y-12,z,10,100);
CreateExplosion(x-14,y-14,z,10,100);
CreateExplosion(x-16,y-16,z,10,100);
CreateExplosion(x-18,y-18,z,10,100);
CreateExplosion(x-20,y-10,z,10,100);
format(string,sizeof(string),"L'admin %s ha fatto esplodere %s.",playername,name);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
} else {
SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin...");
}
}
Spawn dal punto di Death (Chiarboss)
In testa alla GM:
#define COLOR_RED 0xAA3333AA
new indeath[MAX_PLAYERS];
new indeathlock;
new Float:xdeath;
new Float:ydeath;
new Float:zdeath;
Sotto OnGameModeInit:
indeathlock = 0;
Sotto OnPlayerConnect:
indeath[playerid] = 0;
Sotto OnPlayerSpawn:
if(indeath[playerid] == 1) {
SetPlayerPos(xdeath,ydeath,zdeath);
}
Sotto OnPlayerDeath:
GetPlayerPos(playerid, xdeath, ydeath, zdeath);
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/indeath", true)==0) {
if(indeath[playerid] == 0 && indeathlock = 0) {
SendClientMessage(playerid,0xFF8A00AA,"Hai attivato lo spawn dal punto di death.");
indeath[playerid] = 1;
}
else if(indeath[playerid] == 1 && indeathlock = 0) {
SendClientMessage(playerid,0xFF8A00AA,"Hai disattivato lo spawn dal punto di death.");
indeath[playerid] = 0;
}
if(indeathlock == 1) {
SendClientMessage(playerid,COLOR_RED,"Il comando /indeath è stato disattivato.");
return 1;
}
if(strcmp(cmd, "/indeathlock", true)==0) {
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname, sizeof(pname));
if(IsPlayerAdmin(playerid) == 1) {
if(indeathlock == 0) {
indeathlock = 1;
format(string, sizeof(string), "L'admin %s ha disattivato il comando /indeath.", pname);
SendClientMessageToAll(0xFF8A00AA,string);
} else {
indeathlock = 0;
format(string, sizeof(string), "L'admin %s ha attivato il comando /indeath.", pname);
SendClientMessageToAll(0xFF8A00AA,string);
}
} else {
SendClientMessage(playerid,COLOR_RED,"Devi essere un admin!");
}
return 1;
}
Stop On Crash (Chiarboss)
In testa alla GM:
#pragma tabsize 0
#define NICE_BLUE 0xa0d3ffAA
#define COLOR_RED 0xAA3333AA
#define COLOR_GREY 0xAFAFAFAA
new pid;
new soc;
new Float:xout;
new Float:yout;
new Float:zout;
new Float:zangleout;
new confirmsoc;
new SocTimer;
new SocTimerDefault;
new timer;
new disconnected[MAX_PLAYERS];
new stringforout[256];
new Pname[MAX_PLAYER_NAME];
forward StopOnCrash();
Sotto OnGameModeInit:
timer = 0;
soc = 0;
Sotto OnPlayerConnect:
if(soc == 1 && disconnected[playerid] == 1) {
GetPlayerName(playerid,Pname,sizeof(Pname));
format(stringforout,sizeof(stringforout),"%d è stato salvato dal sistema di Stop-On-Crash.");
SendClientMessageToAll(NICE_BLUE,stringforout);
}
Sotto OnPlayerDisconnect:
new string[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(soc == 1) {
switch(reason) {
case 0: {
format(string, sizeof(string), "%s è fuori dal server (TimeOut)", name);
SendClientMessageToAll(COLOR_GREY,string);
}
case 1: {
format(string, sizeof(string), "%s è fuori dal server (Leaving)", name);
SendClientMessageToAll(COLOR_GREY,string);
}
case 2: {
format(string, sizeof(string), "%s è fuori dal server (Kicked)", name);
SendClientMessageToAll(COLOR_GREY,string);
}
}
}
if(reason == 0 && soc == 1)
{
disconnected[playerid] = 1;
GetPlayerName(playerid,Pname,sizeof(Pname));
format(stringforout,sizeof(stringforout),"%s è fuori dal server (TimeOut)");
SendClientMessageToAll(COLOR_RED,stringforout);
GetPlayerPos(playerid,xout,yout,zout);
GetPlayerFacingAngle(playerid,zangleout);
if(timer == 0) {
SocTimerDefault = SetTimer("StopOnCrash",120000,0);
} else {
SocTimer = SetTimer("StopOnCrash",pid*60000,0);
}
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i)) { TogglePlayerControllable(i,0);
}
}
}
Sotto OnPlayerSpawn:
if(soc == 1 && disconnected[playerid] == 1) {
SetPlayerPos(playerid,xout,yout,zout);
SetPlayerFacingAngle(playerid,zangleout);
KillTimer(SocTimer);
KillTimer(SocTimerDefault);
confirmsoc = 1;
for(new i=0;i<MAX_PLAYERS;i++)
{
TogglePlayerControllable(i,1);
}
disconnected[playerid] = 0;
}
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/soc",true)==0) {
if(IsPlayerAdmin(playerid)==1) {
new string[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(soc == 0) {
format(string,sizeof(string),"L'admin %s ha attivato il sistema di Stop-on-Crash.",name);
SendClientMessageToAll(NICE_BLUE,string);
soc = 1;
} else {
format(string,sizeof(string),"L'admin %s ha disattivato il sistema di Stop-on-Crash.",name);
SendClientMessageToAll(NICE_BLUE,string);
soc = 0;
}
} else {
SendClientMessage(playerid,COLOR_RED,"Devi essere un admin!!!");
}
return 1;
}
if(strcmp(cmd,"/soctimer",true)==0) {
if(IsPlayerAdmin(playerid)==1) {
new string[256];
new name[MAX_PLAYER_NAME];
new tmp[256];
GetPlayerName(playerid,name,sizeof(name));
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Hai settato il timer di default.");
timer = 0;
return 1;
}
if(strlen(tmp)) {
timer = 1;
return 1;
}
pid = strval(tmp);
format(string,sizeof(string),"L'admin %d ha settato il timer della ripresa del gioco a %d minuti",pid);
SendClientMessageToAll(NICE_BLUE,string);
} else {
SendClientMessage(playerid,COLOR_RED,"Devi essere un admin!!!");
}
return 1;
}
Immettete questo nella GM:
confirmsoc = 0;
if(confirmsoc == 0) {
SendClientMessageToAll(COLOR_RED,"I player/players non sono rientrati. Amen.");
KillTimer(SocTimer);
KillTimer(SocTimerDefault);
for(new i=0;i<MAX_PLAYERS;i++)
{
TogglePlayerControllable(i,1);
}
}
return 1;
}
Per attivarlo/disattivarlo, basta fare /soc. Per settare il timer nel quale, se un giocatore non si connette entro un tempo limite, si continua a giocare/tutti i players si sfreezano, basta fare /soctimer [timerinsecondi](Il tempo di default è comunque di due minuti).
Molto utile nelle races o nelle CW.
Messaggio di Leave, TimeOut, Kick e Join (Chiarboss)
In testa alla GM:
#define COLOR_GREY 0xAFAFAFAA
new string[256],name[MAX_PLAYER_NAME];
Nell'OnPlayerConnect:
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s has joined the server",name);
SendClientMessageToAll(COLOR_GREY,string);
Nell'OnPlayerDisconnect:
new rname[256];
switch(reason) {
case 0: rname="TimeOut";case 1: rname="Leaving"; case 2: rname="Kicked";
}
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s has left the server (%s)",name,rname);
SendClientMessageToAll(COLOR_GREY,string);
Welcome Message (Djcenzo)
Nell'OnPlayerConnect:
new string[256],playername[MAX_PLAYER_NAME],hour,minute,second;
gettime(hour,minute,second),GetPlayerName(playerid, playername, sizeof(playername)),format(string, sizeof(string), "Benvenuto %s, ~r~ti sei connesso alle: ~g~%d:%d ~r~!", playername, hour,minute,second),GameTextForPlayer(playerid,string, 5000, 1);
=================
Potete richiedere qui altre piccole funzioni, proverò a farle e le aggiungerò alla lista Ne potete anche fare voi alcune e postarle qui.. e io le aggiungerò alla lista...
Non tutte le funzioni sono state testate. Quindi alcune di essere potrebbero contenere errori. In questo caso siete pregati di segnalarli nel topic
Non copiatele da altri forum (come il forum di samp) ma fatele voi...