givegunall only for id 0 :( - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: givegunall only for id 0 :( (
/showthread.php?tid=316214)
givegunall only for id 0 :( -
cs_waller - 05.02.2012
SOLVED
Re: givegunall only for id 0 :( -
vassilis - 05.02.2012
lmao its a simplest way to make it:
use zcmd,sscanf
pawn Код:
CMD:givegunall(playerid,params[])
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(PlayerInfo[playerid][pAdmin[ < 5) return SCM(playerid,-1,"You must have level 5!");
if(sscanf(params,"dd",wep,ammo)) return SCM(playerid,-1,"ERROR:/givegunall [wepid] [ammo]");
if(wep < 0 ||wep == 19 || wep == 20 || wep == 21 || wep > 45) return SCM(playerid,01,"ERROR:This wep id is invalid");
if(ammo < 0) return SCM(playerid,-1,"ERROR:invalid ammo amount");
GivePlayerWeapon(i,wep,ammo);
}
return 1;
}
Re: givegunall only for id 0 :( -
[HiC]TheKiller - 05.02.2012
Get rid of the return 1; in the for loop.
Re: givegunall only for id 0 :( -
cs_waller - 05.02.2012
TheKiller thanks it fixed the bug but now this SendClientMessage start to spam when I type /givegunall :S
Re: givegunall only for id 0 :( -
[HiC]TheKiller - 05.02.2012
pawn Код:
SendClientMessage(playerid
To
In that loop.
You could also just use SendClientMessageToAll
Re: givegunall only for id 0 :( -
cs_waller - 05.02.2012
Now it give me one error. error 035: argument type mismatch (argument 2)
Here is the code
pawn Код:
SendClientMessageToAll(i, COLOR_RED, "Aäìèíèñòðàòîð äàäå íà âñè÷êè ó÷àñòíèöè â åâåíòà îðúæèå");
Re: givegunall only for id 0 :( -
vassilis - 05.02.2012
Quote:
Originally Posted by cs_waller
Now it give me one error. error 035: argument type mismatch (argument 2)
Here is the code
pawn Код:
SendClientMessageToAll(i, COLOR_RED, "Aäìèíèñòðàòîð äàäå íà âñè÷êè ó÷àñòíèöè â åâåíòà îðúæèå");
|
delete i
pawn Код:
SendClientMessageToAll(COLOR_RED, "Aäìèíèñòðàòîð äàäå íà âñè÷êè ó÷àñòíèöè â åâåíòà îðúæèå");
Re: givegunall only for id 0 :( -
cs_waller - 05.02.2012
Again spam from This SendClientMessage
Re: givegunall only for id 0 :( -
Typhome - 05.02.2012
Код:
if (gun > 1||gun < 47)
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(GetPlayerColor(i) == 0x18E76BFF)
GivePlayerWeapon(i, gun, gun);
return 1;
}
SendClientMessage(playerid, COLOR_RED, "Администратор даде на всички играчи от евента оръжие.");
}
SendClientMessage is in loop, that's why it spamming.
Re: givegunall only for id 0 :( -
cs_waller - 05.02.2012
Now again this command is for only id 0