SA-MP Forums Archive
Problem - 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: Problem (/showthread.php?tid=577897)



Problem - Scottylad - 14.06.2015

I get:
Quote:

C:\Users\Callum.Acer\Desktop\South Central RP\gamemodes\roleplay.pwn(14493) : warning 217: loose indentation
C:\Users\Callum.Acer\Desktop\South Central RP\gamemodes\roleplay.pwn(14507) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

For these two lines (In order)

Код:
if (PlayerData[i][pHunger] >= 25)
Код:
return 1;
Whole code:

Код:
forward HungerThirstCheck(playerid);
public HungerThirstCheck(playerid)
{
	foreach (new i : Player)
	{
		if (PlayerData[i][pHunger] >= 50)
		{
				GameTextForPlayer(i, "You are hungry, get something to eat.", 1, 6);
			}
			if (PlayerData[i][pHunger] >= 25)
			{
				GameTextForPlayer(i, "You are starving, get something to eat before you die.", 8, 8);
			}
       		if (PlayerData[i][pThirst] >= 50)
			{
				GameTextForPlayer(i, "You are thirsty, get something to drink.", 8, 8);
			}
			if (PlayerData[i][pHunger] >= 25)
			{
				GameTextForPlayer(i, "You are becoming unstable, get something to drink before you dehydrate.", 8, 8);
			}
		}
	}
	return 1;
}



Re: Problem - xamen - 14.06.2015

Код:
forward HungerThirstCheck(playerid);
public HungerThirstCheck(playerid)
{
	foreach(new i : Player)
	{
		if(PlayerData[i][pHunger] >= 50)
		{
			GameTextForPlayer(i, "You are hungry, get something to eat.", 1, 6);
		}
		if(PlayerData[i][pHunger] >= 25)
		{
			GameTextForPlayer(i, "You are starving, get something to eat before you die.", 8, 8);
		}
       		if(PlayerData[i][pThirst] >= 50)
		{
			GameTextForPlayer(i, "You are thirsty, get something to drink.", 8, 8);
		}
		if(PlayerData[i][pHunger] >= 25)
		{
			GameTextForPlayer(i, "You are becoming unstable, get something to drink before you dehydrate.", 8, 8);
		}
	}
	return 1;
}



Re: Problem - Scottylad - 14.06.2015

Nah, it didn't work




Re: Problem - Trucido - 14.06.2015

Код:
forward HungerThirstCheck(playerid);
public HungerThirstCheck(playerid)
{
	foreach (new i : Player)
	{
		if (PlayerData[i][pHunger] >= 50)
		{
				GameTextForPlayer(i, "You are hungry, get something to eat.", 1, 6);
		}
		else if (PlayerData[i][pHunger] >= 25)
			{
				GameTextForPlayer(i, "You are starving, get something to eat before you die.", 8, 8);
			}
       		else if (PlayerData[i][pThirst] >= 50)
			{
				GameTextForPlayer(i, "You are thirsty, get something to drink.", 8, 8);
			}
		else if (PlayerData[i][pHunger] >= 25)
			{
				GameTextForPlayer(i, "You are becoming unstable, get something to drink before you dehydrate.", 8, 8);
			}
		
	}
	return 1;
}



Re: Problem - SoFahim - 15.06.2015

PHP код:
forward HungerThirstCheck(playerid);
public 
HungerThirstCheck(playerid)
{
    foreach (new 
Player)
    {
        if (
PlayerData[i][pHunger] >= 50)
        {
                
GameTextForPlayer(i"You are hungry, get something to eat."16);
            }
            if (
PlayerData[i][pHunger] >= 25)
            {
                
GameTextForPlayer(i"You are starving, get something to eat before you die."88);
            }
               if (
PlayerData[i][pThirst] >= 50)
            {
                
GameTextForPlayer(i"You are thirsty, get something to drink."88);
            }
            if (
PlayerData[i][pHunger] >= 25)
            {
                
GameTextForPlayer(i"You are becoming unstable, get something to drink before you dehydrate."88);
            }
        }
    }
return 
1;

Use this


Re: Problem - mamorunl - 15.06.2015

Quote:
Originally Posted by SoFahim
Посмотреть сообщение
PHP код:
forward HungerThirstCheck(playerid);
public 
HungerThirstCheck(playerid)
{
    foreach (new 
Player)
    {
        if (
PlayerData[i][pHunger] >= 50)
        {
                
GameTextForPlayer(i"You are hungry, get something to eat."16);
            }
            if (
PlayerData[i][pHunger] >= 25)
            {
                
GameTextForPlayer(i"You are starving, get something to eat before you die."88);
            }
               if (
PlayerData[i][pThirst] >= 50)
            {
                
GameTextForPlayer(i"You are thirsty, get something to drink."88);
            }
            if (
PlayerData[i][pHunger] >= 25)
            {
                
GameTextForPlayer(i"You are becoming unstable, get something to drink before you dehydrate."88);
            }
        }
    }
return 
1;

Use this
Don't use this check again.

Align the brackets and you'll see the problem


Re: Problem - SoFahim - 15.06.2015

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
Don't use this check again.

Align the brackets and you'll see the problem
Damn My bad. This is the fixed one:

PHP код:
forward HungerThirstCheck(playerid);
public 
HungerThirstCheck(playerid)
{
    foreach (new 
Player)
    {
        if (
PlayerData[i][pHunger] >= 50)
             {
                
GameTextForPlayer(i"You are hungry, get something to eat."16);
            }
            if (
PlayerData[i][pHunger] >= 25)
            {
                
GameTextForPlayer(i"You are starving, get something to eat before you die."88);
            }
               if (
PlayerData[i][pThirst] >= 50)
            {
                
GameTextForPlayer(i"You are thirsty, get something to drink."88);
            }
            if (
PlayerData[i][pHunger] >= 25)
            {
                
GameTextForPlayer(i"You are becoming unstable, get something to drink before you dehydrate."88);
            }
        }
   return 
1;
  } 



Re: Problem - mamorunl - 15.06.2015

Quote:
Originally Posted by Scottylad
Посмотреть сообщение
Nah, it didn't work
What exactly did not work? Did you still get the error? Leaving aside loose indentation as that is just your tabbing that does not match.


Re: Problem - Threshold - 15.06.2015

Am I the only one that can see the 'playerid' parameter or not?