What's worng?
#1

Ok,so I amde this but I don't know what's worng:

public OnPlayerRequestClass(playerid,classid)
pawn Код:
{
        new gTeam[MAX_PLAYERS];
    if(classid == 98)
    {
       gTeam[playerid] = TEAM_ROBBERS;
    }
    if(classid == 100)
    {
       gTeam[playerid] = TEAM_ROBBERS;
    }
    if(classid == 101)
    {
       gTeam[playerid] = TEAM_ROBBERS;
    }
    if(classid == 284)
    {
       gTeam[playerid] = TEAM_COPS;
    }
    if(classid == 285)
    {
       gTeam[playerid] = TEAM_COPS;
    }
    if(classid == 286)
    {
       gTeam[playerid] = TEAM_COPS;
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
        new gTeam[MAX_PLAYERS];
    if(gTeam[playerid] == TEAM_ROBBERS)
    {
       SetPlayerColor(playerid,WHITE);
    }
    else if(gTeam[playerid] == TEAM_COPS)
    {
       SetPlayerColor(playerid,BLUE);
    }

     return 1;
}
Reply
#2

Do you get any errors on compile or does it not work in-game?
Reply
#3

pawn Код:
new gTeam[MAX_PLAYERS];//Put this var As GLOBAL VAR

#define TEAM_ROBBERS 1
#define TEAM_COPS 2









public OnPlayerRequestClass(playerid,classid)
{
    switch(classid)
    {
        case 98: gTeam[playerid] = TEAM_ROBBERS;
        case 100: gTeam[playerid] = TEAM_ROBBERS;
        case 101: gTeam[playerid] = TEAM_ROBBERS;
        case 284: gTeam[playerid] = TEAM_COPS;
        case 285: gTeam[playerid] = TEAM_COPS;
        case 286: gTeam[playerid] = TEAM_COPS;
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(gTeam[playerid] == TEAM_ROBBERS)
    {
       SetPlayerColor(playerid,WHITE);
    }
    else if(gTeam[playerid] == TEAM_COPS)
    {
       SetPlayerColor(playerid,BLUE);
    }
    return 1;
}
the gTeam should be global

try use switch

anyway i dont understand what u mean
Reply
#4

well i dpn't udnerstand why I can't use gTeam as global simple not working I have to put them in evry function and it gives me no errors when compilign but not working in game
Reply
#5

try what i post ..
Reply
#6

That also didn't work,so what should I do(no erros when compiling)
Reply
#7

This is a strange think xD let me think about it
Reply
#8

Do this.

pawn Код:
#define TEAM_COPS 1

#define TEAM_COPS_COLOR -1 // replace -1 if you dont want white

new gTeam[MAX_PLAYERS];
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    switch (classid)
    {
        case 0:
        {
            // Whatever you do here
        }
    }
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerToTeamColor(playerid);
    return 1;
}
pawn Код:
SetPlayerToTeamColor(playerid)
{
    if (gTeam[playerid] == TEAM_COPS)
    {
        SetPlayerColor(playerid, TEAM_COPS_COLOR);
    }
}

SetPlayerTeamFromClass(playerid, classid)
{
    switch(classid)
    {
        case 0:
        {
            gTeam[playerid] = TEAM_COPS;
        }
    }
    return 1;
}
Reply
#9

Okay,I'm going to ask it on another way,please tell me how to set a team color,and explain me here,because I can't udnerstand from the tutorial pawn makign a basic deatmatch
Reply
#10

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
Okay,I'm going to ask it on another way,please tell me how to set a team color,and explain me here,because I can't udnerstand from the tutorial pawn makign a basic deatmatch

What exactly dont you understand what xir wrote ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)