Ban command working how unban?? -
Mustafa6155 - 10.12.2012
pawn Код:
CMD:ban(playerid,params[])
{
if (PlayerInfo[playerid][pAdmin] >= 5)
{
new tmp[256], tmp2[256], Index;
tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(params)) return SendClientMessage(playerid, -1, "{F81414}USAGE: /ban [playerid] [waarom?]");
new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(!IsPlayerConnected(player1)) return SendClientMessage(playerid,-1,"{F81414}Player is niet online!");
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, adminname, sizeof(adminname));
format(string,sizeof(string),"Admin %s Heeft %s Gebant| Waarom?? ( %s )",adminname,playername,params[2]);
SendClientMessageToAll(-1,string);
Ban(player1);
}
else
{
SendClientMessage(playerid,-1,"{F81414}Je kan deze commando niet voeren!");
}
return 1;
}
This is my ban command searched unban commands but dont found please help.
Re: Ban command working how unban?? -
Konstantinos - 10.12.2012
Why do you use strtok with ZCMD, when you can use sscanf and be very fast?
pawn Код:
// unban command
new
string[ 128 ] // Use 128, not 256.
;
// unbanned_ip would be either by sscanf or strtok. (param)
format( string, sizeof( string ), "unbanip %s", unbanned_ip );
SendRconCommand( string );
SendRconCommand( "reloadbans" );
Re: Ban command working how unban?? -
Devilxz97 - 10.12.2012
use sscanf , much better then strtok.
Re: Ban command working how unban?? -
Mustafa6155 - 10.12.2012
IDK seed an tutorial and i dont now how sscanf work
Re: Ban command working how unban?? -
LarzI - 10.12.2012
Quote:
Originally Posted by Dwane
Use 128, not 256.
|
Well, honestly, 128 is way too large too.
unbanip + space = 8 chars
IP can be maximum 255.255.255.255 - 15 chars
15 + 8 + 1 (null) = 24
Thus making 24 cells the appropriate amount.
Re: Ban command working how unban?? -
Konstantinos - 10.12.2012
Quote:
Originally Posted by Mustafa6155
IDK seed an tutorial and i dont now how sscanf work
|
I just replied to a thread that user doesn't know how to use sscanf.
Example
More info on ******'s thread about sscanf.
Quote:
Originally Posted by LarzI
Well, honestly, 128 is way too large too.
unbanip + space = 8 chars
IP can be maximum 255.255.255.255 - 15 chars
15 + 8 + 1 (null) = 24
Thus making 24 cells the appropriate amount.
|
Well, you count for that message, but string can be used for more messages into the /unban command.
Re: Ban command working how unban?? -
Mustafa6155 - 10.12.2012
Код:
Re: Ban command working how unban??
Why do you use strtok with ZCMD, when you can use sscanf and be very fast?
pawn Code:
// unban command
new
string[ 128 ] // Use 128, not 256.
;
// unbanned_ip would be either by sscanf or strtok. (param)
format( string, sizeof( string ), "unbanip %s", unbanned_ip );
SendRconCommand( string );
SendRconCommand( "reloadbans" );
What i need to define and // unban command
I didnt have it...??
Re: Ban command working how unban?? -
Konstantinos - 10.12.2012
I didn't get it. Just use the command and unban the ip of the player or it can be more complicated and reads the name from a file and returns the ip.
Re: Ban command working how unban?? -
LarzI - 10.12.2012
Quote:
Originally Posted by Dwane
Well, you count for that message, but string can be used for more messages into the /unban command.
|
Ah yes, if he uses the same string variable for both messages and the RCON command, then you're right.
Re: Ban command working how unban?? -
Mustafa6155 - 10.12.2012
Man that modern thinks like sscanf freaking me out i need a teacher ;(