Funzioni utili

GTA-Expert » GTA San Andreas » Funzioni utili

Funzioni utili per lo scripting


In questa pagina potrete trovare diverse utili funzioni per lo scripting in SA:MP, create di nostri Skiaffo, MarkGTA e Chiarboss. Per ulteriori chiarimenti o consigli, potete chiedere nella sezione Scripting & Gamemodes nel nostro forum.

SKIAFFO'S SCRIPTS



Countdown


Sotto OnPlayerCommandText

if (strcmp(cmd, "/cd", true) == 0) {
ccd1();
return 1;
}

In fondo allo script

public ccd1() {
GameTextForAll("~r~tre", 500, 4);
SetTimer("ccd2", 900, 0);
}

public ccd2() {
GameTextForAll("~y~due", 500, 4);
SetTimer("ccd3", 900, 0);
}

public ccd3() {
GameTextForAll("~g~uno", 500, 4);
SetTimer("ccd4", 900, 0);
}

public ccd4() {
GameTextForAll("~b~!! via !!", 1000, 4);
}


Ora


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;
}


Freeze / Unfreeze ID


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");
}
}


FreezeAll / UnFreezeAll


Sotto OnPlayerCommandText

if(strcmp(cmd,"/freezeall",true) == 0) {
for (new i=0; i if (IsPlayerConnected(i)) {
TogglePlayerControllable(i,0);
}
}
}

Sotto OnPlayerCommandText

if(strcmp(cmd,"/sfreezeall",true) == 0) {
for (new i=0; i if (IsPlayerConnected(i)) {
TogglePlayerControllable(i,1);
}
}
}


Mute / Unmute ID


In testa allo script

new mute[MAX_PLAYER_NAME];

Sotto 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 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


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


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 admins


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");
}
}


Goto per tutti


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;
}


Distanza


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)+floatpow
er(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;
}


God Mode


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;
}


God ID


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");
}
}


Heal ID


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


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;
}


MARKGTA'S SCRIPTS



Ramp Spawn


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


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


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;
}


CHIARBOSS' SCRIPTS



Proiettili Esplosivi


E' consigliato attivare l'Instagib. E' necessario avere lo strtok impostato per far compilare il codice.


In testa alla GM

#include
#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(playernam
e));
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;
}
}


Spawn dal punto di Death


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;
}


Messaggio di Leave, TimeOut, Kick e Join


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);
SendClientMessage(playerid,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);
SendClientMessage(playerid,COLOR_GREY,string);


Stop On Crash


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.


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 {
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 {
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 {
TogglePlayerControllable(i,1);
}
}
return 1;
}


CHIARBOSS & MARGTA'S SCRIPTS


Controllo Esplosione


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...");
}
}