SA-MP Forums Archive
Help? "back"button - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help? "back"button (/showthread.php?tid=471249)



Help? "back"button - eblood1 - 22.10.2013

How i can make the "back" button work?

Код:
	if(d == Fun_Dialog) {
	    if(response) {
	        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && IsPlayerInVehicle(playerid, Veh_Carchase))
         		return 1;
           	switch(GetVehicleModel(GetPlayerVehicleID(playerid))) {
				case 425, 432, 447, 520: return SendClientMessage(playerid, red, "[ERROR] You cant't teleport with this vehicle!");
			}
	        switch(listitem) {
				case 0: return TeleportClub1(playerid);
				case 1: return TeleportClub2(playerid);
				case 2: return dcmd_derby(playerid, "");
				case 3: return TeleportCannon(playerid);
			    case 4: return TeleportBhole(playerid);
				case 5: return TeleportBhole1(playerid);
				case 6: return TeleportUFO(playerid);
			}
	    }
	}



Re: Help? "back"button - iJumbo - 22.10.2013

pawn Код:
if(d == Fun_Dialog) {
    if(response) {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && IsPlayerInVehicle(playerid, Veh_Carchase)) return 1;
        switch(GetVehicleModel(GetPlayerVehicleID(playerid))) {
            case 425, 432, 447, 520: return SendClientMessage(playerid, red, "[ERROR] You cant't teleport with this vehicle!");
        }
        switch(listitem) {
            case 0: return TeleportClub1(playerid);
            case 1: return TeleportClub2(playerid);
            case 2: return dcmd_derby(playerid, "");
            case 3: return TeleportCannon(playerid);
            case 4: return TeleportBhole(playerid);
            case 5: return TeleportBhole1(playerid);
            case 6: return TeleportUFO(playerid);
        }
    } else if(!response) {
        //button 2 code
    }
}



Re: Help? "back"button - ]Rafaellos[ - 22.10.2013

pawn Код:
if(!response)
{
    //...
}



Re: Help? "back"button - IceBilizard - 22.10.2013

pawn Код:
if(d == Fun_Dialog)
{
        if(response)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && IsPlayerInVehicle(playerid, Veh_Carchase)) return 1;
            switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
            {
              case 425, 432, 447, 520: return SendClientMessage(playerid, red, "[ERROR] You cant't teleport with this vehicle!");
            }
            switch(listitem)
            {
                case 0: return TeleportClub1(playerid);
                case 1: return TeleportClub2(playerid);
                case 2: return dcmd_derby(playerid, "");
                case 3: return TeleportCannon(playerid);
                case 4: return TeleportBhole(playerid);
                case 5: return TeleportBhole1(playerid);
                case 6: return TeleportUFO(playerid);
            }
        }
        else //Here you can make back works like show player dialog or anything
        {
            //stuff
        }
}



Re: Help? "back"button - eblood1 - 22.10.2013

nun work, when i hit Back button the dialog close


Re: Help? "back"button - iJumbo - 22.10.2013

If you didn't write any code in button 2 space code of course that not work.. you can re-open the main dialog


pawn Код:
if(d == Fun_Dialog) {
    if(response) {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && IsPlayerInVehicle(playerid, Veh_Carchase)) return 1;
        switch(GetVehicleModel(GetPlayerVehicleID(playerid))) {
            case 425, 432, 447, 520: return SendClientMessage(playerid, red, "[ERROR] You cant't teleport with this vehicle!");
        }
        switch(listitem) {
            case 0: return TeleportClub1(playerid);
            case 1: return TeleportClub2(playerid);
            case 2: return dcmd_derby(playerid, "");
            case 3: return TeleportCannon(playerid);
            case 4: return TeleportBhole(playerid);
            case 5: return TeleportBhole1(playerid);
            case 6: return TeleportUFO(playerid);
        }
    } else if(!response) {
        //MainDialogHere..
    }
}



Re: Help? "back"button - BittleRyan - 22.10.2013

Quote:
Originally Posted by eblood1
Посмотреть сообщение
nun work, when i hit Back button the dialog close
I assume you added code in between:

pawn Код:
if(!response)
{
}
If it is left blank it will exit like it was not there.


Re: Help? "back"button - eblood1 - 22.10.2013

Quote:
Originally Posted by iJumbo
Посмотреть сообщение
If you didn't write any code in button 2 space code of course that not work.. you can re-open the main dialog

pawn Код:
if(d == Fun_Dialog) {
    if(response) {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && IsPlayerInVehicle(playerid, Veh_Carchase)) return 1;
        switch(GetVehicleModel(GetPlayerVehicleID(playerid))) {
            case 425, 432, 447, 520: return SendClientMessage(playerid, red, "[ERROR] You cant't teleport with this vehicle!");
        }
        switch(listitem) {
            case 0: return TeleportClub1(playerid);
            case 1: return TeleportClub2(playerid);
            case 2: return dcmd_derby(playerid, "");
            case 3: return TeleportCannon(playerid);
            case 4: return TeleportBhole(playerid);
            case 5: return TeleportBhole1(playerid);
            case 6: return TeleportUFO(playerid);
        }
    } else if(!response) {
        //MainDialogHere..
    }
}
i dont think it would work there.
this is how the main dialog.
Код:
FunDialog(playerid, title[])	// ----- TELES DIALOG -----
{
	new string[1024];
	strcat(string, "\
	//club1\t\t\t- Club 1\n\
	//club2\t\t\t- Club 2\n\
	//derby\t\t\t- Demolition Derby\n\
    //cannon\t\t- Cannon launcher\n\
	");
	strcat(string,"\
	//bhole\t\t\t- Blackhole\n\
	//bhole1\t\t\t- Blackhole1\n\
	//UFO\t\t\t- Other\n\
	");
    ShowPlayerDialog(playerid, Fun_Dialog, LIST, title, string, "Select", "Back");
    return 1;
}



Re: Help? "back"button - iJumbo - 22.10.2013

So use FunDialog(playerid,title[]) no?