cmd(give, playerid, params[])
{
if(IsPlayerConnected(playerid) && PlayerLoggedIn[playerid])
{
new player[32];
new item[128];
new amount[32];
sscanf(params, "uss", player, item, amount);
if(isnull(player))
{
SendClientMessage(playerid, COLOR_HELP, "USAGE: /give [ID/PartOfName] [item] [amount]");
SendClientMessage(playerid, COLOR_HELP, "ITEMS: money, gun");
return 1;
}
if(isnull(item))
{
SendClientMessage(playerid, COLOR_HELP, "USAGE: /give [ID/PartOfName] [item] [amount]");
SendClientMessage(playerid, COLOR_HELP, "ITEMS: money, gun");
return 1;
}
if(!strcmp(item, "money"))
{
if(isnull(amount))
{
SendClientMessage(playerid, COLOR_HELP, "USAGE: /give [ID/PartOfName] [item] [amount]");
SendClientMessage(playerid, COLOR_HELP, "ITEM: money, gun");
return 1;
}
GivePlayerCash(playerid,-amount); // Line: 3285
GivePlayerCash(player,amount); // Line: 3286
}
}
return 1;
}
C:\Documents and Settings\Ivan\Desktop\SERVER\gamemodes\cgrpg.pwn(3285) : error 035: argument type mismatch (argument 2) C:\Documents and Settings\Ivan\Desktop\SERVER\gamemodes\cgrpg.pwn(3286) : error 035: argument type mismatch (argument 1)
if ( isnull(player //player isn't a string, a string is an array of characters
Originally Posted by Donny
This has nothing to do with zcmd or sscanf it's you trying to check the index of a none array (player).
pawn Код:
|
new player;
new player[32];
Originally Posted by Donny
This has nothing to do with zcmd or sscanf it's you trying to check the index of a none array (player).
pawn Код:
Learn from my reply, you are doing the same thing but the other way around now. |
cmd(give, playerid, params[]) { if(PlayerLoggedIn[playerid] != 1) return 1; new player; new item[12]; new amount; if(sscanf(params, "usd", player, item, amount)) { SendClientMessage(playerid, COLOR_HELP, "USAGE: /give [ID/PartOfName] [item] [amount]"); SendClientMessage(playerid, COLOR_HELP, "ITEMS: money, gun"); return 1; } else if(player == INVALID_PLAYER_ID) { SendClientMessage(playerid, COLOR_HELP, "Player not found."); return 1; } if(!strcmp(item, "money", true)) { GivePlayerCash(playerid, -amount); GivePlayerCash(player, amount); } return 1; }