Dialog enable/disable function
#5

Quote:
Originally Posted by Roko_foko
Посмотреть сообщение
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;
    }
here you go
Hmm, I tried it but when the engine is turned on it shows that it's off ?!
Reply


Messages In This Thread
Dialog enable/disable function - by x96664 - 09.07.2012, 10:12
Re: Dialog enable/disable function - by Roko_foko - 09.07.2012, 10:22
Re: Dialog enable/disable function - by zT KiNgKoNg - 09.07.2012, 10:24
Re: Dialog enable/disable function - by x96664 - 09.07.2012, 14:26
Re: Dialog enable/disable function - by x96664 - 12.07.2012, 09:53

Forum Jump:


Users browsing this thread: 1 Guest(s)