Dialog shows every time on death
#1

This dialog:
Код:
public OnPlayerSpawn(playerid) {
    ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose your Class", "Class 1\nClass 2\nClass 3", "Choose", "");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    if(dialogid == DIALOG_CLASS) {
        if(!response) // if player presses ESC re-show the dialog
            return ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose your class", "Class 1\nClass 2\nClass 3", "Choose", "");
        switch(listitem) {
            case 0: if(gTeam[playerid] == TEAM_USA)
			 	{
					SendClientMessage(playerid, COLOR_BLUE, "*You chose the Soldier Class!");
                	GivePlayerWeapon(playerid, 4, 0);
  	 				GivePlayerWeapon(playerid, 22, 25);
  	 				GivePlayerWeapon(playerid, 16, 2);
  	 				GivePlayerWeapon(playerid, 31, 100);
            	}
           			else if(gTeam[playerid] == TEAM_USA)
			 	{
					SendClientMessage(playerid, COLOR_BLUE, "*You chose the Soldier Class!");
                	GivePlayerWeapon(playerid, 4, 0);
  	 				GivePlayerWeapon(playerid, 22, 25);
  	 				GivePlayerWeapon(playerid, 16, 2);
  	 				GivePlayerWeapon(playerid, 31, 100);
            	}
           			else if(gTeam[playerid] == TEAM_USA)
			 	{
					SendClientMessage(playerid, COLOR_BLUE, "*You chose the Soldier Class!");
                	GivePlayerWeapon(playerid, 4, 0);
  	 				GivePlayerWeapon(playerid, 22, 25);
  	 				GivePlayerWeapon(playerid, 16, 2);
  	 				GivePlayerWeapon(playerid, 31, 100);
            	}
            case 1: {

					SendClientMessage(playerid, COLOR_BLUE, "*you choose the soldier class..");
                	GivePlayerWeapon(playerid, 34, 12);
  	 				GivePlayerWeapon(playerid, 23, 25);
  	 				GivePlayerWeapon(playerid, 25, 15);
            }
            case 2: { // CLASS 3
                // stuff for class 3
            }
            // etc
        }
    }
    return 0;
}
Shows every time when a player is death. How can I fix that?
Reply
#2

use the code in the OnPlayerSpawn in the OnPlayerRequestClass callback
I mean remove this:
pawn Код:
ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose your Class", "Class 1\nClass 2\nClass 3", "Choose", "");
and put it in this callback:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
//your stuff here
}
Reply
#3

Quote:
Originally Posted by Chris White
Посмотреть сообщение
use the code in the OnPlayerSpawn in the OnPlayerRequestClass callback
I mean remove this:
pawn Код:
ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose your Class", "Class 1\nClass 2\nClass 3", "Choose", "");
and put it in this callback:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
//your stuff here
}
That will show the dialog when the player selects a class wouldn't it?

Put it here:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    return 1;
}
Reply
#4

OnPlayerSpawn
This callback is called when a player spawns. Also, after player's death player has to spawn again so it's show the dialog.
You have to use it in the callback users above me mention.
Reply
#5

Okay, thnx for the information. It's solved
Reply
#6

And ehh how to show a second dialog when a player chooses class 1 or 2? (With some information such as, weapons etc)
Reply
#7

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CLASS) {
        if(!response) // if player presses ESC re-show the dialog
            return ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose your class", "Class 1\nClass 2\nClass 3", "Choose", "");
        switch(listitem) {
            case 0:
            {
                if(gTeam[playerid] == TEAM_USA) {
                    SendClientMessage(playerid, COLOR_BLUE, "*You chose the Soldier Class!");
                    GivePlayerWeapon(playerid, 4, 0);
                    GivePlayerWeapon(playerid, 22, 25);
                    GivePlayerWeapon(playerid, 16, 2);
                    GivePlayerWeapon(playerid, 31, 100);
                    ShowPlayerDialog(...) // USA's Info
                }
                else if(gTeam[playerid] == TEAM_USA) {
                    SendClientMessage(playerid, COLOR_BLUE, "*You chose the Soldier Class!");
                    GivePlayerWeapon(playerid, 4, 0);
                    GivePlayerWeapon(playerid, 22, 25);
                    GivePlayerWeapon(playerid, 16, 2);
                    GivePlayerWeapon(playerid, 31, 100);
                    ShowPlayerDialog(...) // USA's Info
                }
                else if(gTeam[playerid] == TEAM_USA) {
                    SendClientMessage(playerid, COLOR_BLUE, "*You chose the Soldier Class!");
                    GivePlayerWeapon(playerid, 4, 0);
                    GivePlayerWeapon(playerid, 22, 25);
                    GivePlayerWeapon(playerid, 16, 2);
                    GivePlayerWeapon(playerid, 31, 100);
                }
            }
            case 1:
            {
                // if(gTeam[playerid] == x) {
                    SendClientMessage(playerid, COLOR_BLUE, "*you choose the soldier class..");
                    GivePlayerWeapon(playerid, 34, 12);
                    GivePlayerWeapon(playerid, 23, 25);
                    GivePlayerWeapon(playerid, 25, 15);
                    ShowPlayerDialog(...) // x's Info
                }
            }
            case 2: // CLASS 3
            {
                // if(gTeam[playerid] == y) {
                    ShowPlayerDialog(...) //  y's Info
                }
            }// stuff for class 3
        }// etc
    }
    return 0;
}
Reply
#8

MM thanks I go try this out!
Reply
#9

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    if(dialogid == DIALOG_CLASS) {
        if(!response) // if player presses ESC re-show the dialog
            return ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose your class", "Assault 1\nSniper 2\nMedic 3", "Next", "");
        switch(listitem) {
            case 0:{
				ShowPlayerDialog(playerid, DIALOG_ASSAULT, DIALOG_STYLE_MSGBOX, "Assault Class Info", "Information about the assault class such as waepons enz", "Choose", "Back");
}
           			
            case 1: {
                        ShowPlayerDialog(playerid, DIALOG_SNIPER, DIALOG_STYLE_MSGBOX, "Sniper Class Info", "class info", "Choose", "Back");
            		}
            case 2: { 
                        ShowPlayerDialog(playerid, DIALOG_SNIPER, DIALOG_STYLE_MSGBOX, "Medic Class Info", "class info..", "Choose", "Back");
            }

            // etc
        }
    }
    return 0;
}
When a player choose the Assault class or Sniper class, I want to show a dialog with the class info such as,

Weapons: M4
Knife
MP5
Abilities: Can drive Tanks

When a player choose this class, I want
Код:
GivePlayerWeapon(id,ammo)
into the Dialog_Assault
Reply
#10

It doesn't need to double post. Use the Edit Button
Can you explain it more because I didn't understand what exactly you want to do.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)