SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 08/08/2015, 04:58 PM   #1
andreistalker
Big Clucker
 
andreistalker's Avatar
 
Join Date: May 2015
Posts: 64
Reputation: 1
Default Command not working correct!

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;
}
andreistalker is offline   Reply With Quote
Old 08/08/2015, 05:02 PM   #2
andreistalker
Big Clucker
 
andreistalker's Avatar
 
Join Date: May 2015
Posts: 64
Reputation: 1
Default Re: Command not working correct!

Is this because of:

HTML Code:
warning 217: loose indentation
andreistalker is offline   Reply With Quote
Old 08/08/2015, 05:26 PM   #3
jlalt
Banned
 
Join Date: Oct 2014
Location: Iran
Posts: 1,266
Reputation: 366
Default Re: Command not working correct!

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;

jlalt is offline   Reply With Quote
Old 09/08/2015, 09:37 PM   #4
XBrianX
Huge Clucker
 
Join Date: May 2015
Location: Dubai
Posts: 456
Reputation: 75
Default Re: Command not working correct!

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;

__________________

XBrianX is offline   Reply With Quote
Old 09/08/2015, 09:39 PM   #5
jlalt
Banned
 
Join Date: Oct 2014
Location: Iran
Posts: 1,266
Reputation: 366
Default Re: Command not working correct!

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;
jlalt is offline   Reply With Quote
Old 09/08/2015, 09:43 PM   #6
XBrianX
Huge Clucker
 
Join Date: May 2015
Location: Dubai
Posts: 456
Reputation: 75
Default Re: Command not working correct!

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.
__________________

XBrianX is offline   Reply With Quote
Old 09/08/2015, 09:45 PM   #7
jlalt
Banned
 
Join Date: Oct 2014
Location: Iran
Posts: 1,266
Reputation: 366
Default Re: Command not working correct!

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
jlalt is offline   Reply With Quote
Old 09/08/2015, 09:47 PM   #8
XBrianX
Huge Clucker
 
Join Date: May 2015
Location: Dubai
Posts: 456
Reputation: 75
Default Re: Command not working correct!

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
__________________

XBrianX is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not working. Is this is correct? krytans Scripting Help 2 10/08/2014 09:36 PM
SetPlayerSpecialAction not working correct NetKiel Bug Reports 10 18/02/2013 02:05 PM
Correct Command Codes not working? +REP ShawtyyMacJunior Scripting Help 5 30/07/2012 09:22 AM
PAWN compiler library has stopped working. (all brackets correct!) bhaveshnande Help Archive 9 20/06/2011 04:34 PM
xStreamer Not Working Have I Done It All Correct? aspire5630 Help Archive 12 29/05/2009 03:52 PM


All times are GMT. The time now is 09:26 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.