[HELP!] Adding a variable
#1

Hey guys,

I've been working on an engine ignition system, and I've got it working but now I'd like to store a variable that tells if the engine is on or not, I tried gEngineOn[playerid] or something of that sort but it didn't work, infact it cancelled out the ignition system entirely. I'd like this so I could do something like if the press the engine button again and the engineon variable == 1 then it would shut it off.

My question is, how would I do this? I know I have to store a variable but I don't know how to do that.

Thanks.
Reply
#2

https://sampwiki.blast.hk/wiki/GetVehicleParamsEx
Reply
#3

I know about that, would I do something like:

pawn Код:
if(GetVehicleParamsEx(vehicleid, 1, 0, 0, 0, 0, 0, 0))
{
SendClientMessage(playerid, COLOR_GREEN, "Engine is on");
}
else
{
SendClientMessage(playerid, COLOR_RED, "Engine is off");
}
that?
Reply
#4

pawn Код:
new engine,lights,alarm,doors,bonnet,boot,objective;//You can place it on top of your script

//On your engine command
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == 0)//-1 mean unset, 0 mean off, 1 mean on
{
    SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
Reply
#5

Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)