SA-MP Forums Archive
Some admin commands error - 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)
+--- Thread: Some admin commands error (/showthread.php?tid=572635)



Some admin commands error - SalmaN97 - 30.04.2015

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


Re: Some admin commands error - bgedition - 30.04.2015

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)


Re: Some admin commands error - SalmaN97 - 30.04.2015

oh thank you man


Re: Some admin commands error - bgedition - 30.04.2015

No problem dude You are Welcome