SA-MP Forums Archive
Unban command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Unban command (/showthread.php?tid=261674)



Unban command - bartje01 - 14.06.2011

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;
}



Re: Unban command - XTM-Gaming - 14.06.2011

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


Re: Unban command - bartje01 - 14.06.2011

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.


Re: Unban command - bartje01 - 14.06.2011

Anyone?


Re: Unban command - cruising - 14.06.2011

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


Re: Unban command - Mike Garber - 14.06.2011

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;
}



Re: Unban command - bartje01 - 14.06.2011

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


Re: Unban command - HyperZ - 15.06.2011

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;
}



Re: Unban command - Scenario - 15.06.2011

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