[Dark_91 - Forum

Benvenuti Angel Devil
Contatti
Guestbook
Sondaggi
SA Multi
MTA multi
Area mod
GTA SAN ANDREAS
Forum
lista siti web soci
GTA 4 soluzione completa - I
GTA Soluzione completa - II
CODICI GTA IV



 
=> Non ancora registrato?

Forum - Alcune funzioni utili

Ti trovi qua:
Forum => AREA SCRIPT => Alcune funzioni utili

<-Indietro

 1 

Avanti->


[Dark_91
(3 post finora)
21/05/2008 13:28 (UTC)[citare]
OnPlayerCommandText

Sotto OnPlayerCommandText:

new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);

In fondo allo script:

strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] ' ' && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}


CountDown (skiaffo)

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 (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= 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 == 2 {
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;
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

In testa alla GM:

#define COLOR_RED 0xAA3333AA
new indeath[MAX_PLAYERS];
new indeathlock;
new Floatdeath;
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;
}

kekko (Invitato)
26/06/2011 08:52 (UTC)[citare]
raga nono una frana come faccio a mettere piu di uno OnPlayerCommandText in una gm ???? help subito

Rispondere:

Il tuo nickname:

 Colori dei caratteri:

 Grandezza dei caratteri:
Chiudi tags



Totale topic: 12
Totale post: 14
Totale utenti: 97
Ora online (utenti registrati): Nessuno crying smiley

Angel Devil Forum

forum ufficiale clan
(1 in 1246 out)

Deve trovarsi qui il tuo link?
Allora iscriviti semplicemente qui:
=> All'iscrizione

Oggi ci sono stati già 3 visitatori (44 hits) qui!
Questo sito web è stato creato gratuitamente con SitoWebFaidate.it. Vuoi anche tu un tuo sito web?
Accedi gratuitamente