SA-MP Forums Archive
Invalid Function or Declaration 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: Invalid Function or Declaration HELP. (/showthread.php?tid=558914)



Invalid Function or Declaration HELP. - xXryanXx - 19.01.2015

if(GetPlayerScore(playerid) >= 10) && (GetPlayerHealth(playerid) >0))
{
SetPlayerArmour(playerid, 10);
SendClientMessage(playerid, DeathColor, "You gain 10 armour on spawn because of your level.");
}


I have this under OnPlayerSpawn btw.


Tell me what i'm doing wrong and then feel free to insult my intelligence.

C:\Program Files (x86)\Rockstar Games\GTA San Andreas\gamemodes\bryanworldv2.pwn(89) : error 010: invalid function or declaration


Re: Invalid Function or Declaration HELP. - nezo2001 - 19.01.2015

PHP код:
if(GetPlayerScore(playerid) >= 10 && GetPlayerHealth(playerid) >0



Re: Invalid Function or Declaration HELP. - xXryanXx - 19.01.2015

That didn't work sadly.


Re: Invalid Function or Declaration HELP. - Schneider - 19.01.2015

pawn Код:
new Float:Health;
GetPlayerHealth(playerid, Health);
if((GetPlayerScore(playerid) >= 10) && (Health > 0.0))
{
    SetPlayerArmour(playerid, 10);
    SendClientMessage(playerid, DeathColor, "You gain 10 armour on spawn because of your level.");
}
But why are you checking if the player is not dead at OnPlayerSpawn? Players are always alive when they spawn.


Re: Invalid Function or Declaration HELP. - nezo2001 - 19.01.2015

PHP код:
new score GetPlayerScore(playerid);
new 
Float:Health;
new 
health GetPlayerHealth(playerid);
if(
score >= 10 && health >0)
{
SetPlayerArmour(playerid10);
SendClientMessage(playeridDeathColor"You gain 10 armour on spawn because of your level.");

Edit: -_-.


Re: Invalid Function or Declaration HELP. - xXryanXx - 19.01.2015

>Schneider, forgot to remove it when I had it on death.


Re: Invalid Function or Declaration HELP. - xXryanXx - 19.01.2015

Nezo, that literally made the compiler crash.


Re: Invalid Function or Declaration HELP. - xXryanXx - 19.01.2015

Neither of these work.


Re: Invalid Function or Declaration HELP. - Schneider - 19.01.2015

pawn Код:
if(GetPlayerScore(playerid) >= 10)
{
    SetPlayerArmour(playerid, 10);
    SendClientMessage(playerid, DeathColor, "You gain 10 armour on spawn because of your level.");
}



Re: Invalid Function or Declaration HELP. - xXryanXx - 19.01.2015

Код:
public OnPlayerSpawn(playerid)
    if(GetPlayerTeam(playerid) == Bloods)
    {
        SetPlayerColor(playerid, BloodsColor); // Set his color to the BloodsColor (Red)
           /* Any other bonus' you want to add to the Bloods team add it here. */
    }

    else if(GetPlayerTeam(playerid) ==Crips)
    {
        SetPlayerColor(playerid, CripsColor);  // Same as above but in this case, CripsColor (Blue)
           /* Any other bonus' you want to add to the Crips team add it here. */
	}

 	if(GetPlayerScore(playerid) >= 10)
	{
    SetPlayerArmour(playerid, 10);
    SendClientMessage(playerid, DeathColor, "You gain 10 armour on spawn because of your level.");
	}
}
Here is the full OnPlayerSpawn part, it's still not working.