SA-MP Forums Archive
Class selection bug help +rep - 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: Class selection bug help +rep (/showthread.php?tid=546244)



Class selection bug help +rep - Ryz - 14.11.2014

I have problem with class selection,
pawn Код:
#define TEAM_NONE         0
#define TEAM_EU     1
#define TEAM_RU       2
#define TEAM_US          3
#define TEAM_AU          4
#define TEAM_AS         5
#define TEAM_LA       6
#define TEAM_AR      7
#define TEAM_ME    8
#define TEAM_TA      9
#define MAX_TEAMS        10
class selection bugs after team_ta.

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,222.472366,1822.878784,6.414062);
    SetPlayerFacingAngle(playerid, 270.0);
    SetPlayerCameraPos(playerid,224.472366,1822.878784,7.414062);
    SetPlayerCameraLookAt(playerid,222.472366,1822.878784,6.414062);
    gTeam[playerid]=classid+1;
    SetPlayerTeam(playerid,gTeam[playerid]);
    setskin(playerid);
    return 1;
}



Re: Class selection bug help +rep - Sparke - 14.11.2014

What exactly is bugged? Show us your errors, I need more info


Re: Class selection bug help +rep - Ryz - 14.11.2014

when i press next at class selection, after team_ta team selection freeze at team_ta . idk why he not show me again from team_eu.


Re: Class selection bug help +rep - Sawalha - 14.11.2014

You are doing it incorrectly.

For classes , You should use
Код:
 AddPlayerClass
, not defining it , Let's take an example:
pawn Код:
public OnGameModeInit()
{

        AddPlayerClass(1, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); // this is the classid 0, be cause it's the first class added in the script.
        return 1;
}
The class is set, Now let's check WHEN player chose the class:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
      switch(classid) // better way for checking player's classid
      {
            case 0: // if he choose classid 0 (as above in ongamemodeinit function)
            {
                    /*Here, you will set player's pos, skin, team, etc.. , and he'll spawn ofc. */
            }
       }
       return 1;
}
P.S,
use gTeam only, SetPlayerTeam not needed,
like :
pawn Код:
gTeam[playerid] = TEAM_TA;



Re: Class selection bug help +rep - Ryz - 14.11.2014

Quote:
Originally Posted by Sawalha
Посмотреть сообщение
You are doing it incorrectly.

For classes , You should use
Код:
 AddPlayerClass
, not defining it , Let's take an example:
pawn Код:
public OnGameModeInit()
{

        AddPlayerClass(1, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); // this is the classid 0, be cause it's the first class added in the script.
        return 1;
}
The class is set, Now let's check WHEN player chose the class:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
      switch(classid) // better way for checking player's classid
      {
            case 0: // if he choose classid 0 (as above in ongamemodeinit function)
            {
                    /*Here, you will set player's pos, skin, team, etc.. , and he'll spawn ofc. */
            }
       }
       return 1;
}
P.S,
use gTeam only, SetPlayerTeam not needed,
like :
pawn Код:
gTeam[playerid] = TEAM_TA;
worked! thank you very much +rep