Requesting help with OnPlayerRequestClass
#1

Hi,
My problem is when I choose a team, It just set me to the Team number 1= TEAM_COPS1.
PHP код:
#define TEAM_COPS1 0
#define TEAM_COPS2 1
#define TEAM_CIVILIAN 2
#define TEAM_ROBBERS 3
#define DIALOG_CLASS 3
static Team[MAX_PLAYERS];
public 
OnGameModeInit()
{
    
SetGameModeText("TR-CR v1.0");
    
AddPlayerClass(2801525.697265, -1677.9237065.890625265.2472835,1,22,1000,30,1000);
    
AddPlayerClass(287,1568.449707, -1690.9958495.890625180.959609,5,1,22,1000,30,1000);
     
AddPlayerClass(217,1642.000122, -2334.76147413.546875354.693267,29,500,33,500,24,320);
     
AddPlayerClass(115,2520.769775, -1678.81701615.17657088.838874,29,500,34,280,23,450);
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
ShowPlayerDialog(playeridDIALOG_CLASSDIALOG_STYLE_LIST"{555555}Teams""{0909F7}LSPD Officer\n{AEA551}Army Soldier\n{CCCCCC}Civilian\n{F72009}Robbers""Choose""Kick");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
//
//
    
if(dialogid == DIALOG_CLASS)
    {
    if(!
response) return Kick(playerid);
    if(
response)
    {
        if(
listitem == 0// They selected the first item - Police Officer
        
{
        
Team[playerid] = TEAM_COPS1;
        
SetPlayerPos(playerid1525.697265, -1677.9237065.890625);
        
SetPlayerSkin(playerid280);
        
SpawnPlayer(playerid);
        }
        if(
listitem == 1)
        {
        
Team[playerid] = TEAM_COPS2;
        
SetPlayerPos(playerid1568.449707, -1690.9958495.890625);
        
SetPlayerSkin(playerid287);
        
SpawnPlayer(playerid);
        }
        if(
listitem == 2)
        {
        
Team[playerid] = TEAM_CIVILIAN;
        
SetPlayerPos(playerid1642.000122, -2334.76147413.546875);
        
SetPlayerSkin(playerid217);
        
SpawnPlayer(playerid);
        }
        if(
listitem == 3)
        {
        
Team[playerid] = TEAM_ROBBERS;
        
SetPlayerPos(playerid2520.769775, -1678.81701615.176570);
        
SetPlayerSkin(playerid115);
        
SpawnPlayer(playerid);
          }
    }
}
  return 
1;

Reply
#2

Delete this:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "{555555}Teams", "{0909F7}LSPD Officer\n{AEA551}Army Soldier\n{CCCCCC}Civilian\n{F72009}Robbers", "Choose", "Kick");
    return 1;
}
And add this:
pawn Код:
public OnPlayerConnect(playerid)
{
    ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "{555555}Teams", "{0909F7}LSPD Officer\n{AEA551}Army Soldier\n{CCCCCC}Civilian\n{F72009}Robbers", "Choose", "Kick");
    return 1;
}
Reply
#3

I have a dialog to register and login under OnPlayerConnect.
It doesn't worj anyways.
Reply
#4

Then try this:
pawn Код:
#define TEAM_COPS1 0
#define TEAM_COPS2 1
#define TEAM_CIVILIAN 2
#define TEAM_ROBBERS 3

#define DIALOG_CLASS 3

static Team[MAX_PLAYERS];
public OnGameModeInit()
{
    SetGameModeText("TR-CR v1.0");
    AddPlayerClass(280, 1525.697265, -1677.923706, 5.890625, 265.247283, 5,1,22,1000,30,1000);
    AddPlayerClass(287,1568.449707, -1690.995849, 5.890625, 180.959609,5,1,22,1000,30,1000);
    AddPlayerClass(217,1642.000122, -2334.761474, 13.546875, 354.693267,29,500,33,500,24,320);
    AddPlayerClass(115,2520.769775, -1678.817016, 15.176570, 88.838874,29,500,34,280,23,450);
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "{555555}Teams", "{0909F7}LSPD Officer\n{AEA551}Army Soldier\n{CCCCCC}Civilian\n{F72009}Robbers", "Choose", "Kick");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CLASS)
    {
        if(!response) return Kick(playerid);
        switch(listitem)
        {
            case: 0
            {
                SpawnPlayer(playerid);
                Team[playerid] = TEAM_COPS1;
                SetPlayerPos(playerid, 1525.697265, -1677.923706, 5.890625);
                SetPlayerSkin(playerid, 280);
            }
            case: 1
            {
                SpawnPlayer(playerid);
                Team[playerid] = TEAM_COPS2;
                SetPlayerPos(playerid, 1568.449707, -1690.995849, 5.890625);
                SetPlayerSkin(playerid, 287);
            }
            case: 2
            {
                SpawnPlayer(playerid);
                Team[playerid] = TEAM_CIVILIAN;
                SetPlayerPos(playerid, 1642.000122, -2334.761474, 13.546875);
                SetPlayerSkin(playerid, 217);
            }
            case: 3
            {
                SpawnPlayer(playerid);
                Team[playerid] = TEAM_ROBBERS;
                SetPlayerPos(playerid, 2520.769775, -1678.817016, 15.176570);
                SetPlayerSkin(playerid, 115);
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)