Teams
#10

Quote:
Originally Posted by SapMan
View Post
Does it mean that I should not use 'SetPlayerTeam' for each team?

This is what I have in my script, is it wrong?:
It is not wrong if you only have teams but in your case we need teams and factions (several teams grouped together)

Just put these 5 lines in an include files and include it or put them before the first SetPlayerTeam / GetPlayerTeam in your code
This code simply defines SetPlayerFaction and GetPlayerFaction, nothing more nothing less
PHP Code:
native SetPlayerFaction(playeridFactionfactionid) = SetPlayerTeam;
native FactionGetPlayerFaction(playerid) = GetPlayerTeam;
new 
gTeam[MAX_PLAYERS];
#define SetPlayerTeam(%0,%1) (gTeam[%0] = %1)
#define GetPlayerTeam(%0) gTeam[%0] 
In your code you just need to use them
PHP Code:
// somewhere before your first usage
enum Faction {
    
Faction_Defend// President, Police
    
Faction_Attack // Terrorist
};
//OnDialogResponse
case Dialog_PTP:
{
    if(
response)
    {
        switch(
listitem)
        {
            case 
0:
            {
                
SetPlayerFaction(playeridFaction_Defend);
                
SetPlayerTeam(playeridTeam_President);
                
                
//other codes
            
}
            case 
1:
            {
                
SetPlayerFaction(playeridFaction_Defend);
                
SetPlayerTeam(playeridTeam_Police);
                
                
//other codes
            
}
            case 
2:
            {
                
SetPlayerFaction(playeridFaction_Attack);
                
SetPlayerTeam(playeridTeam_Terrorist);
                
//other codes
            
}
        }
    }
    return 
1;

Maybe you will notice the similarity to the code from before
Reply


Messages In This Thread
Teams - by SapMan - 18.12.2018, 20:49
Re: Teams - by SapMan - 18.12.2018, 23:00
Re: Teams - by Threshold - 19.12.2018, 03:10
Re: Teams - by SapMan - 19.12.2018, 14:55
Re: Teams - by Osamakurdi - 19.12.2018, 15:24
Re: Teams - by Nero_3D - 19.12.2018, 17:49
Re: Teams - by SapMan - 19.12.2018, 22:18
Re: Teams - by Threshold - 20.12.2018, 02:16
Re: Teams - by SapMan - 20.12.2018, 17:43
Re: Teams - by Nero_3D - 20.12.2018, 18:03
Re: Teams - by SapMan - 20.12.2018, 20:16
Re: Teams - by Nero_3D - 20.12.2018, 23:05

Forum Jump:


Users browsing this thread: 4 Guest(s)