SA-MP Forums Archive
What's worng? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What's worng? (/showthread.php?tid=251046)



What's worng? - Cjgogo - 25.04.2011

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;
}



Re: What's worng? - captainjohn - 25.04.2011

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


Re: What's worng? - iJumbo - 25.04.2011

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


Re: What's worng? - Cjgogo - 25.04.2011

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


Re: What's worng? - iJumbo - 25.04.2011

try what i post ..


Re: What's worng? - Cjgogo - 25.04.2011

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


Re: What's worng? - iJumbo - 25.04.2011

This is a strange think xD let me think about it


Re: What's worng? - xir - 25.04.2011

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;
}



Re: What's worng? - Cjgogo - 25.04.2011

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


AW: Re: What's worng? - xerox8521 - 25.04.2011

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 ?