[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
#2

Some1?? PLS!
Reply
#3

Try these, I hope those commands work!
pawn Код:
CMD:ip(playerid, params[])
{
    if(PlayerAcc[playerid][AdminLevel] < 1) return SendClientMessage(playerid, red, "ERROR: You must be an Admin level 1 or higher to perform this command!");
    if(PlayerLogged[playerid] == 0) return SendClientMessage(playerid, red, "ERROR: You must be logged in to use this command!");
    new Target;
    if(sscanf(params, "u", Target)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /ip <playerid>");
    new PIP[16];
    GetPlayerIp(Target, PIP, sizeof(PIP));
    new pstring[128], tname[MAX_PLAYER_NAME];
    GetPlayerName(Target, tname, sizeof(tname));
    format(pstring, sizeof(pstring), "%sґs IP: %s", tname, PIP);
    return SendClientMessage(playerid, COLOR_YELLOW, pstring);
}
CMD:ping(playerid, params[])
{
    if(PlayerAcc[playerid][AdminLevel] < 1) return SendClientMessage(playerid, red, "ERROR: You must be an Admin level 1 or higher to perform this command!");
    if(PlayerLogged[playerid] == 0) return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this command!");
    new Target;
    if(sscanf(params, "u", Target)) return SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /ping <playerid>");
    new pstring[128], tname[MAX_PLAYER_NAME], ping = GetPlayerPing(Target);
    GetPlayerName(Target, tname, sizeof(tname));
    format(pstring, sizeof(pstring), "%sґs ping: %d", tname, ping);
    return SendClientMessage(playerid, COLOR_YELLOW, pstring);
}
CMD:goto(playerid, params[])
{
    if(PlayerAcc[playerid][AdminLevel] < 1) return SendClientMessage(playerid, red, "ERROR: You must be an Admin level 1 or higher to perform this command!");
    if(PlayerLogged[playerid] == 0) return SendClientMessage(playerid, red, "ERROR: You must be logged in to use this command!");
    new Target;
    if(sscanf(params, "u", Target)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /goto <playerid>");
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(Target, X, Y, Z);
    SetPlayerPos(playerid, X, Y, Z);
    new pname[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(Target, tname, sizeof(tname));
    new pstring[128];
    format(pstring, sizeof(pstring), "You have teleported to %s", tname);
    SendClientMessage(playerid, COLOR_GREEN, pstring);
    format(tstring,sizeof(tstring),"%s has teleported to your position",pname);
    return SendClientMessage(Target, COLOR_GREEN, pstring);
}
CMD:get(playerid, params[])
{
    if(PlayerAcc[playerid][AdminLevel] < 1) return SendClientMessage(playerid, red, "ERROR: You must be an Admin level 1 or higher to perform this command!");
    if(PlayerLogged[playerid] == 0) return SendClientMessage(playerid, red, "ERROR: You must be logged in to use this command!");
    new Target;
    if(sscanf(params, "u", Target)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /get <playerid>");
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    SetPlayerPos(Target, X, Y, Z);
    new pname[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(Target, tname, sizeof(tname));
    new pstring[128];
    format(pstring, sizeof(pstring), "You have teleported %s to your position", tname);
    SendClientMessage(playerid,COLOR_GREEN,pstring);
    format(tstring, sizeof(tstring), "%s has teleported you to their position", pname);
    return SendClientMessage(Target, COLOR_GREEN, pstring);
}
Reply
#4

Never mind, I fixed it, tnx anyway!

The problem was:
1. I am on Linux!
2. My plugins were like this:
Код:
streamer.so sscanf.so Whirpool.so
and i changed it to this:
Код:
sscanf.so Whirpool.so streamer.so
and it worked!

In short, Linux servers are fked up!

OFF TOPIC:
pawn Код:
if(PlayerAcc[playerid][AdminLevel] < 1) return SendClientMessage(playerid, red, "ERROR: You must be an Admin level 1 or higher to perform this command!");
Lol? Serious?
pawn Код:
if(PlayerAcc[playerid][AdminLevel] < 1)
^ this means that players who ARE NOT admins can use this command! :P
Reply
#5

Quote:
Originally Posted by fiki574_CRO
Посмотреть сообщение
Never mind, I fixed it, tnx anyway!

The problem was:
1. I am on Linux!
2. My plugins were like this:
Код:
streamer.so sscanf.so Whirpool.so
and i changed it to this:
Код:
sscanf.so Whirpool.so streamer.so
and it worked!

In short, Linux servers are fked up!

OFF TOPIC:
pawn Код:
if(PlayerAcc[playerid][AdminLevel] < 1) return SendClientMessage(playerid, red, "ERROR: You must be an Admin level 1 or higher to perform this command!");
Lol? Serious?
pawn Код:
if(PlayerAcc[playerid][AdminLevel] < 1)
^ this means that players who ARE NOT admins can use this command! :P
If you look better on code you will see "<". This means if AdminLevel is less than 1, so 0 it sends the message you must be admin level 1..blabla
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)