dcmd_withdraw(playerid,params[])
{
if (!udb_Exists(PlayerName(playerid))) return PlayerMsg(playerid,red,"You Must Be Registerd!");
if (udb_UserInt(PlayerName(playerid),"LoggedIn")== 0) return PlayerMsg(playerid,red,"You Must Be Logged In!");
if (strlen(params)==0) return PlayerMsg(playerid,red,"USAGE : '/withdraw howmuch'");
new Amout[255];
Amout = strval(params);
if (amout > udb_UserInt(PlayerName(playerid)"BankMoney")) return PlayerMsg(playerid,red,"Invalid Amout!");
}
else {
PlayerMsg(playerid,red,"THX For Useing The Bank!");
GivePlayerMoney(playerid,strval(params));
udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")-strval(params));
return 0;
}
return 1;
}
C:\DOCUME~1\ADMINI~1\Desktop\SAMPSE~1\FILTER~1\admin.pwn(236) : error 033: array must be indexed (variable "Amout") C:\DOCUME~1\ADMINI~1\Desktop\SAMPSE~1\FILTER~1\admin.pwn(237) : error 017: undefined symbol "amout" C:\DOCUME~1\ADMINI~1\Desktop\SAMPSE~1\FILTER~1\admin.pwn(237) : warning 215: expression has no effect C:\DOCUME~1\ADMINI~1\Desktop\SAMPSE~1\FILTER~1\admin.pwn(237) : error 001: expected token: ";", but found ")" C:\DOCUME~1\ADMINI~1\Desktop\SAMPSE~1\FILTER~1\admin.pwn(237) : error 029: invalid expression, assumed zero C:\DOCUME~1\ADMINI~1\Desktop\SAMPSE~1\FILTER~1\admin.pwn(237) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Errors.
dcmd_withdraw(playerid,params[]) { if (!udb_Exists(PlayerName(playerid))) return PlayerMsg(playerid,red,"You Must Be Registerd!"); if (udb_UserInt(PlayerName(playerid),"LoggedIn")== 0) return PlayerMsg(playerid,red,"You Must Be Logged In!"); if (strlen(params)==0) return PlayerMsg(playerid,red,"USAGE : '/withdraw howmuch'"); new Amout[255]; Amout = strval(params); if (Amout > udb_UserInt(PlayerName(playerid)"BankMoney")) return PlayerMsg(playerid,red,"Invalid Amout!"); else { PlayerMsg(playerid,red,"THX For Useing The Bank!"); GivePlayerMoney(playerid,strval(params)); udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")-strval(params)); return 0; } return 1; }
Originally Posted by ray187
Pawn -> case sensitive.
You create a new array: Amout[255] and later on write it without a capital `A`. You also got one curly brace too much. Note that you could have seen that yourself by just reading the error messages. Here`s the correct code: Код:
dcmd_withdraw(playerid,params[]) { if (!udb_Exists(PlayerName(playerid))) return PlayerMsg(playerid,red,"You Must Be Registerd!"); if (udb_UserInt(PlayerName(playerid),"LoggedIn")== 0) return PlayerMsg(playerid,red,"You Must Be Logged In!"); if (strlen(params)==0) return PlayerMsg(playerid,red,"USAGE : '/withdraw howmuch'"); new Amout[255]; Amout = strval(params); if (Amout > udb_UserInt(PlayerName(playerid)"BankMoney")) return PlayerMsg(playerid,red,"Invalid Amout!"); else { PlayerMsg(playerid,red,"THX For Useing The Bank!"); GivePlayerMoney(playerid,strval(params)); udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")-strval(params)); return 0; } return 1; } |
Originally Posted by ray187
Right first off no need to get cheeky just as you made another mistake that I didn`t see.
You forget a "," in this line: if (Amout > udb_UserInt(PlayerName(playerid),"BankMoney")) Also, as I just noticed - you create Amount as an array allthough you wanna use it for an integer. Remove "[255]". |
dcmd_withdraw(playerid,params[])
{
if (!udb_Exists(PlayerName(playerid)))
return PlayerMsg(playerid,red,"You Must Be Registerd!");
if (udb_UserInt(PlayerName(playerid),"LoggedIn")== 0)
return PlayerMsg(playerid,red,"You Must Be Logged In!");
if (strlen(params)==0)
return PlayerMsg(playerid,red,"USAGE : '/withdraw howmuch'");
new Amout;
Amout = strval(params);
if (Amout > udb_UserInt(PlayerName(playerid),"BankMoney"))
return PlayerMsg(playerid,red,"Invalid Amout!");
else {
PlayerMsg(playerid,red,"THX For Useing The Bank!");
GivePlayerMoney(playerid,strval(params));
udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")-strval(params));
return 0;
}
}
Originally Posted by ray187
Right first off no need to get cheeky just as you made another mistake that I didn`t see.
You forget a "," in this line: if (Amout > udb_UserInt(PlayerName(playerid),"BankMoney")) Also, as I just noticed - you create Amount as an array allthough you wanna use it for an integer. Remove "[255]". |