Errorz...(REP+)
#1

Ok guyz i've got a big problem (again but different)
Код:
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.
and the linez:
Код:
	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;
}
please help me to solve the problems (REP+)
Reply
#2

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.
Reply
#3

Quote:
Originally Posted by AustinJ
Посмотреть сообщение
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.
and can you help me solve 'em? please
Reply
#4

pawn Код:
new string[256]; //top of script
Reply
#5

This loop should be placed under a timer of your choice.
pawn Код:
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);
        }
    }
}
I am assuming you want something like that.

The above code has not be compiled or tested.
Reply
#6

man...you confused me...ok...let's take it easy, i dont want format(string, 128, "* %s starts feeling hungry.", RPN(playerid)); cuz i was thinking and it's a bit Non-RP 'aight? than can you show me the code a created withous this? string and stuff? please and thanks

EDIT: I want my code...not other
Reply
#7

This would be the code stripped of the messages...
pawn Код:
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);
        }
    }
}
As for your code, it won't work. Mine is doing the same thing in the end. Just put that loop under a 5 Minute timer or something like that. Depends on how fast you want hunger to go down.

I am going to be going to bed, so I am unavailable for further assistance sorry I have to be up in 4 hours for work.
Reply
#8

Thanks nigg' ya helped me...i used my code but u helped me anyways thanks REP+ like the deal
Reply
#9

CLOSED
Reply
#10

Quote:
Originally Posted by bloodrocklee
Посмотреть сообщение
Thanks nigg' ya helped me...i used my code but u helped me anyways thanks REP+ like the deal
Reminder: You can't give Rep if your post is under 50.You mush have 50+ post to give someone Rep.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)