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



Autofix... - LeeXian99 - 26.03.2013

Just having attempt to create autofix, but failed.

pawn Код:
if(oldstate == 2)
    {
        if(newstate == 2)
        {
            GetVehicleHealth(GetPlayerVehicleID(playerid), < 999);
            RepairVehicle(GetPlayerVehicleID(playerid));
        }
    }
Errors:
Код:
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5612) : error 029: invalid expression, assumed zero
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5612) : warning 215: expression has no effect
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5612) : error 001: expected token: ";", but found ")"
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5612) : error 029: invalid expression, assumed zero
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5612) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Autofix... - Dzines4SAMP - 26.03.2013

Which line is 5612?


Re: Autofix... - LeeXian99 - 26.03.2013

GetVehicleHealth(GetPlayerVehicleID(playerid), < 999);


Re: Autofix... - Gamer_007 - 26.03.2013

pawn Код:
if(oldstate == 2)
    {
        if(newstate == 2)
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            if(GetVehicleHealth(vehicleid) < 999)
{
            RepairVehicle(vehicleid);
}
        }
    }
Try this and dont forget to indent the code or u will tell i got warning for loose indentation :P


Re: Autofix... - LeeXian99 - 26.03.2013

It runs normal when compiled it, but when I tried it on my test server, it's not working! D:


Re: Autofix... - JaKe Elite - 26.03.2013

that's not how auto repair works.
You need timer to do it.


Re: Autofix... - Vince - 26.03.2013

pawn Код:
if(oldstate == 2)
    {
        if(newstate == 2)
Yeah, that makes perfect sense. This will never come true. I don't even think that it'll work if you move a player from one vehicle to another by means of scripting. Also please use PLAYER_STATE_DRIVER. Those definitions are there for a reason. Use them.