pawn Код:
#define Dialog_VehSystem 12
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/vehsys", true)
{
new State=GetPlayerState(playerid);
if (IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine && lights )
ShowPlayerDialog(playerid,Dialog_VehSystem,2,"{FFFFFF}Vehicle System:","Engine off \nLights off","Ok","Cancel");
else if(engine && !lights )
ShowPlayerDialog(playerid,Dialog_VehSystem,2,"{FFFFFF}Vehicle System:","Engine off \nLights on","Ok","Cancel");
else if(!engine && lights )
ShowPlayerDialog(playerid,Dialog_VehSystem,2,"{FFFFFF}Vehicle System:","Engine on \nLights off","Ok","Cancel");
else ShowPlayerDialog(playerid,Dialog_VehSystem,2,"{FFFFFF}Vehicle System:","Engine on \nLights on","Ok","Cancel");
}else SendClientMessage(playerid,0xFFFFFFAA, "Sorry, You must be in vehicle!");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==Dialog_VehSystem)
{
new carid = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
if(response)
{
if(listitem == 0)
{
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == 0)
SetVehicleParamsEx(carid,1,lights,alarm,doors,bonnet,boot,objective);
else SetVehicleParamsEx(carid,0,lights,alarm,doors,bonnet,boot,objective);
}
//Engine off
if(listitem == 1)
{
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
if(lights==0)
SetVehicleParamsEx(carid,engine,1,alarm,doors,bonnet,boot,objective);
else SetVehicleParamsEx(carid,engine,1,alarm,doors,bonnet,boot,objective);
}
}
return 1;
}