kick command not working.
#1

Hi there, as the title says, my kick command doesn't work, can someone EXPLAIN to me why isn't it working and how to repair it ?

The command isn't finished so it doesn't need to kick the player, for the moment, ofc.

PHP код:
CMD:kick(playeridparams[])
{
    if(
Player[playerid][Admin] >= 1)
    {
        new 
toplayeridreason[24], string[126];
        
        if (!
sscanf(params"ii"toplayeridreason))
        {
            
format(stringsizeof(string), "%s has been kicked by %s, reason: %s"toplayeridplayeridreason);
            
SendClientMessageToAll(color_redstring);
        }
        else 
SendClientMessage(playeridcolor_grey"UTILIZARE:/kick <playerid/name> <motiv>");
    }
    else 
SendClientMessage(playeridcolor_grey"You are not authorized to use that command.");
    return 
1;

Reply
#2

you miss Kick(toplayerid);

PHP код:
CMD:kick(playeridparams[])
{
    if(
Player[playerid][Admin] >= 1)
    {
        new 
toplayeridreason[24], string[126];
        
        if (!
sscanf(params"ii"toplayeridreason))
        {
            
format(stringsizeof(string), "%s has been kicked by %s, reason: %s"toplayeridplayeridreason);
            
SendClientMessageToAll(color_redstring);
            
Kick(toplayerid);
        }
        else 
SendClientMessage(playeridcolor_grey"UTILIZARE:/kick <playerid/name> <motiv>");
    }
    else 
SendClientMessage(playeridcolor_grey"You are not authorized to use that command.");
    return 
1;

or use that cause first may message not show for who kicked

PHP код:
CMD:kick(playeridparams[])
{
    if(
Player[playerid][Admin] >= 1)
    {
        new 
toplayeridreason[24], string[126];
        
        if (!
sscanf(params"ii"toplayeridreason))
        {
            
format(stringsizeof(string), "%s has been kicked by %s, reason: %s"toplayeridplayeridreason);
            
SendClientMessageToAll(color_redstring);
            
SetTimerEx("kick1",1000,0,"i",toplayerid);
        }
        else 
SendClientMessage(playeridcolor_grey"UTILIZARE:/kick <playerid/name> <motiv>");
    }
    else 
SendClientMessage(playeridcolor_grey"You are not authorized to use that command.");
    return 
1;
}
forward kick1(playerid);
public 
kick1(playerid) {
return 
Kick(playerid);

Reply
#3

I explained it wrong , my wrong. I know how to make the command to kick someone, but the problem Is that the
Код:
format(string, sizeof(string), "%s has been kicked by %s, reason: %s", toplayerid, playerid, reason);
isn't showing.
Reply
#4

PHP код:
CMD:kick(playeridparams[]){ 
    if(
Player[playerid][Admin] >= 1){
        new 
toplayeridreason[24], string[126]; 
         
        if (!
sscanf(params"is[24]"toplayeridreason)) 
        { 
            
format(stringsizeof(string), "%s has been kicked by %s, reason: %s"toplayeridplayeridreason); 
            
SendClientMessageToAll(color_redstring); 
            
Kick(toplayerid);
        } 
        else 
SendClientMessage(playeridcolor_grey"UTILIZARE:/kick <playerid/name> <motiv>"); 
    } 
    else 
SendClientMessage(playeridcolor_grey"You are not authorized to use that command."); 
    return 
1

Reply
#5

Try this..

Код:
CMD:kick(playerid, params[])
{
	new toplayerid, reason[24], string[126];
    if(!Player[playerid][Admin] >= 1) return SendClientMessage(playerid, color_grey, "You are not authorized to use that command.");
        

	if (sscanf(params, "ii", toplayerid, reason))
 	{
  		SendClientMessage(playerid, color_grey, "UTILIZARE:/kick <playerid/name> <motiv>");
 	}
	format(string, sizeof(string), "%s has been kicked by %s, reason: %s", toplayerid, playerid, reason);
	SendClientMessageToAll(color_red, string);
	Kick(toplayerid);
    
    return 1;
}
Try it. and dont be so complicated try the easiest way to present codes!
Reply
#6

This above is wrong
Reply
#7

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
This above is wrong
I've tried yours but on the server it ways something like:

has been kicked by , reason: the reason.

The problem is that the players name isn't showed.
Reply
#8

learn more when you use the %s %d ...
PHP код:
format(stringsizeof(string), "%d has been kicked by %d, reason: %s"toplayeridplayeridreason); 
Reply
#9

Quote:
Originally Posted by fuckingcruse
Посмотреть сообщение
Try this..

Код:
CMD:kick(playerid, params[])
{
	new toplayerid, reason[24], string[126];
    if(!Player[playerid][Admin] >= 1) return SendClientMessage(playerid, color_grey, "You are not authorized to use that command.");
        

	if (sscanf(params, "ii", toplayerid, reason))
 	{
  		SendClientMessage(playerid, color_grey, "UTILIZARE:/kick <playerid/name> <motiv>");
 	}
	format(string, sizeof(string), "%s has been kicked by %s, reason: %s", toplayerid, playerid, reason);
	SendClientMessageToAll(color_red, string);
	Kick(toplayerid);
    
    return 1;
}
Try it. and dont be so complicated try the easiest way to present codes!
Quote:

Scripting for money , except Mysql and textdraws , I can script everything.

PHP код:
sscanf(params"ii"toplayeridreason
Are you serious? You just asking sscanf to scan 'params' for 2 integers, while the reason is string.. ._.
And this signature tho, You can't even use sscanf..
I wont be pussy here so..
Lemme post something to help topic owner.

PHP код:
CMD:kick(playeridparams[])
{
    new 
idreason[24];
    if(
sscanf(params"us[24]"idreason)) return SendClientMessage(playeridcolor_grey"UTILIZARE:/kick <playerid/name> <motive>");
    else if(
Player[playerid][Admin] < 1) return  SendClientMessage(playeridcolor_grey"You are not authorized to use that command.");
    else if(!
IsPlayerConnected(id)) return SendClientMessage(playeridcolor_grey"Invalid Player.");
    else
    {
        new 
tmpstr[128], pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
        
GetPlayerName(idpNamesizeof(pName));
        
GetPlayerName(playeridaNamesizeof(aName));
        
format(tmpstrsizeof(tmpstr), "%s has been kicked by %s, reason: %s"pNameaNamereason);
        
SendClientMessageToAll(color_redtmpstr);
        
Kick(id);
    }
    return 
1;

Cheers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)