Hello all ineed today is i got command /givecash (id) (ammount) now when i try to do like this
its tell me amount must be numbers because i but IsNumeric now how i can make IsNumeric accept that - so i can give player money and take from him money please help
Код:
if(strcmp(cmd, "/givecash", true) == 0 && PlayerAdminLevel[playerid] >= 1) // Gives a player money
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /givecash (id) (amount)");
return 1;
}
if(IsNumeric(tmp)) {
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /givecash (id) (amount) Amount must be numbers");
return 1;
}
giveplayerid = strval(tmp);
if(!IsPlayerConnected(giveplayerid)) {
format(string, sizeof(string), "ID (%d) is not an active player", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
new sendername[24];
new receivername[24];
GetPlayerName(playerid,sendername, 24);
GetPlayerName(giveplayerid,receivername, 24);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /givecash (id) (amount)");
return 1;
}
if(IsNumeric(tmp)) {
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /givecash (id) (amount) Amount must be numbers");
return 1;
}
if(Jailed[giveplayerid] == 1){
SendClientMessage(playerid,COLOR_ERROR,"You cant give ajail player money");
return 1;
}
if(Jailed[playerid] == 1){
SendClientMessage(playerid,COLOR_ERROR,"You cant use this command while you are in jail");
return 1;
}
new cashsend = strval(tmp);
GivePlayerMoney(giveplayerid,cashsend);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Cash Sent_|");
format(string, sizeof(string), "You have sent $%d to %s(%d)",cashsend,receivername,giveplayerid);
SendClientMessage(playerid, 0x00C7FFAA, string);
format(string, sizeof(string), "Server %s Has sent you $%d",AdminRanks[PlayerAdminLevel[playerid]],cashsend);
SendClientMessage(giveplayerid, 0x00C7FFAA, string);
format(string, sizeof(string), "%s %s(%d) Has sent $%d to receiver %s(%d)",AdminRanks[PlayerAdminLevel[playerid]],sendername,playerid,cashsend,receivername,giveplayerid);
SaveToFile("givemoeny",string);
return 1;
}