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



God car? - SnG.Scot_MisCuDI - 23.12.2011

Here is my script but its not working.

pawn Код:
if (strcmp("/godc", cmdtext, true, 8 ) == 0)
{
    if(GetPVarInt(playerid,"GodCar")==0)
    {
        SetVehicleHealth(playerid,1000000);
        SetPVarInt(playerid,"GodCar",1);
        SendClientMessage(playerid,COL_ADMIN,"God car on");
    }
    else
    {
        SetVehicleHealth(playerid,1000);
        SetPVarInt(playerid,"GodCar",0);
        SendClientMessage(playerid,COL_ADMIN,"God car off");
       
    }
    return 1;
}



Re: God car? - coole210 - 23.12.2011

That just sets the vehicle health.. use this:

Код:
//Global variable:
new GodCar[MAX_PLAYERS];
//Command:
if (strcmp("/godc", cmdtext, true, 8 ) == 0)
{
    if(GetPVarInt(playerid,"GodCar")==0)
    {
        GodCar[playerid] = SetTimerEx("GodCar",500,true,"d",playerid);
        SetPVarInt(playerid,"GodCar",1);
        SendClientMessage(playerid,COL_ADMIN,"God car on");
    }
    else
    {
        KillTimer(GodCar[playerid]);
        SetPVarInt(playerid,"GodCar",0);
        SendClientMessage(playerid,COL_ADMIN,"God car off");
       
    }
    return 1;
}
//TIMER:
forward GodCar(playerid);
public GodCar(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
RepairVehicle(GetPlayerVehicleID(playerid));
}
return 1;
}



Re: God car? - SnG.Scot_MisCuDI - 23.12.2011

pawn Код:
(282) : error 029: invalid expression, assumed zero
(282) : error 012: invalid function call, not a valid address
(282) : warning 215: expression has no effect
(282) : error 001: expected token: ";", but found ")"
(282) : fatal error 107: too many error messages on one line
pawn Код:
forward GodCar(playerid);



Re: God car? - coole210 - 23.12.2011

Add
Код:
new GodCar[MAX_PLAYERS];
to the top of the script..


Re: God car? - SnG.Scot_MisCuDI - 23.12.2011

i did but i got those errors after i did. I changed the errors to new ones


Re: God car? - Thresholdold - 23.12.2011

Try changing
pawn Код:
RepairVehicle(GetPlayerVehicleID(playerid));
to

pawn Код:
RepairVehicle(vehicleid);



Re: God car? - SnG.Scot_MisCuDI - 23.12.2011

still the same. Where should i add the timer under? i have it right under the /godc command but i dont believe thats right


Re: God car? - Thresholdold - 23.12.2011

Quote:
Originally Posted by googamalugafoo
Посмотреть сообщение
still the same. Where should i add the timer under? i have it right under the /godc command but i dont believe thats right
It should be at the very bottom of your script.


Re: God car? - SnG.Scot_MisCuDI - 23.12.2011

No matter where i put it i keep getting an error with
pawn Код:
forward GodCar(playerid);