D:\Jocuri\Long Beach California Hard Roleplay\gamemodes\ZRP.pwn(2519) : error 003: declaration of a local variable must appear in a compound block D:\Jocuri\Long Beach California Hard Roleplay\gamemodes\ZRP.pwn(2519) : error 017: undefined symbol "string" D:\Jocuri\Long Beach California Hard Roleplay\gamemodes\ZRP.pwn(2519) : warning 215: expression has no effect D:\Jocuri\Long Beach California Hard Roleplay\gamemodes\ZRP.pwn(2519) : error 001: expected token: ";", but found "]" D:\Jocuri\Long Beach California Hard Roleplay\gamemodes\ZRP.pwn(2519) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
new Float:health;
GetPlayerHealth(playerid, health);
new HungryTime = SetPlayerHealth(playerid, health-5);
if(GetProgressBarValue(hungry[playerid]) <= 0)
new string[255];
{
SetTimer("HungryTime", 10000, 1);
format(string, sizeof(string), "* %s starts feeling hungry.", RPN(playerid), price);
SendClientMessage(playerid, COLOR_HUNGRY, "You are hungry, go and eat something.");
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE);
}
if(GetProgressBarValue(hungry[playerid]) <= 0)
{
SetProgressBarValue(hungry[playerid], 0);
}
if(GetProgressBarValue(hungry[playerid]) > 0)
{
KillTimer(HungryTime);
}
}
return 1;
}
|
Well your `new string[255];` needs to be moved down to after the line with `{`
EDIT: You got more issues then just that. The way you do everything in the snippet of code is pretty much wrong. |
new string[256]; //top of script
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
if(IsPlayerConnected(playerid))
{
new Float:health, string[128];
GetPlayerHealth(playerid, health);
if(GetProgressBarValue(hungry[playerid]) > 0)
{
SetProgressBarValue(hungry[playerid], GetProgressBarValue(hungry[playerid]) - 1)
if(GetProgressBarValue(hungry[playerid] <= 50) // Player Less Then 50% Hunger Display Message?
{
format(string, 128, "* %s starts feeling hungry.", RPN(playerid));
SendClientMessage(playerid, COLOR_HUNGRY, "You are hungry, go and eat something.");
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE);
}
}
else // Player Starving Deduct Health?
{
SetPlayerHealth(playerid, health-5);
format(string, 128, "* %s is starving.", RPN(playerid));
SendClientMessage(playerid, COLOR_HUNGRY, "You are starving. You need to eat something.");
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE);
}
}
}
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
if(IsPlayerConnected(playerid))
{
new Float:health;
GetPlayerHealth(playerid, health);
if(GetProgressBarValue(hungry[playerid]) > 0)
{
SetProgressBarValue(hungry[playerid], GetProgressBarValue(hungry[playerid]) - 1)
}
else
{
SetPlayerHealth(playerid, health-5);
}
}
}
|
Thanks nigg' ya helped me...i used my code but u helped me anyways thanks REP+ like the deal
|