PDA

View Full Version : Teams


eеe
01/01/2012, 05:56 PM
Hello people,
First a very Happy New Year.

I am making a TDM and i have got a medic class.I don't want the medic class to be availible on spawn i want like on spawn player can select TEAM_RED or TEAM_BLUE.(I have that code).After that i view hem a menu what to become including many things like Sniper,Medic etc etc.
ow can i do it that if player selects medic then if he is in TEAM_BLUE his team gets changed to MEDIC_BLUE and if he is in TEAM_RED his team gets changed to MEDIC_RED.
Thank You!!

eеe
01/01/2012, 06:23 PM
Please i need urgent

Bogdan1992
01/01/2012, 07:14 PM
http://wiki.sa-mp.com/wiki/PAWN_tutorial

Face9000
01/01/2012, 07:15 PM
Ok then,you have already TEAM_RED and TEAM_BLUE?

We suppose that the player choose TEAM_BLUE,so medic is a RANK (that's how i call it to avoid confusion in the server),you can make an IF and set the MEDIC_RED or MEDIC_BLUE.Example:

if(gTeam[playerid] == TEAM_BLUE) {
SetPlayerColor(playerid,COLOR_BLUE);
SendClientMessage(playerid,COLOR_BLUE,"You are a medic of your blue team now!");
{
return 0;
}
}
else if(gTeam[playerid] == TEAM_GERMANY)
{
//Blabla


Something like this?

eеe
01/01/2012, 07:23 PM
Ok then,you have already TEAM_RED and TEAM_BLUE?

We suppose that the player choose TEAM_BLUE,so medic is a RANK (that's how i call it to avoid confusion in the server),you can make an IF and set the MEDIC_RED or MEDIC_BLUE.Example:

if(gTeam[playerid] == TEAM_BLUE) {
SetPlayerColor(playerid,COLOR_BLUE);
SendClientMessage(playerid,COLOR_BLUE,"You are a medic of your blue team now!");
{
return 0;
}
}
else if(gTeam[playerid] == TEAM_GERMANY)
{
//Blabla


Something like this?
can i do

if(gTeam[playerid] == TEAM_BLUE) {
SetPlayerColor(playerid,COLOR_BLUE);
SendClientMessage(playerid,COLOR_BLUE,"You are a medic of your blue team now!");
gTeam[playerid] = MEDIC_BLUE;
{
return 0;
}
}
else if(gTeam[playerid] == TEAM_RED) {
SetPlayerColor(playerid,COLOR_RED);
SendClientMessage(playerid,COLOR_RED,"You are a medic of your red team now!");
gTeam[playerid] = MEDIC_RED;
{
return 1;
}
}

Face9000
01/01/2012, 07:31 PM
gTeam[playerid] = MEDIC_RED;

MEDIC_RED is a class or a rank of the selected class?It's bit confusing...

eеe
01/01/2012, 07:33 PM
its a team.i wanna change the team from TEAM_RED to MEDIC_RED

Face9000
01/01/2012, 07:34 PM
its a team.i wanna change the team...

So,let's take few example:

You have TEAM_BLUE AND MEDIC_BLUE,both are teams?

You can select ONLY 1 team when spawn,i assume you intend a RANK.

Ex: TEAM_BLUE has medic,mechianic etc...right?

eеe
01/01/2012, 07:37 PM
listen.
a player spawns as TEAM_BLUE for ex. then he gets a menu with many options like soldier.medic etc.if he select medic his team changes from team_blue to medic_blue

eеe
01/01/2012, 07:39 PM
Cause I am on phone posted this mistake

Face9000
01/01/2012, 07:41 PM
listen.
a player spawns as TEAM_BLUE for ex. then he gets a menu with many options like soldier.medic etc.if he select medic his team changes from team_blue to medic_blue

LOL is what i said! I call it "ranks" so i can't do confusion.

Ok then..You have already MEDIC_BLUE/MEDIC_RED code?

You can use a dialog when you spawn for allow the selecting ranks.Ex:


if(dialogid == YOUR_DIALOG_ID)
{
if(response)
{
If(listitem == 0) // MEDIC_BLUE
{
//Your code for the MEDIC_BLUE rank,ex ability to heal players etc.
}


I suggest you to follow my example,make a dialog_list for every rank and use ShowPlayerDialog on OnPlayerSpawn.

eеe
01/01/2012, 07:47 PM
U r not understanding I have already done this.how do I switch the players team.its not a rank its a different team.
If u can't understand then answer this and i'll just modify the code.tel me how can I change players team from blue to red after spawn with if.
So if player is in red change to blue and if in blue change to red

Face9000
01/01/2012, 07:51 PM
U r not understanding I have already done this.how do I switch the players team.its not a rank its a different team.
If u can't understand then answer this and i'll just modify the code.tel me how can I change players team from blue to red after spawn with if.
So if player is in red change to blue and if in blue change to red

Than you can use

if(gTeam[playerid] == TEAM_BLUE)
{
gTeam[playerid] = MEDIC_BLUE;
SetPlayerColor(playerid, COLOR_BLUE);
GameTextForPlayer(playerid, "~w~You have been switched to team~n~~b~Blue",2500,6);
}


This?

eеe
01/01/2012, 07:52 PM
Yes..thanks +rep will be done as soon I come on computer

Face9000
01/01/2012, 07:59 PM
No problem.