Some admin commands error
#1

Hello guys i have problems with my admin team commands they are not working:

PHP код:
CMD:freezeteam(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= || IsPlayerAdmin(playerid))
    {
        new 
team[24];
        if(
sscanf(params"s[24]",team)) return SendClientMessage(playerid, -1"/freezeteam ballas | groves | vagos | aztecas");
        foreach(new 
iPlayer)
        {
            if(
strcmp(team,"ballas",true) == 0)
            {
                new 
string[128];
                if(
gTeam[i] == TEAM_BALLAS)
                
TogglePlayerControllable(i,0);
                return 
1;
            }
            if(
strcmp(team,"groves",true) == 0)
            {
                new 
string[128];
                if(
gTeam[i] == TEAM_GROVES)
                
TogglePlayerControllable(i,0);
                return 
1;
            }
            if(
strcmp(team,"vagos",true) == 0)
            {
                new 
string[128];
                if(
gTeam[i] == TEAM_VAGOS)
                
TogglePlayerControllable(i,0);
                return 
1;
            }
            if(
strcmp(team,"aztecas",true) == 0)
            {
                new 
string[128];
                if(
gTeam[i] == TEAM_AZTECAS)
                
TogglePlayerControllable(i,0);
                return 
1;
            }
        }
    }
    return 
1;
}
CMD:giveteammoney(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= || IsPlayerAdmin(playerid))
    {
        new 
moneyteam[42];
        if(
sscanf(params"s[42]i"teammoney)) return SendClientMessage(playerid, -1"/giveteammoney [ ballas | groves | vagos | aztecas  ] [Ammount]");
        foreach(new 
iPlayer)
        {
            if(
strcmp(team,"ballas",true) == 0)
            {
                new 
string[128];
                if(
gTeam[i] == TEAM_BALLAS)
                
GivePlayerMoney(imoney);
                return 
1;
            }
            if(
strcmp(team,"groves",true) == 0)
            {
                new 
string[128];
                if(
gTeam[i] == TEAM_GROVES)
                
GivePlayerMoney(imoney);
                return 
1;
            }
            if(
strcmp(team,"vagos",true) == 0)
            {
                new 
string[128];
                if(
gTeam[i] == TEAM_VAGOS)
                
GivePlayerMoney(imoney);
                return 
1;
            }
            if(
strcmp(team,"aztecas",true) == 0)
            {
                new 
string[128];
                if(
gTeam[i] == TEAM_AZTECAS)
                
GivePlayerMoney(imoney);
                return 
1;
            }
        }
    }
    return 
1;
}
CMD:giveteamscore(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= || IsPlayerAdmin(playerid))
    {
        new 
scoreteam[42];
        if(
sscanf(params"s[42]i"teamscore)) return SendClientMessage(playerid, -1"/Giveteamscore [ ballas | groves | vagos | aztecas ] [Scores]");
        foreach(new 
iPlayer)
        {
            new 
CurrentScore GetPlayerScore(i);
            if(
strcmp(team,"ballas",true) == 0)
            {
                new 
string[128];
                if(
gTeam[i] == TEAM_BALLAS)
                
SetPlayerScore(iCurrentScore+score);
                return 
1;
            }
            if(
strcmp(team,"groves",true) == 0)
            {
                new 
string[128];
                if(
gTeam[i] == TEAM_GROVES)
                
SetPlayerScore(iCurrentScore+score);
                return 
1;
            }
            if(
strcmp(team,"vagos",true) == 0)
            {
                new 
string[128];
                if(
gTeam[i] == TEAM_VAGOS)
                
SetPlayerScore(iCurrentScore+score);
                return 
1;
            }
            if(
strcmp(team,"aztecas",true) == 0)
            {
                new 
string[128];
                if(
gTeam[i] == TEAM_AZTECAS)
                
SetPlayerScore(iCurrentScore+score);
                return 
1;
            }
        }
    }
    return 
1;

The problem is only the admin who is using the command will be afected not the other team members

also i tryed :

PHP код:
GetPlayerTeam instead of if(gTeam[i] == TEAM_AZTECAS
Its the same
Reply
#2

I think you must use only one "return 1" and that is in the end of the command. Remove others and try.(i'm not sure)
Reply
#3

oh thank you man
Reply
#4

No problem dude You are Welcome
Reply


Forum Jump:


Users browsing this thread: