Error help - 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: Error help (
/showthread.php?tid=541291)
Error help -
ZachKnoxx - 11.10.2014
Код HTML:
C:\Users\Zachary.Zach-HP.000\Desktop\Folders\SA-MP\Los Santos Realism\gamemodes\LS-R.pwn(262) : warning 205: redundant code: constant expression is zero
C:\Users\Zachary.Zach-HP.000\Desktop\Folders\SA-MP\Los Santos Realism\gamemodes\LS-R.pwn(265) : warning 217: loose indentation
C:\Users\Zachary.Zach-HP.000\Desktop\Folders\SA-MP\Los Santos Realism\gamemodes\LS-R.pwn(265) : error 014: invalid statement; not in switch
C:\Users\Zachary.Zach-HP.000\Desktop\Folders\SA-MP\Los Santos Realism\gamemodes\LS-R.pwn(265) : warning 215: expression has no effect
C:\Users\Zachary.Zach-HP.000\Desktop\Folders\SA-MP\Los Santos Realism\gamemodes\LS-R.pwn(265) : error 001: expected token: ";", but found ":"
C:\Users\Zachary.Zach-HP.000\Desktop\Folders\SA-MP\Los Santos Realism\gamemodes\LS-R.pwn(265) : error 029: invalid expression, assumed zero
C:\Users\Zachary.Zach-HP.000\Desktop\Folders\SA-MP\Los Santos Realism\gamemodes\LS-R.pwn(265) : fatal error 107: too many error messages on one line
for
Код HTML:
if(dialogid == 12)
{
if(!response)
return 1;
switch(listitem)
{
case 0:
{
if(500 < 0) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveBankMoney(playerid, 500);
GiveMoney(playerid, -500);
case 1:
{
if(amount < 0) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveMoney(playerid, -amount);
GiveBankMoney(playerid, amount);
}
case 2:
{
if(amount < 0) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveMoney(playerid, amount);
GiveBankMoney(playerid, -amount);
}
case 3:
{
if(amount < 0) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveMoney(playerid, -amount);
GiveSavings(playerid, amount);
}
case 4:
{
if(amount < 0) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveMoney(playerid, amount);
GiveSavings(playerid, -amount);
}
case 5:
{
if(amount < 0) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GivePlayerMoney(playerid, -100000);
}
}
}
return 1;
}
Re: Error help -
Chenko - 11.10.2014
Your missing a bracket for case 0.
It should be this:
pawn Код:
if(dialogid == 12)
{
if(!response)
return 1;
switch(listitem)
{
case 0:
{
if(500 < 0) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveBankMoney(playerid, 500);
GiveMoney(playerid, -500);
}
case 1:
{
if(amount < 0) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveMoney(playerid, -amount);
GiveBankMoney(playerid, amount);
}
case 2:
{
if(amount < 0) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveMoney(playerid, amount);
GiveBankMoney(playerid, -amount);
}
case 3:
{
if(amount < 0) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveMoney(playerid, -amount);
GiveSavings(playerid, amount);
}
case 4:
{
if(amount < 0) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveMoney(playerid, amount);
GiveSavings(playerid, -amount);
}
case 5:
{
if(amount < 0) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GivePlayerMoney(playerid, -100000);
}
}
}
return 1;
}
Re: Error help -
Threshold - 11.10.2014
You haven't given 'amount' any value. I'm just going to assume that 'amount' is the value of the text inputted into the dialog. "amount = strval(inputtext)".
pawn Код:
if(dialogid == 12)
{
if(!response) return 1;
new amount = strval(inputtext);
switch(listitem)
{
case 0:
{
if(!amount) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveBankMoney(playerid, 500);
GiveMoney(playerid, -500);
}
case 1:
{
if(!amount) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveMoney(playerid, -amount);
GiveBankMoney(playerid, amount);
}
case 2:
{
if(!amount) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveMoney(playerid, amount);
GiveBankMoney(playerid, -amount);
}
case 3:
{
if(!amount) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveMoney(playerid, -amount);
GiveSavings(playerid, amount);
}
case 4:
{
if(!amount) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GiveMoney(playerid, amount);
GiveSavings(playerid, -amount);
}
case 5:
{
if(!amount) return SendClientMessage(playerid, COLOR_GREEN, "Invalid amount.");
GivePlayerMoney(playerid, -100000);
}
}
return 1;
}
Re: Error help -
ZachKnoxx - 11.10.2014
I'm still getting errors.
EDIT: Nevermind, thank you both.
Re: Error help -
Chenko - 11.10.2014
You're welcome, glad I could help.