29.12.2010, 16:05
Hey, could someone give me a line that shutdowns the vehicles engine? (0.3c)
if(strcmp("/engine", cmdtext, true, 10) == 0) { new engine,lights,alarm,doors,bonnet,boot,objective; new veh = GetPlayerVehicleID(playerid); if(IsPlayerInAnyVehicle(playerid)) { if(veh != INVALID_VEHICLE_ID) { if(EngineStatus[playerid] == 0) { GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); EngineStatus[playerid] = 1; SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's engine {2F991A}on!"); return 1; } else if(EngineStatus[playerid] == 1) { GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective); EngineStatus[playerid] = 0; SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's engine {E31919}off!"); return 1; } } } else { SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!"); return 1; } }
SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!"); |
//OnPlayerCommandText
if(!strcmp(cmdtext,"/engine",true))
{
if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,0xFF0000FF,"You are not in a vehicle!");
new engine, lights, alarm, doors, bonnet, boot, objective, vehid=GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehid,engine, lights, alarm, doors, bonnet, boot, objective);
if(!engine)
{
SetVehicleParamsEx(vehid,1,lights,alarm,doors,bonnet,boot,objective);
return SendClientMessage(playerid,0xAAAAAAFF,"Vehicle started!");
}else{
SetVehicleParamsEx(vehid,0,lights,alarm,doors,bonnet,boot,objective);
return SendClientMessage(playerid,0xAAAAAAFF,"Vehicle turned off!");
}
}