SA-MP Forums Archive
Help me please with this Error - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help me please with this Error (/showthread.php?tid=146504)



Help me please with this Error - HireMe - 07.05.2010

I have a problem with this little piece off script i get a error of it.
The error i get is : warning 205: redundant code: constant expression is zero.
Can someone help me please?

public OnPlayerSpawn(playerid)
{
if(PocketMoney == 0)
{
GivePlayerMoney(playerid, PocketMoney);
SetPlayerInterior(playerid,0);
SetPlayerRandomSpawn(playerid);
TogglePlayerClock(playerid,1);
}
else
{
SetPlayerInterior(playerid,0);
SetPlayerRandomSpawn(playerid);
TogglePlayerClock(playerid,1);
}
return 1;
}


When someone spawns he always gets the PocketMoney. I want it only to happen when he got $0 cash.



Re: Help me please with this Error - dice7 - 07.05.2010

Like this ?

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(GetPlayerMoney(playerid) == 0)
    {
        GivePlayerMoney(playerid, PocketMoney);
        SetPlayerInterior(playerid,0);
        SetPlayerRandomSpawn(playerid);
        TogglePlayerClock(playerid,1);
    }
    else
    {
        SetPlayerInterior(playerid,0);
        SetPlayerRandomSpawn(playerid);
        TogglePlayerClock(playerid,1);
    }
    return 1;
}