09.07.2012, 10:12
Hi, I'm making a new filterscript for my server (vehicle system for the engine,lights and etc.) and I want to control the vehicle engine and other vehicle features from menu dialog.Now it's :
But I want enabling and disabling to be on the same "listitem" for example when I open the dialog and click on engine to see on the button "Engine Enabled" and it really to be enabled and when I click again to disable it to see "Engine Disabled". Can somebody help me ?
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)
{
ShowPlayerDialog(playerid,Dialog_VehSystem,2,"{FFFFFF}Vehicle System:","Engine \nEngine off \nLights \nLights off ","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)
{
//Engine on
if(listitem == 0)
{
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(carid,1,lights,alarm,doors,bonnet,boot,objective);
}
//Engine off
if(listitem == 1)
{
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(carid,0,lights,alarm,doors,bonnet,boot,objective);
}
//Lights on
if(listitem == 2)
{
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(carid,engine,1,alarm,doors,bonnet,boot,objective);
}
//Lights off
if(listitem == 3)
{
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(carid,engine,0,alarm,doors,bonnet,boot,objective);
}
}
return 1;
}
return 0;
}