[HELP!] Adding a variable - 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!] Adding a variable (
/showthread.php?tid=272078)
[HELP!] Adding a variable -
Jmarr - 27.07.2011
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.
Re: [HELP!] Adding a variable -
=WoR=Varth - 27.07.2011
https://sampwiki.blast.hk/wiki/GetVehicleParamsEx
Re: [HELP!] Adding a variable -
Jmarr - 27.07.2011
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?
Re: [HELP!] Adding a variable -
=WoR=Varth - 27.07.2011
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);
Re: [HELP!] Adding a variable -
Jmarr - 27.07.2011
Thank you.