SA-MP Forums Archive
New Veh-Functions: Detect Engine - 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: New Veh-Functions: Detect Engine (/showthread.php?tid=205089)



New Veh-Functions: Detect Engine - Stas92 - 31.12.2010

Hey Guys,

I am trying to add the new functions to my script, but it doesn't work at all.
For example: How can I detect the engine state?

Код:
switch(Motor[veh]) {
case 0: motortext = "Off";
case 1: motortext = "On";
}
But that doesn't work:
Код:
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);

switch(engine) {
case VEHICLE_PARAMS_OFF: motortext = "Off";
case VEHICLE_PARAMS_ON: motortext = "On";
}



Re: New Veh-Functions: Detect Engine - DVDK - 31.12.2010

You cannot use = "text"; for a string, you've got to use a format.


Re: New Veh-Functions: Detect Engine - Vince - 31.12.2010

You can perfectly assign a string with a '=' sign.


Re: New Veh-Functions: Detect Engine - Stas92 - 31.12.2010

I can use = for a text without format, that works in the first method. But not in the second.


Re: New Veh-Functions: Detect Engine - legodude - 01.01.2011

try to work with brackets and after a quik look i saw u didnt have the : after thee case


Re: New Veh-Functions: Detect Engine - Sledge - 01.01.2011

Use Variables.


Re: New Veh-Functions: Detect Engine - Joe Staff - 01.01.2011

You can always to do a quickieconditional

pawn Код:
format(tmp,32,"You turned the engine %s",(motorstate)?("on"):("off"));
No need for such a short switch


Re: New Veh-Functions: Detect Engine - Stas92 - 01.01.2011

But sometimes i need a conditional, ... for example on OnPlayerKeyStateChange() ... how to use it there?

Edit: I guess this is the way how to solve the problem: http://pastebin.com/DWvE6mUj