unmatched closing brace ("}") - 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: unmatched closing brace ("}") (
/showthread.php?tid=634421)
unmatched closing brace ("}") -
AlexuTzVs - 18.05.2017
I get this error everytime i compile, am i blind, i didn't use the braces good or what? i can't understand
Код:
public CarCheck()
{
new string[256];
foreach(Player,j)
{
if(IsPlayerConnected(j))
{
new Float:health;
GetPlayerHealthEx(j, health);
new hp = GetPlayerHealth(j, health);
if(flymode[j] == 0 || AdminDuty[j] == 0 || hp >= 2 || HelperDuty[j] == 0)
{
SetPlayerHealthEx(j, health - 1.0);
}
if(GetPlayerCash(j) < 0)
{
if(MoneyMessage[j]==0)
{
format(string, sizeof(string), "You are in debt, you have till next Time Check to get: $%d or you go to jail.", GetPlayerCash(j));
SendClientMessage(j, COLOR_LIGHTRED, string);
MoneyMessage[j] = 1;
}
}
else
{
MoneyMessage[j] = 0;
}
}
}
return 1;
}
Error "unmatched closing brace ("}")" occurs at the brace after
Код:
SetPlayerHealthEx(j, health - 1.0);
}
Re: unmatched closing brace ("}") -
Dayrion - 18.05.2017
No'p, there is no missing bracket
PHP код:
public CarCheck()
{
new string[256];
foreach(Player,j)
{
if(IsPlayerConnected(j))
{
new Float:health;
GetPlayerHealthEx(j, health);
new hp = GetPlayerHealth(j, health);
if(flymode[j] == 0 || AdminDuty[j] == 0 || hp >= 2 || HelperDuty[j] == 0)
{
SetPlayerHealthEx(j, health - 1.0);
}
if(GetPlayerCash(j) < 0)
{
if(MoneyMessage[j]==0)
{
format(string, sizeof(string), "You are in debt, you have till next Time Check to get: $%d or you go to jail.", GetPlayerCash(j));
SendClientMessage(j, COLOR_LIGHTRED, string);
MoneyMessage[j] = 1;
}
}
else
{
MoneyMessage[j] = 0;
}
}
}
return 1;
}
Edit; new hp = GetPlayerHealth(j, health); should return 1 everytime because GetPlayerHealth return
Код:
Return Values:
1 - success
0 - failure (i.e. player not connected).
The player's health is stored in the specified variable.