#1

is this right ??
PHP код:
CMD:unban(playeridparams[])
{
new 
ip[128];
if(
PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playeridCOLOR_RED"You can't use this command");
if(
sscanf(params"s[128]"ip)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /unban [ip]");
SendRconCommand("unbanip");
return 
1;

It didn;t do anything .
Please help !
Reply
#2

You need to pass a command line argument to the unbanip RCON command.
Reply
#3

I made it know like that
PHP код:
CMD:unban(playeridparams[])
{
new 
ip[128];
new 
string[128];
if(
PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playeridCOLOR_RED"You can't use this command");
if(
sscanf(params"s[128]"ip)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /unban [ip]");
format(string,sizeof(string),"unbanip %s",ip);
SendRconCommand("string");
return 
1;

But also nothing happen
Reply
#4

Almost right.

Take a read: https://sampforum.blast.hk/showthread.php?tid=299352
Reply
#5

PHP код:
CMD:unban(playeridparams[]) 

new 
ip[20]; 
if(
PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playeridCOLOR_RED"You can't use this command"); 
if(
sscanf(params"s[20]"ip)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /unban [ip]"); 
new 
string[40];
format(string,sizeof(string),"unbanip %s",ip);
SendRconCommand(string);
SendRconCommand("reloadbans");
return 
1

Reply
#6

Replace SendRconCommand("unbanip");*
with
pawn Код:
new str[30];
format(str,sizeof(str),"unbanip %s",ip);
SendRconcommand(str);
+ You dont need string size of 128, 20 would be fine
//Edit: sorry didnt notice that someone already replied
Reply
#7

I see what you did wrong.

Just replace "SendRconCommand("string");" with "SendRconCommand(string);"
Reply
#8

Do NOT use sscanf with one string parameter only. Oh god, just use params instead.
Reply
#9

Thank you all it worked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)