New Veh-Functions: Detect Engine
#1

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";
}
Reply
#2

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

You can perfectly assign a string with a '=' sign.
Reply
#4

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

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

Use Variables.
Reply
#7

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
Reply
#8

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)