Admin commands working only for ID 0
#1

Hello guys i need some help.In my gamemode i've scripted some admin commands but they works only with id 0.

I mean,only id 0 can use it.

If an admin is id 1,2,3 etc...,some commands that requires params are bugged,they don't work.

What's wrong?

EDIT: Here is what i mean:

[2:23pm] <CrazyBot> Admin dafuq (0) has teleported to (65535)
Reply
#2

Show me one of those commands which are bugged.
Reply
#3

Ok please include your code (( the commands ))
Reply
#4

@Roel,every command that requires an id or a playername to take action,is bugged.

pawn Код:
CMD:kick(playerid,params[])
{
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
            new id,n[MAX_PLAYER_NAME],reason[128], on[MAX_PLAYER_NAME], string[256], string2[256];
            new string3[256];
            if(sscanf(params,"uz",id, reason)) return SendClientMessage(playerid,red,"Usage:/kick [PlayerID/Name] [reason]");
            else if(playerid == INVALID_PLAYER_ID) SendClientMessage(playerid,red,"System: Invalid ID");
            if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "System: Invalid ID");
            if(playerid == id) return SendClientMessage(playerid,red, "You cannot kick yourself.");
            else
            {
            GetPlayerName(playerid,n,sizeof(n));
            GetPlayerName(id,on,sizeof(on));
            new Year, Month, Day, Hour, Minute, Second;
            getdate(Year, Month, Day);
            gettime(Hour, Minute, Second);
            format(string,sizeof(string),"You have been kicked by Admin %s for: %s - %02d/%02d/%d",n,reason,Day,Month,Year);
            SendClientMessage(id,red,string);
            format(string2, sizeof(string), "Admin  %s (%d) has kicked %s (%d) - Reason: %s - %02d/%02d/%d",n,playerid,on,id,reason,Day,Month,Year);
            SendClientMessageToAll(red,string2);
           
            format(string3, sizeof(string3), "*0,4Admin  %s (%d) has kicked %s (%d) - Reason: %s - %02d/%02d/%d",n,playerid,on,id,reason,Day,Month,Year);
            IRC_GroupSay(gGroupID, IRC_CHANNEL, string3);
            IRC_GroupSay(gGroupID, IRC_ACHANNEL, string3);
            KickLog(string2);
            Kick(id);
            TotalAdminKicks++;
            return true;
            }
            }
            else return 0;
}

CMD:ban(playerid,params[])
{
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
            new id,n[MAX_PLAYER_NAME],reason[128], on[MAX_PLAYER_NAME], string[256], string2[256];
            if(sscanf(params,"uz",id, reason)) return SendClientMessage(playerid,red,"Usage:/ban [PlayerID/Name] [reason]");
            else if(playerid == INVALID_PLAYER_ID) SendClientMessage(playerid,red,"System: Invalid ID");
            if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "System: Invalid ID");
            if(playerid == id) return SendClientMessage(playerid,red, "You cannot ban yourself.");
            else
            {
            GetPlayerName(playerid,n,sizeof(n));
            GetPlayerName(id,on,sizeof(on));
            new Year, Month, Day, Hour, Minute, Second;
            getdate(Year, Month, Day);
            gettime(Hour, Minute, Second);
            new IP[16];
            new msg[190];
            new str[128];
            GetPlayerIp(id, IP, 16);
            format(string,sizeof(string),"You have been banned by Admin %s for: %s - %02d/%02d/%d",n,reason,Day,Month,Year,Hour);
            SendClientMessage(id,red,string);
            SendClientMessage(id,red,"If you think this is a mistake,post an unban appeal at www.codsamp.net");
           
            format(str,sizeof(str),"banip %s",IP);
            SendRconCommand(str);
           
            PlayerInfo[id][pBanned] = 1;
           
            format(string2, sizeof(string), "Admin %s (%d) has banned %s (%d) - Reason: %s - %02d/%02d/%d",n,playerid,on,id,reason,Day,Month,Year);
            SendClientMessageToAll(COLOR_PINK,string2);
            TotalAdminBans++;
           
            format(msg, sizeof(msg), "0,4Admin %s has banned %s - Reason: %s - %02d/%02d/%d",n,on,reason,Day,Month,Year);
            IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
            IRC_GroupSay(gGroupID, IRC_ACHANNEL, msg);
            BanLog(string2);
            Ban(id);
            return true;
            }
            }
            else return 0;
}
CMD:goto(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 2)
    {
    new targetid, string[128];
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, red, "Usage: /goto [PlayerID/Name]");
    else
    {
        new pName[24];
        GetPlayerName(targetid,pName,128);
        new aName[24];
        GetPlayerName(playerid,aName,128);
        format(string, sizeof(string), "You succesfully teleported to %s [%d]",pName,targetid);
        SendClientMessage(playerid,red,string);
        SetPlayerInterior(playerid,GetPlayerInterior(targetid));
        new Float:TeleX, Float:TeleY, Float:TeleZ;
        GetPlayerPos(targetid, TeleX, TeleY, TeleZ);
        SetPlayerPos(playerid, TeleX, TeleY, TeleZ+1);
        if(GetPlayerState(targetid) == PLAYER_STATE_DRIVER)
        {
        SetVehiclePos(GetPlayerVehicleID(targetid), TeleX, TeleY, TeleZ+2);
        }
        new msg[128];
        format(msg, sizeof(msg), "0,4Admin %s (%d) has teleported to %s (%d)", aName,playerid, pName, targetid);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
        return true;
    }
    }
    else return 0;
}
CMD:drop(playerid, params[])
{
    new pid;
    if(sscanf(params, "us", pid, params[2])) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /drop [playerid] [reason]");
    if (PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, red, "ERROR: That player is not online.");
        new Float:x;
        new Float:y;
        new Float:z;
        new msg[128];
        new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180];
        GetPlayerName(pid, paramname, sizeof(paramname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        format(string, sizeof(string), "Admin %s (%d) has dropped %s (%d) - Reason: %s", adminname,playerid, paramname, pid, params[2]);
        SendClientMessageToAll(red, string);
        GetPlayerPos(pid,x,y,z);
        SetPlayerPos(pid,x,y,z+25);
       
        format(msg, sizeof(msg), "0,4Admin %s (%d) has dropped %s (%d) - Reason: %s", adminname,playerid, paramname, pid, params[2]);
        IRC_GroupSay(gGroupID, IRC_ACHANNEL, msg);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
    }
    else SendClientMessage(playerid, red, "Unknown command.");
    return 1;
}
Etc etc,hope you got the idea.
Reply
#5

Do you make sure your sscanf is updated
If no then check my tutorial that i made about this.
Reply
#6

Quote:
Originally Posted by Romel
Посмотреть сообщение
Do you make sure your sscanf is updated
If no then check my tutorial that i made about this.
Yes,sscanf is updated.
Reply
#7

Indeed, you should update your sscanf I think, since 0.3e the old sscanf didn't work at that point, but there are already new versions, just download the newest and it will work I guess.

{EDIT] Ow , you already did that, let me look again at your cmds.

Do it gives you any result when you use them? A error or something?
Reply
#8

Quote:
Originally Posted by Roel
Посмотреть сообщение
Do it gives you any result when you use them? A error or something?
With /goto i get this (it's from echo channel but the message is the same):

Admin dafuq (0) has teleported to (65535)

With /get : "Enter a valid player ID/name!"

With /drop: "ERROR: That player is not online."

With /ban: "System: Invalid ID"

The default errror messages.
Reply
#9

Did they ever work before? If they did you really should reupdate your sscanf and be sure you update everything, plugin, sscanf folder, sscanf.inc , because I really don't know what the problem can be .
Reply
#10

Quote:
Originally Posted by Roel
Посмотреть сообщение
Did they ever work before? If they did you really should reupdate your sscanf and be sure you update everything, plugin, sscanf folder, sscanf.inc , because I really don't know what the problem can be .
I'll try to reupdate sscanf,thanks everyone for help,i'll update this post.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)