19.01.2011, 21:14
Hi all,i maked this code to give money to all players (A specified ammount)
but it's not working.
1st: it's showing: Admin blabla has given 0$.
He return always 0$
2nd: Doesnt give the money.
What is wrong?
but it's not working.
1st: it's showing: Admin blabla has given 0$.
He return always 0$
2nd: Doesnt give the money.
pawn Код:
if(strcmp(cmd, "/givemoneyall", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
tmp = strtok(cmdtext, idx);
if(!strlen(tmp) && adminlevel[playerid] >= 2)
{
SendClientMessage(playerid, COLOR_DBLUE, "Correct Usage: /givemoneyall [amount]");
return 1;
}
new moneyxx;
giveplayerid = strval(tmp);
if(logged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_RED, "No.");
return 1;
}
tmp = strtok(cmdtext, idx);
moneyxx = strval(tmp);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(logged[playerid] == 1)
{
if(adminlevel[playerid] >= 2)
{
GivePlayerMoney(giveplayerid, moneyxx);
new string[128];
format(string, sizeof(string), "Admin %s give everyone %i$", sendername,moneyxx);
SendClientMessageToAll(COLOR_YELLOW, string);
new str[128];
format(str,sizeof str,"0,10Admin %s give everyone %i$",sendername,moneyxx);
IRC_GroupSay(IRC_Group, EchoChan,str);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GivePlayerMoney(i,moneyxx);
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "No.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "No.");
}
return 1;
}