SA-MP Forums Archive
1 weird error and warning! :S [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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 1 weird error and warning! :S [HELP] (/showthread.php?tid=84010)



1 weird error and warning! :S [HELP] - Moustafa - 28.06.2009

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SECONDARY_ATTACK)
    {
        if (PlayerToPoint(0.5, playerid, 1778.5148,-1575.8615,17.4416))
        {
          new newhealth = +50; // LINE 16
            SetPlayerHealth(playerid, newhealth);
        }
    }
    return 1;
}
After i compile, it gives me error and warning... Line 16 is "new newhealth = +50;

pawn Код:
C:\Documents and Settings\Moustafa & Ahmed\Desktop\Desktop\server\filterscripts\prisonhealth.pwn(16) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Moustafa & Ahmed\Desktop\Desktop\server\filterscripts\prisonhealth.pwn(16) : warning 215: expression has no effect



Re: 1 weird error and warning! :S [HELP] - arnutisz - 28.06.2009

shoul be new Float:newhealth


Re: 1 weird error and warning! :S [HELP] - Moustafa - 28.06.2009

Quote:
Originally Posted by Scott[LT
]
shoul be new Float:newhealth
Didn't work


Re: 1 weird error and warning! :S [HELP] - illay - 28.06.2009

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SECONDARY_ATTACK)
    {
        if (PlayerToPoint(0.5, playerid, 1778.5148,-1575.8615,17.4416))
        {
            #define newhealth 50
            new Float:oldhealth;
            GetPlayerHealth(playerid,oldhealth);
            SetPlayerHealth(playerid,oldhealth + newhealth);
        }
    }
    return 1;
}
0 error, 0 warning, done

David