14.05.2012, 09:30
Hi guys, what's up?
I'm trying to make an /engine command. It works fine. Problem is, when I enter a vehicle, and /engine it says that I turned off the engine (When it was already off), and only after that it says that I turned it on (and turns it on).
What's the problem? Here's my code:
Thanks !
I'm trying to make an /engine command. It works fine. Problem is, when I enter a vehicle, and /engine it says that I turned off the engine (When it was already off), and only after that it says that I turned it on (and turns it on).
What's the problem? Here's my code:
pawn Код:
CMD:engine(playerid, params[]) {
if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SCM(playerid, COLOR_RED, "You have to be the driver!");
new engine, lights, alarm, doors, bonnet, boot, objective;
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
strreplace(pname, '_', ' ');
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
if (!engine) {
SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, 1, alarm, doors, bonnet, boot, objective);
format(str, sizeof(str), "* %s attempts to turn on the engine, and succeeds", pname);
ProxDetector(30.0, playerid, str, COLOR_LIGHTGREEN,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN);
} else if (engine) {
SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, 0, alarm, doors, bonnet, boot, objective);
format(str, sizeof(str), "* %s attempts to turn off the engine, and succeeds", pname);
ProxDetector(30.0, playerid, str, COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
}
return 1;
}