Unban command
#1

Hey all. What's wrong with my unban command? It just doesn't work


pawn Код:
COMMAND:unban(playerid,params[])
{
    new pIp[200];
    if(PlayerInfo[playerid][pAdminLevel] <5) return SendClientMessage(playerid,COLOR_RED,"You're not allowed to use this");
    if(sscanf(params,"d",pIp)) return SendClientMessage(playerid,COLOR_GREY,"USAGE:/unban [ip]");
    format(String,sizeof(String),"unbanip %s",pIp);
    SendRconCommand(String);
    SendRconCommand("reloadbans");
    return 1;
}
Reply
#2

I think its better & easier if you use this.............

/rcon login [password]

/rcon unbanip (their IP)
/rcon reloadbans

reloadbans reloads the samp.ban list

or try this..

PHP код:
dcmd_unbanip(playerid,params[]) {
    if(
PlayerData[playerid][Level] >= || IsPlayerAdmin(playerid))
    {
    new 
adminname[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,adminname,sizeof(adminname));
    if(!
strlen(params)) return msg(playerid,"Correct usage : /unbanip <IP>");
    new 
string[76];
    
format(string,sizeof(string),"unbanip %s",params);
    
SendRconCommand("string");
    
printf("%s(ID:%d) used the command unbanip and unbanned ip %s",adminname,playerid,params);
    }
    return 
1;

just found this info here: https://sampforum.blast.hk/showthread.php?tid=95583
Reply
#3

Quote:
Originally Posted by XTM-Gaming
Посмотреть сообщение
I think its better & easier if you use this.............

/rcon login [password]

/rcon unbanip (their IP)
/rcon reloadbans

reloadbans reloads the samp.ban list

or try this..

PHP код:
dcmd_unbanip(playerid,params[]) {
    if(
PlayerData[playerid][Level] >= || IsPlayerAdmin(playerid))
    {
    new 
adminname[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,adminname,sizeof(adminname));
    if(!
strlen(params)) return msg(playerid,"Correct usage : /unbanip <IP>");
    new 
string[76];
    
format(string,sizeof(string),"unbanip %s",params);
    
SendRconCommand("string");
    
printf("%s(ID:%d) used the command unbanip and unbanned ip %s",adminname,playerid,params);
    }
    return 
1;

just found this info here: https://sampforum.blast.hk/showthread.php?tid=95583
Didn't work for me and I want it to be for a level 5 admin in my script not for RCON.
Reply
#4

Anyone?
Reply
#5

Quote:
Originally Posted by bartje01
Посмотреть сообщение
Anyone?
Or just remove the players line in samp ban file
Reply
#6

Read the green comments

pawn Код:
COMMAND:unban(playerid,params[])
{
    new pIp[16]; // WHY 200???
    if(PlayerInfo[playerid][pAdminLevel] <5) return SendClientMessage(playerid,COLOR_RED,"You're not allowed to use this");
    if(sscanf(params,"s[16]",pIp)) return SendClientMessage(playerid,COLOR_GREY,"USAGE:/unban [ip]"); // sscanf(params,"d",pIp)) (the 'd' is wrong), since it's a string, and u have to define size
    format(String,sizeof(String),"unbanip %s",pIp);
    SendRconCommand(String);
    SendRconCommand("reloadbans");
    return 1;
}
Reply
#7

Quote:
Originally Posted by Mike Garber
Посмотреть сообщение
Read the green comments

pawn Код:
COMMAND:unban(playerid,params[])
{
    new pIp[16]; // WHY 200???
    if(PlayerInfo[playerid][pAdminLevel] <5) return SendClientMessage(playerid,COLOR_RED,"You're not allowed to use this");
    if(sscanf(params,"s[16]",pIp)) return SendClientMessage(playerid,COLOR_GREY,"USAGE:/unban [ip]"); // sscanf(params,"d",pIp)) (the 'd' is wrong), since it's a string, and u have to define size
    format(String,sizeof(String),"unbanip %s",pIp);
    SendRconCommand(String);
    SendRconCommand("reloadbans");
    return 1;
}
This sends me the messgae : USAGE: /unban [ip]
I'm typing /unban 111.111.111

And yes the 200 was very idiotic :P But how to fix this now?
Thanks
Reply
#8

pawn Код:
COMMAND:unban(playerid,params[])
{
    new
        pIp[32],
        str[64]
    ;
    if(PlayerInfo[playerid][pAdminLevel] <5)
        return SendClientMessage(playerid, COLOR_RED,"You're not allowed to use this");
    if(sscanf(params,"s[32]",pIp))
        return SendClientMessage(playerid, COLOR_GREY,"USAGE:/unban [ip]");
    format(str,sizeof(str),"unbanip %s",pIp);
    SendRconCommand(str);
    SendRconCommand("reloadbans");
    return 1;
}
Reply
#9

An IP address is read/written as a string not an integer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)