Commands says wrong command, (return 0;)
#1

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

EDIT: sorry, dident read the command prperly, i thought it said /back not /bank




Reply
#3

Quote:
Originally Posted by Burridge
EDIT: sorry, dident read the command prperly, i thought it said /back not /bank




okay LOL
Reply
#4

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]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)