SetPlayerTeamFromClass & SetPlayerToTeamColor - What Have I Done Wrong ?
#3

@Neo

Lol, you forgot again an "else if" statement, at "Mafia"!

@MrFames

I recommend you to use cases, which are better instead of the "else if" statement! The "cases" are here the skin-numbers, starting from 0! This, for example, is mine:

PHP код:
SetPlayerTeamFromClass(playeridclassid)
{
    switch(
classid)
    {
        case 
.. 2:
        {
            
gTeam[playerid] = BALLA;
        }
        case 
.. 7:
        {
            
gTeam[playerid] = GROVE;
        }
        case 
.. 10:
        {
            
gTeam[playerid] = VAGOS;
        }
        case 
11 .. 14:
        {
            
gTeam[playerid] = AZTECAS;
        }
        case 
15 .. 23:
        {
            
gTeam[playerid] = POLICE;
        }
        case 
24 .. 26:
        {
            
gTeam[playerid] = RIFAS;
        }
        case 
27 .. 31:
        {
            
gTeam[playerid] = LOCO;
        }
    }

Also, at the color-callback:

PHP код:
SetPlayerToTeamColor(playerid)
{
    switch(
gTeam[playerid])
    {
        case 
GROVE:
        {
            
SetPlayerColor(playeridTEAM_GROVE_COLOR);
        }
        case 
BALLA:
        {
            
SetPlayerColor(playeridTEAM_BALLA_COLOR);
        }
        case 
VAGOS:
        {
            
SetPlayerColor(playeridTEAM_VAGOS_COLOR);
        }
        case 
AZTECAS:
        {
            
SetPlayerColor(playeridTEAM_AZTECAS_COLOR);
        }
        case 
POLICE:
        {
            
SetPlayerColor(playeridTEAM_POLICE_COLOR);
        }
        case 
RIFAS:
        {
            
SetPlayerColor(playeridTEAM_RIFAS_COLOR);
        }
        case 
LOCO:
        {
            
SetPlayerColor(playeridTEAM_LOCO_COLOR);
        }
    }

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)