Commands says wrong command, (return 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Commands says wrong command, (return 0;) (
/showthread.php?tid=72020)
Commands says wrong command, (return 0;) -
kevinsoftware - 05.04.2009
Hello,
Why gives this command (when i not in the ATM) a error message :S
Код:
if(strcmp(cmd, "/bank", true) == 0){
if((getCheckpointType(playerid) != CP_BANK) && IsPlayerInCheckpoint(playerid)){
SendClientMessage(playerid, COLOR_RED, "* You are not in the bank (24/7 store)");
return 1;
}
tmp = strval(strtok(cmdtext, idx));
if(tmp == 0){
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bank [ammount]");
return 1;
}
if(logged[playerid] != 1){
SendClientMessage(playerid, COLOR_RED, "* You are not logged in.");
return 1;
}
if(tmp > GetPlayerMoney(playerid)){
format(string, sizeof(string), "* You dont have $%d", tmp);
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
if(tmp < 1){
format(string, sizeof(string), "* Wrong value: $%d", tmp);
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
bank[playerid] = bank[playerid] + tmp;
GivePlayerMoney(playerid, -tmp);
format(string, sizeof(string), "* You have posted $%d on you bank account, Your current balance is: $%d", tmp, bank[playerid]);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
Re: Commands says wrong command, (return 0;) -
Burridge - 05.04.2009
EDIT: sorry, dident read the command prperly, i thought it said /back not /bank
Re: Commands says wrong command, (return 0;) -
kevinsoftware - 05.04.2009
Quote:
Originally Posted by Burridge
EDIT: sorry, dident read the command prperly, i thought it said /back not /bank
|
okay
LOL
Re: Commands says wrong command, (return 0;) -
Bardokas - 05.04.2009
Try check at first IsPlayerInCheckpoint(playerid), because getCheckpointType(playerid) could crash if player isnt in checkpoint
[code=pawn] if(!IsPlayerInCheckpoint(playerid) || (getCheckpointType(playerid) != CP_BANK)){
SendClientMessage(playerid, COLOR_RED, "* You are not in the bank (24/7 store)");
return 1;
}[/code]