[HELP] Some Admin commands help
#1

Hello!

So, I have started on my admin system a week ago, and everything works fine except these 5 commands! I dont know is this scripting problem or sscanf problem cause anytime I type, for example, /goto 6, that command teleports me to the player with ID 0! Its same thing with other 4 commands!
Also, below are codes of all "bugged" commands!

Bugged Commands:
/goto <playerid>
/get <playerid>
/ip <playerid>
/ping <playerid>
/weaps <playerid>

pawn Код:
COMMAND:ip(playerid,params[])
{
    if(PlayerAcc[playerid][AdminLevel] >= 1)
    {
        if(PlayerLogged[playerid] == 1)
        {
            new Target;
            if(!sscanf(params, "u", Target))
            {
                new PIP[30];
                GetPlayerIp(Target,PIP,sizeof(PIP));
                new pstring[256];
                new tname[MAX_PLAYER_NAME];
                GetPlayerName(Target,tname,sizeof(tname));
                format(pstring,sizeof(pstring),"%sґs IP: %s",tname,PIP);
                SendClientMessage(playerid,COLOR_YELLOW,pstring);
            }
            else SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /ip <playerid>");
        }
        else SendClientMessage(playerid,red,"ERROR: You must be logged in to use this command!");
    }
    else SendClientMessage(playerid,red,"ERROR: You must be an Admin level 1 or higher to perform this command!");
    return 1;
}
COMMAND:ping(playerid,params[])
{
    if(PlayerAcc[playerid][AdminLevel] >= 1)
    {
        if(PlayerLogged[playerid] == 1)
        {
            new Target;
            if(!sscanf(params, "u", Target))
            {
                new pstring[256];
                new tname[MAX_PLAYER_NAME];
                GetPlayerName(Target,tname,sizeof(tname));
                format(pstring,sizeof(pstring),"%sґs ping: %d",tname, GetPlayerPing(Target));
                SendClientMessage(playerid,COLOR_YELLOW,pstring);
            }
            else SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /ping <playerid>");
        }
        else SendClientMessage(playerid,red,"ERROR: You must be logged in to use this command!");
    }
    else SendClientMessage(playerid,red,"ERROR: You must be an Admin level 1 or higher to perform this command!");
    return 1;
}
COMMAND:goto(playerid,params[])
{
    if(PlayerAcc[playerid][AdminLevel] >= 1)
    {
        if(PlayerLogged[playerid] == 1)
        {
            new Target;
            if(!sscanf(params, "u", Target))
            {
                new Float:X;
                new Float:Y;
                new Float:Z;
                GetPlayerPos(Target,X,Y,Z);
                SetPlayerPos(playerid,X,Y,Z);
                new pname[MAX_PLAYER_NAME];
                new tname[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pname,sizeof(pname));
                GetPlayerName(Target,tname,sizeof(tname));
                new pstring[256];
                new tstring[256];
                format(pstring,sizeof(pstring),"You have teleported to %s",tname);
                format(tstring,sizeof(tstring),"%s has teleported to your position",pname);
                SendClientMessage(playerid,COLOR_GREEN,pstring);
                SendClientMessage(Target,COLOR_GREEN,tstring);
            }
            else SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /goto <playerid>");
        }
        else SendClientMessage(playerid,red,"ERROR: You must be logged in to use this command!");
    }
    else SendClientMessage(playerid,red,"ERROR: You must be an Admin level 1 or higher to perform this command!");
    return 1;
}
COMMAND:get(playerid,params[])
{
    if(PlayerAcc[playerid][AdminLevel] >= 1)
    {
        if(PlayerLogged[playerid] == 1)
        {
            new Target;
            if(!sscanf(params, "u", Target))
            {
                new Float:X;
                new Float:Y;
                new Float:Z;
                GetPlayerPos(playerid,X,Y,Z);
                SetPlayerPos(Target,X,Y,Z);
                new pname[MAX_PLAYER_NAME];
                new tname[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pname,sizeof(pname));
                GetPlayerName(Target,tname,sizeof(tname));
                new pstring[256];
                new tstring[256];
                format(pstring,sizeof(pstring),"You have teleported %s to your position",tname);
                format(tstring,sizeof(tstring),"%s has teleported you to their position",pname);
                SendClientMessage(playerid,COLOR_GREEN,pstring);
                SendClientMessage(Target,COLOR_GREEN,tstring);
            }
            else SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /get <playerid>");
        }
        else SendClientMessage(playerid,red,"ERROR: You must be logged in to use this command!");
    }
    else SendClientMessage(playerid,red,"ERROR: You must be an Admin level 1 or higher to perform this command!");
    return 1;
}
COMMAND:weaps(playerid,params[])
{
    if(PlayerAcc[playerid][AdminLevel] >= 1)
    {
        if(PlayerLogged[playerid] == 1)
        {
            new Target;
            if(!sscanf(params, "u", Target))
            {
                new Count;
                new x;
                new string[128], string2[64];
                new WeapName[24], slot, weap, ammo;
                new name[MAX_PLAYER_NAME];
                GetPlayerName(Target,name,sizeof(name));
                format(string2,sizeof(string2),"_______|- (%d)%s Weapons -|_______", Target,name);
                SendClientMessage(playerid,COLOR_YELLOW,string2);
                for(slot = 0; slot < 14; slot++)
                {
                    GetPlayerWeaponData(Target, slot, weap, ammo);
                    if( ammo != 0 && weap != 0)
                    Count++;
                }
                if(Count < 1) return SendClientMessage(playerid,COLOR_BLUE,"No weapons found!");
                if(Count >= 1)
                {
                    for (slot = 0; slot < 14; slot++)
                    {
                        GetPlayerWeaponData(Target, slot, weap, ammo);
                        if( ammo != 0 && weap != 0)
                        {
                            GetWeaponName(weap, WeapName, sizeof(WeapName));
                            if(ammo == 65535 || ammo == 1)
                            format(string,sizeof(string),"%s%s (1)",string, WeapName);
                            else format(string,sizeof(string),"%s%s (%d)",string, WeapName, ammo);
                            x++;
                        }
                        if(x >= 5)
                        {
                            SendClientMessage(playerid, COLOR_BLUE, string);
                            x = 0;
                            format(string, sizeof(string), "");
                        }
                        else format(string, sizeof(string), "%s,  ", string);
                    }
                }
                if(x <= 4 && x > 0)
                {
                    string[strlen(string)-3] = '.';
                    SendClientMessage(playerid, COLOR_BLUE, string);
                }
            }
            else SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /weaps <playerid>");
        }
        else SendClientMessage(playerid,red,"ERROR: You must be logged in to use this command!");
    }
    else SendClientMessage(playerid,red,"ERROR: You must be an Admin level 1 or higher to perform this command!");
    return 1;
}
Any help would be appriciated!
Reply


Messages In This Thread
[HELP] Some Admin commands help - by fiki574 - 03.01.2012, 10:00
Re: [HELP] Some Admin commands help - by fiki574 - 03.01.2012, 10:35
Re: [HELP] Some Admin commands help - by Konstantinos - 03.01.2012, 10:56
Re: [HELP] Some Admin commands help - by fiki574 - 03.01.2012, 11:01
Re: [HELP] Some Admin commands help - by Konstantinos - 03.01.2012, 11:04

Forum Jump:


Users browsing this thread: 1 Guest(s)