givegunall only for id 0 :(
#1

SOLVED
Reply
#2

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;
}
Reply
#3

Get rid of the return 1; in the for loop.
Reply
#4

TheKiller thanks it fixed the bug but now this SendClientMessage start to spam when I type /givegunall :S
Reply
#5

pawn Код:
SendClientMessage(playerid
To

pawn Код:
SendClientMessage(i
In that loop.

You could also just use SendClientMessageToAll
Reply
#6

Now it give me one error. error 035: argument type mismatch (argument 2)

Here is the code

pawn Код:
SendClientMessageToAll(i, COLOR_RED, "Aäìèíèñòðàòîð äàäå íà âñè÷êè ó÷àñòíèöè â åâåíòà îðúæèå");
Reply
#7

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äìèíèñòðàòîð äàäå íà âñè÷êè ó÷àñòíèöè â åâåíòà îðúæèå");
Reply
#8

Again spam from This SendClientMessage
Reply
#9

Код:
            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.
Reply
#10

Now again this command is for only id 0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)