Authorised problem
#1

I got a problem with the admin cmd example this

CMD:kick i set it for Admin level 2 but im admin level 99999 i try to use kick than the server said you are not authorised to use this command.

what the problem ?
Reply
#2

The code Please ?
Reply
#3

Quote:

CMD:kick(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128], giveplayerid, reason[64];
if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]");

if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin] && (PlayerInfo[giveplayerid][pHelper] >= 2 || PlayerInfo[giveplayerid][pAdmin] > 0) && playerid != giveplayerid)
{
format(string, sizeof(string), "AdmCmd: %s has been auto-kicked, reason: Trying to /kick a higher admin.", GetPlayerNameEx(playerid));
ABroadCast(COLOR_YELLOW,string, (PlayerInfo[playerid][pAdmin] == 1) ? (1) : (2));
Kick(playerid);
return 1;
}
else
{
new year, month,day;
getdate(year, month, day);
new playerip[32];
GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
format(string, sizeof(string), "AdmCmd: %s (IP:%s) was kicked by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
Log("logs/kick.log", string);
if(PlayerInfo[playerid][pAdmin] == 1) Log("logs/moderator.log", string);
format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
SendClientMessageToAllEx(COLOR_LIGHTRED, string);
Kick(giveplayerid);
}
return 1;
}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}

This is an example but im level 99999 admin it wont let me use it.

not just command kick other command same dont let me use it
Reply
#4

It should be no problem with the command, do you get any errors for that ? (I guess not ?)
Reply
#5

no is there problem at the include?
or something?
Reply
#6

pawn Код:
CMD:kick(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized.");
    new
        giveplayerid,
        reason[64]
    ;
    if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]");
    if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
    if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin] && (PlayerInfo[giveplayerid][pHelper] >= 2 || PlayerInfo[giveplayerid][pAdmin] > 0) && playerid != giveplayerid)
    {
        format(string, sizeof(string), "AdmCmd: %s has been auto-kicked, reason: Trying to /kick a higher admin.", GetPlayerNameEx(playerid));
        ABroadCast(COLOR_YELLOW,string, (PlayerInfo[playerid][pAdmin] == 1) ? (1) : (2));
        Kick(playerid);
        return 1;
    }
    new
        year,
        month,
        day,
        playerip[32],
        string[ 128 ]
    ;
    getdate(year, month, day);
    GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
    format(string, sizeof(string), "AdmCmd: %s (IP:%s) was kicked by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
    Log("logs/kick.log", string);
    if(PlayerInfo[playerid][pAdmin] == 1) Log("logs/moderator.log", string);
    format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
    SendClientMessageToAllEx(COLOR_LIGHTRED, string);
    Kick(giveplayerid);
    return 1;
}
I don't see any message that it sends if you're not admin. Instead of that, I see that if a player is lower than level 2, he will get the message "Invalid player specified.".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)