pawn Код:
CMD:v(playerid, params[])
{
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
new choice[32];
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF2C30FF, "You are not inside any vehicle!");
if(sscanf(params, "s[32]", choice))
{
SendClientMessage(playerid, 0x2BA2FFFF , "USAGE: /v [Name]");
SendClientMessage(playerid, 0x2BA2FFFF , "Available names: Engine | Lights | Hood | Trunk ");
return 1;
}
if (strcmp(choice, "Engine", true) == 0)
{
if(GetPVarInt(playerid, "Engine") == 0)
{
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "Engine", 1);
SendClientMessage(playerid, 0xF1FF00FF, "Engine started!");
}
else if(GetPVarInt(playerid, "Engine") == 1)
{
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "Engine", 0);
SendClientMessage(playerid, 0xF1FF00FF, "Engine stopped!");
}
}
if (strcmp(choice, "Lights", true) == 0)
{
if(GetPVarInt(playerid, "Lights") == 0)
{
if(GetPVarInt(playerid, "Engine") == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "You must turn on the engine first!");
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "Lights", 1);
SendClientMessage(playerid, 0xF1FF00FF, "Lights have been turned on!");
}
else if(GetPVarInt(playerid, "Lights") == 1)
{
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "Lights", 0);
SendClientMessage(playerid, 0xF1FF00FF, "Lights have been turned off!");
}
}
if (strcmp(choice, "Hood", true) == 0)
{
if(GetPVarInt(playerid, "Bonnet") == 0)
{
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
SetPVarInt(playerid, "Bonnet", 1);
SendClientMessage(playerid, 0xF1FF00FF, "Your car hood has been opened!");
}
else if(GetPVarInt(playerid, "Bonnet") == 1)
{
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
SetPVarInt(playerid, "Bonnet", 0);
SendClientMessage(playerid, 0xF1FF00FF, "Your car hood has been closed!");
}
}
if (strcmp(choice, "Trunk", true) == 0)
{
if(GetPVarInt(playerid, "Boot") == 0)
{
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
SetPVarInt(playerid, "Boot", 1);
SendClientMessage(playerid, 0xF1FF00FF, "Your car trunk has been opened!");
}
else if(GetPVarInt(playerid, "Boot") == 1)
{
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
SetPVarInt(playerid, "Boot", 0);
SendClientMessage(playerid, 0xF1FF00FF, "Your car trunk has been closed!");
}
}
return 1;
}