Problem at /kick.
#4

Still the same...
Here:

PHP код:
CMD:kick(playeridparams[])
{
    new 
PID//define the playerid we wanna kick
    
new reason[64]; //the reason, put into a string
    
new str[128];
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF0000FF"You need to be admin for use this command.");
    new 
Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
    
if(sscanf(params"us[64]"PID,reason)) return SendClientMessage(playerid0xFF0000FF"/kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
    
GetPlayerName(playeridAdminnamesizeof(Adminname)); //defines the function with the adminname we wanna get
     
GetPlayerName(PIDPlayernamesizeof(Playername));
    
format(strsizeof(str), "'%s' has been kicked by administrator '%s'. Reason: %s."PlayernameAdminnamereason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
    
SendClientMessageToAll(0xFF6C00FFstr); //send that message to all
    
    
if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
    
return SendClientMessage(playerid0xFF0000FF"Player is not connected!");
    
Kick(PID);
    
    return 
1;

"GetPlayerName" needs to be after "sscanf"
Reply


Messages In This Thread
Problem at /kick. - by GabiXx - 01.08.2015, 14:10
AW: Problem at /kick. - by Macronix - 01.08.2015, 14:12
Re: Problem at /kick. - by GabiXx - 01.08.2015, 14:53
AW: Problem at /kick. - by Macronix - 01.08.2015, 14:57
Re: Problem at /kick. - by xVIP3Rx - 01.08.2015, 14:58
Re: Problem at /kick. - by GabiXx - 01.08.2015, 15:04
Re: Problem at /kick. - by xVIP3Rx - 01.08.2015, 15:17
Re: Problem at /kick. - by GabiXx - 01.08.2015, 16:07
AW: Problem at /kick. - by Macronix - 01.08.2015, 16:10
Re: Problem at /kick. - by GabiXx - 01.08.2015, 16:24

Forum Jump:


Users browsing this thread: 1 Guest(s)