Help [+REP] - 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)
+--- Thread: Help [+REP] (
/showthread.php?tid=571879)
Help [+REP] -
Muhammad78 - 23.04.2015
Can someone help me fix this 1 error?
Код:
CMD:setmoneybank(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][Level] < 5) return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
{
new string[64], tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setmoneybank [playerid] [amount]");
if(strval(tmp2) < 0 || strval(tmp2) > 100 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid, red, "ERROR: Invaild amount");
new player1 = strval(tmp), moneys = strval(tmp2);
GivePlayerMoney(player1, 0-moneys);
PlayerInfo[playerid][bank] = PlayerInfo[playerid][bank]+moneys;
format(string, sizeof(string), "You have set {00FC00}%s {03E3FC}money to {00FC00}%d", pName(player1), PlayerInfo[playerid][bank]);
SendClientMessage(playerid,blue,string);
SavePlayer(playerid);
}
else { // Line 25859
new string[64], tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setmoneybank [playerid] [amount]");
if(strval(tmp2) < 0 || strval(tmp2) > 100 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: Invalid amount");
new player1 = strval(tmp), moneys = strval(tmp2);
GivePlayerMoney(player1, 0+moneys);
PlayerInfo[playerid][bank] = PlayerInfo[playerid][bank]-moneys;
format(string, sizeof(string), "You have set {00FC00}%s {03E3FC}money to {00FC00}%d", pName(player1), PlayerInfo[playerid][bank]);
SendClientMessage(playerid,blue,string);
SavePlayer(playerid);
}
}
return 1;
}
Код:
C:\Users\USER\Desktop\grandlarc.pwn(25859) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: Help [+REP] -
aboa - 23.04.2015
pawn Код:
CMD:setmoneybank(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][Level] < 5) return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
if(strval(tmp2) < 0)
{
new string[64], tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setmoneybank [playerid] [amount]");
if(strval(tmp2) < 0 || strval(tmp2) > 100 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid, red, "ERROR: Invaild amount");
new player1 = strval(tmp), moneys = strval(tmp2);
GivePlayerMoney(player1, 0-moneys);
PlayerInfo[playerid][bank] = PlayerInfo[playerid][bank]+moneys;
format(string, sizeof(string), "You have set {00FC00}%s {03E3FC}money to {00FC00}%d", pName(player1), PlayerInfo[playerid][bank]);
SendClientMessage(playerid,blue,string);
SavePlayer(playerid);
}
else { // Line 25859
new string[64], tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setmoneybank [playerid] [amount]");
if(strval(tmp2) < 0 || strval(tmp2) > 100 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: Invalid amount");
new player1 = strval(tmp), moneys = strval(tmp2);
GivePlayerMoney(player1, 0+moneys);
PlayerInfo[playerid][bank] = PlayerInfo[playerid][bank]-moneys;
format(string, sizeof(string), "You have set {00FC00}%s {03E3FC}money to {00FC00}%d", pName(player1), PlayerInfo[playerid][bank]);
SendClientMessage(playerid,blue,string);
SavePlayer(playerid);
}
}
return 1;
}
Re: Help [+REP] -
Azula - 23.04.2015
Use sscanf
Re: Help [+REP] -
Muhammad78 - 23.04.2015
It's solved anyway, +rep for both