SA-MP Forums Archive
Class ID's - 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 ID's (/showthread.php?tid=336713)



closed. :) - WarriorEd22 - 23.04.2012

closed.


Re: Class ID's - BleverCastard - 23.04.2012

Quote:
Originally Posted by WarriorEd22
Посмотреть сообщение
I have this in my script. What does this exactly mean?:

pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0 || classid == 1 || classid == 2 || classid == 3 || classid == 4 || classid == 5)
    {
        gTeam[playerid] = Team_Cop;
    }
    else if(classid == 6)
    {
        gTeam[playerid] = Team_Army;
    }
    else if(classid == 7)
    {
        gTeam[playerid] = Team_FBI;
    }
    else if(classid >= 8)
    {
        gTeam[playerid] = Team_Civi;
    }
}
This is saying that when you register it shows you skins? if you choose 0 to 5 for example, it will put you in Team_Cop.


Re: Class ID's - Twisted_Insane - 23.04.2012

Better do it like this;

pawn Код:
switch(classid)
    {
        case 0 .. 2:
        {
            gTeam[playerid] = BALLA;
        }
        case 3 .. 7:
        {
            gTeam[playerid] = GROVE;
        }
        case 8 .. 10:
        {
            gTeam[playerid] = VAGOS;
        }
The cases are directed to the Playerclasses you've created under "OnGameModeInit"...Then you'll set the gTeam for the player to a special team. Change your code to the one I've posted, it's way more effecient and easier!


Re: Class ID's - WarriorEd22 - 23.04.2012

Okay thanks guys. So does it mean it starts with the first skin? For example, the first 5 classes will be the first 5 AddPlayerClass?


Re: Class ID's - Twisted_Insane - 23.04.2012

Yep, you got it homie! Let's take this as an example;

pawn Код:
AddPlayerClass //first one
AddPlayerClass //second one
AddPlayerClass //third one
AddPlayerClass //fourth one
AddPlayerClass //fifth one
AddPlayerClass //sixth one
Let's say you've got 2 different teams as example:

pawn Код:
switch(classid)    {
    case 0 .. 2: //the first three playerclasses
    {
            gTeam[playerid] = TEAM1; //set their gTeam to YOUR teams
    }
    case 3 .. 5: //the other three playerclasses
    {
            gTeam[playerid] = TEAM2; //set their gTeam to YOUR teams
    }
Sorry for the format, typed in a browser! Hope you understood it now good and I could help!


Re: Class ID's - WarriorEd22 - 23.04.2012

+rep! Thanks so much! God bless!


Re: Class ID's - AlonGlenn - 03.12.2016

Thanks Very Useful