[HELP] /myteam problem
#1

Quote:

if (strcmp("/myteam", cmdtext, true, 10) == 0)
{
if(pTeam[playerid] == POLICE){
SendClientMessage(playerid,COLOR_BLUE,"You're a police officer");
return 1;
}
if(pTeam[playerid] == CRINIMALS){
SendClientMessage(playerid,COLOR_RED,"You're a crinimal");
return 1;
}

It will always say You're a crinimal.

Quote:

new pTeam[MAX_PLAYERS];
#define TEAM_wCRINIMALS 0
#define TEAM_POLICE 1

Any help?
Reply
#2

Do you have a command to change the team? and at if(pTeam[playerid] should be == 0 for criminals and 1 for police ... let me try a quick script
Reply
#3

pawn Код:
if (strcmp("/myteam", cmdtext, true, 10) == 0)
{
if(pTeam[playerid] == TEAM_POLICE){
SendClientMessage(playerid,COLOR_BLUE,"You're a police officer");
return 1;
}
if(pTeam[playerid] == TEAM_CRINIMALS){
SendClientMessage(playerid,COLOR_RED,"You're a crinimal");
return 1;
}
Reply
#4

Quote:
ScRipTeRi:
if (strcmp("/myteam", cmdtext, true, 10) == 0)
{
if(pTeam[playerid] == TEAM_POLICE){
SendClientMessage(playerid,COLOR_BLUE,"You're a police officer");
return 1;
}
if(pTeam[playerid] == TEAM_CRINIMALS){
SendClientMessage(playerid,COLOR_RED,"You're a crinimal");
return 1;
}

if(pTeam[playerid] == TEAM_CRIMINALS should be TEAM_wCriminals

Quote:
FishyZ:
new pTeam[MAX_PLAYERS];
#define TEAM_wCRINIMALS 0
#define TEAM_POLICE 1

Here is my working piece of code

pawn Код:
#define Criminals 0
#define Police 1
pawn Код:
new pTeam[MAX_PLAYERS];
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/myteam", cmdtext, true, 10) == 0)
    {
     if(pTeam[playerid] == 0)
        {
        SendClientMessage(playerid, -1, "You are a criminal");
        return 1;
        }
        if(pTeam[playerid] == 1)
        {
        SendClientMessage(playerid, -1, "You are a police officer");
        return 1;
        }
    }
    if (strcmp("/police", cmdtext, true, 10) == 0)
    {
        pTeam[playerid] = 1;
        return 1;
    }
    if (strcmp("/criminal", cmdtext, true, 10) == 0)
    {
        pTeam[playerid] = 0;
        return 1;
    }
    return 0;
}
It worked fine for me (the /police and /criminal commands are just to test it ... you can remove them after)
Reply
#5

Try this:
pawn Код:
if (strcmp("/myteam", cmdtext, true, 10) == 0)
    {
        new string[124];
        format(string,sizeof(string),"%s",PlayersTeam(playerid));
        SendClientMessage(playerid,-1,string);
        return 1;
    }
 
stock PlayersTeam(playerid)
{
    new str[124];
    if(pTeam[playerid] == POLICE)
        format(str,sizeof(str),"Your team is: Police");
    if(pTeam[playerid] == CRINIMALS)
        format(str,sizeof(str),"Your team is: Criminals");
    return str;
}
Reply
#6

pawn Код:
if (strcmp("/myteam", cmdtext, true, 10) == 0)
        {
                if(GetPlayerTeam == 0)
                {
                        SendClientMessage(playerid,COLOR_GREEN,"Your team is criminals !");
                }
                else if(GetPlayerTeam == 1)
                {
                        SendClientMessage(playerid,COLOR_GREEN,"Your team is police  !");
                }
        }
}
hope this will help

NOTE : if you did that delete
pawn Код:
new pTeam[playerid];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)