27.10.2012, 16:36
Well as I am trying to create an engine script, it is working, but it is failing at the same time..
So I got everything working, but when people enter a car they can still drive it.. and when they do /engine it says engine turns on.... which is kinda bugged any way on fixing this, hELP ASAP
pawn Код:
CMD:engine(playerid, params[]) {
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
if(GetPlayerState(playerid) == 2)
{
if(IsPlayerInAnyVehicle(playerid)) {
switch(playerVariables[playerid][pCarEngine]) {
case 0: {
playerVariables[playerid][pCarEngine] = 1;
SetVehicleParamsEx(vehicleid,true,lights,alarm,doors,bonnet,boot,objective);
format(szMessage, sizeof(szMessage), "* %s has put his keys in the ignition, turning on the vehicle.", szPlayerName);
nearByMessage(playerid, COLOR_PURPLE, szMessage);
}
default: {
playerVariables[playerid][pCarEngine] = 0;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);//this will check that what is the state of engine.That is is on or off.We can use it for multiple things like doors,alarms etc.But In this case I am using this for the engine only.
SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
format(szMessage, sizeof(szMessage), "* %s has put his keys in the ignition, turning off the vehicle.", szPlayerName);
nearByMessage(playerid, COLOR_PURPLE, szMessage);
}
}
}
}
return 1;
}