Command not working correct!
#1

I made an Kick Command but is not working properly
What it dosn't do?
You can kick a you're level admin, but i wrote this and still not working
HTML Code:
if(P_Data[PID][pAdmin] >= P_Data[playerid][pAdmin]) return SendClientMessage(playerid, -1, "{FF0000}Eroare: Nu poti da kick la admini cu level mai mare sau egal cu al tau!");
It should send 2 Messages, one to all players and one to kicked player
HTML Code:
format(local, sizeof(local), "{FF0000}Ai luat kick de la %s. Motiv: %s", GetName(playerid), reason);
			SendClientMessage(PID, -1, local);
			format(global, sizeof(global(, "{FF0000}AdminBot: %s a luat kick de la %s pe motivul: %s", GetName(PID), GetName(playerid), reason);
			SendClientMessageToAll(-1, global);
These not working/\

Code:
HTML Code:
CMD:kick(playerid,params[])
{
   if(P_Data[playerid][pAdmin] >= 1)
  {
    new PID; //define the playerid we wanna kick
            new reason[64];
            new global[90];
            new local[91];
            new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
            GetPlayerName(playerid, Adminname, sizeof(Adminname));
 	  		GetPlayerName(PID, Playername, sizeof(Playername));
            if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_WHITE, "Folosire: /kick [playerid] [reason]");

            if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, -1, "{FF0000}Eroare: Player-ul nu este online!");
			if(P_Data[PID][pAdmin] >= P_Data[playerid][pAdmin]) return SendClientMessage(playerid, -1, "{FF0000}Eroare: Nu poti da kick la admini cu level mai mare sau egal cu al tau!");
			format(local, sizeof(local), "{FF0000}Ai luat kick de la %s. Motiv: %s", GetName(playerid), reason);
			SendClientMessage(PID, -1, local);
			format(global, sizeof(global(, "{FF0000}AdminBot: %s a luat kick de la %s pe motivul: %s", GetName(PID), GetName(playerid), reason);
			SendClientMessageToAll(-1, global);
	  		Kick(PID);
  }
  else
  {
  SendClientMessage(playerid, -1, "{FF0000}Eroare: Nu ai admin!");
  }
   return 1;
}
Reply
#2

Is this because of:

HTML Code:
warning 217: loose indentation
Reply
#3

Try This :c
PHP Code:
CMD:kick(playerid,params[])
{
   if(
P_Data[playerid][pAdmin] >= 1)
  {
    new 
PID//define the playerid we wanna kick
    
new reason[64];
    new global[
90];
    new 
local[91];
    new 
Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridAdminnamesizeof(Adminname));
    
GetPlayerName(PIDPlayernamesizeof(Playername));
    if(
sscanf(params"us[64]"PID,reason)) return SendClientMessage(playeridCOLOR_WHITE"Folosire: /kick [playerid] [reason]");
    if(!
IsPlayerConnected(PID)) return SendClientMessage(playerid, -1"{FF0000}Eroare: Player-ul nu este online!");
    if(
P_Data[PID][pAdmin] >= P_Data[playerid][pAdmin]) return SendClientMessage(playerid, -1"{FF0000}Eroare: Nu poti da kick la admini cu level mai mare sau egal cu al tau!");
    
format(localsizeof(local), "{FF0000}Ai luat kick de la %s. Motiv: %s"GetName(playerid), reason);
    
SendClientMessage(PID, -1local);
    
format(global, sizeof(global(, "{FF0000}AdminBot: %s a luat kick de la %s pe motivul: %s"GetName(PID), GetName(playerid), reason);
    
SendClientMessageToAll(-1, global);
    return 
Kick(PID);
  }
  else
  {
  
SendClientMessage(playerid, -1"{FF0000}Eroare: Nu ai admin!");
  }
   return 
1;

Reply
#4

Use my code.
PHP Code:
CMD:kick(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /kick [playerid/partofname] [reason]");
        if(
AntiAdv(playeridparams)) return 1;
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
PlayerInfo[giveplayerid][pAdmin] < PlayerInfo[playerid][pAdmin]) {
                new 
playerip[32];
                
GetPlayerIp(giveplayeridplayeripsizeof(playerip));
                
format(stringsizeof(string), "AdmCmd: %s (IP:%s) was kicked by %s, reason: %s"GetPlayerNameEx(giveplayerid), playeripGetPlayerNameEx(playerid), reason);
                
Log("logs/kick.log"string);
                
format(stringsizeof(string), "AdmCmd: %s was kicked by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                
SendClientMessageToAllEx(COLOR_LIGHTREDstring);
                
Kick(giveplayerid);
            }
            return 
1;
        } else 
SendClientMessage(playeridCOLOR_GRAD1"Invalid player specified.");
    }
    return 
1;

Reply
#5

Quote:
Originally Posted by XBrianX
View Post
Use my code.
PHP Code:
CMD:kick(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /kick [playerid/partofname] [reason]");
        if(
AntiAdv(playeridparams)) return 1;
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
PlayerInfo[giveplayerid][pAdmin] < PlayerInfo[playerid][pAdmin]) {
                new 
playerip[32];
                
GetPlayerIp(giveplayeridplayeripsizeof(playerip));
                
format(stringsizeof(string), "AdmCmd: %s (IP:%s) was kicked by %s, reason: %s"GetPlayerNameEx(giveplayerid), playeripGetPlayerNameEx(playerid), reason);
                
Log("logs/kick.log"string);
                
format(stringsizeof(string), "AdmCmd: %s was kicked by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                
SendClientMessageToAllEx(COLOR_LIGHTREDstring);
                
Kick(giveplayerid);
            }
            return 
1;
        } else 
SendClientMessage(playeridCOLOR_GRAD1"Invalid player specified.");
    }
    return 
1;

is that copy + past :c?
Code:
 if(AntiAdv(playerid, params)) return 1;
Reply
#6

Quote:
Originally Posted by jlalt
View Post
is that copy + past :c?
Code:
 if(AntiAdv(playerid, params)) return 1;
No? Someone helped me to make this command long time ago.
Reply
#7

Quote:
Originally Posted by XBrianX
View Post
No? Someone helped me to make this command long time ago.
then your command will not match with hes gamemode :c you should fix hes command not give your xd
Reply
#8

Quote:
Originally Posted by jlalt
View Post
then your command will not match with hes gamemode :c you should fix hes command not give your xd
Sorry about that but i cant understand his language all i'm trying to do is to collect +REPs :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)