18.09.2016, 19:26
Hello, I have made a car engine system in my gamemode.
Everything is working good but only the thing is if I enter a vehicle and use /engine if turns the engine off first, if I type /engine again then the engine goes on. How can I do it that you type /engine and the engine goes directly on in steat off first ?
Car engine command:
Do I need to add something else somewhere ??
Everything is working good but only the thing is if I enter a vehicle and use /engine if turns the engine off first, if I type /engine again then the engine goes on. How can I do it that you type /engine and the engine goes directly on in steat off first ?
Car engine command:
PHP код:
CMD:engine(playerid, params[]) {
new vehicleid = GetPlayerVehicleID(playerid), string[128];
new engine, lights, alarm, doors, bonnet, boot, objective;
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "You're not in a vehicle.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_WHITE, "You're not the driver of this vehicle!");
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(engine == 0) {
SetVehicleParamsEx(vehicleid, true, lights, alarm, doors, bonnet, boot, objective);
format(string, sizeof string, "* %s has switched their engine on.", GetPlayerNameEx(playerid));
engine = 1;
}
else {
SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective);
format(string, sizeof string, "* %s has switched their engine off.", GetPlayerNameEx(playerid));
engine = 0;
}
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}