SA-MP Forums Archive
How to Make Text for Team Selection? - 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: How to Make Text for Team Selection? (/showthread.php?tid=279905)



How to Make Text for Team Selection? - ServerScripter - 29.08.2011

Hi , i want whene a player is in Team Selection Creat a Text like : HUMANS for Skin ID 290

How to do it?


Re: How to Make Text for Team Selection? - BlackWolf120 - 29.08.2011

hi,
id try smth. like:

pawn Code:
if (classid == 0)//ur first skin added with AddPlayerClass
    {
    GameTextForPlayer(playerid, "~r~Zombie", 500, 5);
    gTeam[playerid] = TEAM1;
    SetPlayerTeam(playerid,TEAM1);
    }
    else if (classid == 1)//second skin
    {
    GameTextForPlayer(playerid, "~b~Human", 500, 5);
    gTeam[playerid] = TEAM2;
    SetPlayerTeam(playerid,TEAM2);
    }
    }
    else if (classid == 2)//and so on...
    {
    //...
    }
Use this code in the callback OnPlayerRequestClass.

Do u use gTeam?
If so, just adjust the gTeam variable to ur needs: gTeam[playerid] = ChangeThisToYourDefinedTeams;

Was this helpfull?


Re: How to Make Text for Team Selection? - ServerScripter - 29.08.2011

Thank you a lot !


Re: How to Make Text for Team Selection? - BlackWolf120 - 29.08.2011

np mate
just ask if u have further questions.


Re: How to Make Text for Team Selection? - ServerScripter - 29.08.2011

i have a question ;
what Does if (classid == 0) Mean?

for Example i have the 4 First Skins for Zombie Team
what i have to do?


Re: How to Make Text for Team Selection? - Wesley221 - 29.08.2011

You can also do it by using the "switch" statement. This is easier for larger amounts.

pawn Code:
switch(classid)
{
    case 0 .. 3: { // This is for skin 0 untill 3 (0, 1, 2, 3)
        // allt he stuff you want for the first 4 skins
    }
    case 4, 5, 6, 7: {
        // all the stuff you want for the classes 4, 5, 6, 7
    }
}



Re: How to Make Text for Team Selection? - BlackWolf120 - 29.08.2011

k, ill explain more:

U add ur skins like this:

pawn Code:
AddPlayerClass(/*blablabla*/);//skin or class 1
AddPlayerClass(/*blablabla*/);//skin or class 2
AddPlayerClass(/*blablabla*/);//skin or class 3
Now in the callback OnPlayerRequestClass u tell the script what text u wanna have shown for what skin.
Like:

pawn Code:
if (classid == 0)//this means: when the player looks at the skin 1 it shows
    {
    GameTextForPlayer(playerid, "Human", 500, 5);//the text humans
    gTeam[playerid] = TEAM1;//sets this skin to team1
    SetPlayerTeam(playerid,TEAM1);
    }
    else if (classid == 1)//and then if the skin is the 2nd skin we have set up with AddPlayerClass
    {
   //...do stuff...
    }
//and so on
Also u should use AddPlayerClassEx for setting up teams.


Re: How to Make Text for Team Selection? - ServerScripter - 29.08.2011

Thank you ! i uderstand now


Re: How to Make Text for Team Selection? - ServerScripter - 29.08.2011

But an other Problem... whene i'm in Spawn Selection i can't See The Characters... i see only "Next"+"back"+"Spawn" Buttons.


Re: How to Make Text for Team Selection? - Jack_Wilson - 29.08.2011

Quote:
Originally Posted by BlackWolf120
View Post
hi,
id try smth. like:

pawn Code:
if (classid == 0)//ur first skin added with AddPlayerClass
    {
    GameTextForPlayer(playerid, "~r~Zombie", 500, 5);
    gTeam[playerid] = TEAM1;
    SetPlayerTeam(playerid,TEAM1);
    }
    else if (classid == 1)//second skin
    {
    GameTextForPlayer(playerid, "~b~Human", 500, 5);
    gTeam[playerid] = TEAM2;
    SetPlayerTeam(playerid,TEAM2);
    }
    }
    else if (classid == 2)//and so on...
    {
    //...
    }
Use this code in the callback OnPlayerRequestClass.

Do u use gTeam?
If so, just adjust the gTeam variable to ur needs: gTeam[playerid] = ChangeThisToYourDefinedTeams;

Was this helpfull?
pawn Code:
switch(classid)
{
    case 0: GameTextForPlayer(playerid, "~r~CJ", 500, 5);
    case 1: GameTextForPlayer(playerid, "~b~Weed Smoker", 500, 5);
    case 2: GameTextForPlayer(playerid, "~b~Gangster", 500, 5);
}
They will work both the same ways but this way is more efficient.