HELP! kick/ban reason is not showing up
#1

When im kicking/banning a player.. i doesnt shown the reason

it only shown the "Server Closed The Connection"

Kick/Skick/Ban Script:
Код:
CMD:kick(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 1)
	{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin] && (PlayerInfo[giveplayerid][pHelper] >= 2 || PlayerInfo[giveplayerid][pAdmin] > 0) && playerid != giveplayerid)
			{
				format(string, sizeof(string), "ADMCMD: %s has been auto-kicked, reason: Trying to /kick a higher admin.", GetPlayerNameEx(playerid));
				ABroadCast(COLOR_YELLOW,string, (PlayerInfo[playerid][pAdmin] == 1) ? (1) : (2));
			    Kick(playerid);
				return 1;
			}
   else
			{
                new year, month,day;
				getdate(year, month, day);
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
				format(string, sizeof(string), "ADMCMD: %s (IP:%s) has been kicked by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
				format(string, sizeof(string), "ADMCMD: %s has been kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
				SendClientMessageToAllEx(COLOR_LIGHTRED, string);
   				Kick(playerid);
			}
			return 1;
		}
	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	return 1;
}


CMD:skick(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /skick [playerid/partofname] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			if(PlayerInfo[giveplayerid][pAdmin] < PlayerInfo[playerid][pAdmin]) {
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
				format(string, sizeof(string), "AdmCmd: %s(IP:%s) was silent kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason);
				Log("logs/kick.log", string);
				format(string, sizeof(string), "AdmCmd: %s was silent kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
				ABroadCast(COLOR_LIGHTRED,string,1);
				Kick(giveplayerid);
			}
			return 1;
		} else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
	}
	return 1;
}

CMD:ban(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/partofname] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
			{
				if(AdminDuty[playerid] == 1)
				{
					new username[MAX_PLAYER_NAME];
					GetPVarString(playerid, "TempNameName", username, sizeof(username));
					SetPVarInt(playerid, "TempName", 0);
					SetPlayerName(playerid, username);
				}
				format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", PlayerInfo[playerid][pAdminName]);
				ABroadCast(COLOR_YELLOW,string,1);
				PlayerInfo[playerid][pBanned] = 1;
				new ip[32];
				GetPlayerIp(playerid,ip,sizeof(ip));
				AddBan(ip);
				Kick(playerid);
				return 1;
			}
			else
			{
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));

				if(AdminDuty[giveplayerid] == 1)
				{
					new username[MAX_PLAYER_NAME];
					GetPVarString(giveplayerid, "TempNameName", username, sizeof(username));
					SetPVarInt(giveplayerid, "TempName", 0);
					SetPlayerName(giveplayerid, username);

					format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], playerip, GetPlayerNameEx(playerid), reason);
					Log("logs/ban.log", string);
					format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
				}
				else
				{
					format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason);
					Log("logs/ban.log", string);
					format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
				}


				SendClientMessageToAllEx(COLOR_LIGHTRED, string);
				PlayerInfo[giveplayerid][pBanned] = 1;
				new ip[32];
				GetPlayerIp(giveplayerid,ip,sizeof(ip));
				AddBan(ip);
				Kick(giveplayerid);
				return 1;
			}

		} else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
	}
	return 1;
}
Reply
#2

use a timer
if you need to give the code you should pay just one REP
Reply
#3

Did you try it on yourself or on another player.
Reply
#4

Quote:
Originally Posted by 1fret
Посмотреть сообщение
Did you try it on yourself or on another player.
Yes, i already test on myself and on other player
Reply
#5

Really Thanks For Answer My Question
Any Way We Need Good Scripters

PHP код:
CMD:kick(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /kick [playerid] [reason]");
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin] && (PlayerInfo[giveplayerid][pHelper] >= || PlayerInfo[giveplayerid][pAdmin] > 0) && playerid != giveplayerid)
            {
                
format(stringsizeof(string), "ADMCMD: %s has been auto-kicked, reason: Trying to /kick a higher admin."GetPlayerNameEx(playerid));
                
ABroadCast(COLOR_YELLOW,string, (PlayerInfo[playerid][pAdmin] == 1) ? (1) : (2));
                
SetTimerEx("KickPlayer"500false "i"playerid); 
                return 
1;
            }
   else
            {
                new 
yearmonth,day;
                
getdate(yearmonthday);
                new 
playerip[32];
                
GetPlayerIp(giveplayeridplayeripsizeof(playerip));
                
format(stringsizeof(string), "ADMCMD: %s (IP:%s) has been kicked by %s, reason: %s (%d-%d-%d)"GetPlayerNameEx(giveplayerid), playeripGetPlayerNameEx(playerid), reason,month,day,year);
                
format(stringsizeof(string), "ADMCMD: %s has been kicked by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                
SendClientMessageToAllEx(COLOR_LIGHTREDstring);
                   
SetTimerEx("KickPlayer"500false "i"playerid); 
            }
            return 
1;
        }
    }
    else 
SendClientMessageEx(playeridCOLOR_GRAD1"You are not authorized to use that command!");
    return 
1;
}
CMD:skick(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /skick [playerid/partofname] [reason]");
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
PlayerInfo[giveplayerid][pAdmin] < PlayerInfo[playerid][pAdmin]) {
                new 
playerip[32];
                
GetPlayerIp(giveplayeridplayeripsizeof(playerip));
                
format(stringsizeof(string), "AdmCmd: %s(IP:%s) was silent kicked by %s, reason: %s"GetPlayerNameEx(giveplayerid), playeripGetPlayerNameEx(playerid), reason);
                
Log("logs/kick.log"string);
                
format(stringsizeof(string), "AdmCmd: %s was silent kicked by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                
ABroadCast(COLOR_LIGHTRED,string,1);
                
SetTimerEx("KickPlayer"500false "i"giveplayerid); 
            }
            return 
1;
        } else 
SendClientMessage(playeridCOLOR_GRAD1"Invalid player specified.");
    }
    return 
1;
}
CMD:ban(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 2)
    {
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /ban [playerid/partofname] [reason]");
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
            {
                if(
AdminDuty[playerid] == 1)
                {
                    new 
username[MAX_PLAYER_NAME];
                    
GetPVarString(playerid"TempNameName"usernamesizeof(username));
                    
SetPVarInt(playerid"TempName"0);
                    
SetPlayerName(playeridusername);
                }
                
format(stringsizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin."PlayerInfo[playerid][pAdminName]);
                
ABroadCast(COLOR_YELLOW,string,1);
                
PlayerInfo[playerid][pBanned] = 1;
                new 
ip[32];
                
GetPlayerIp(playerid,ip,sizeof(ip));
                
AddBan(ip);
                
SetTimerEx("KickPlayer"500false "i"playerid); 
                return 
1;
            }
            else
            {
                new 
playerip[32];
                
GetPlayerIp(giveplayeridplayeripsizeof(playerip));
                if(
AdminDuty[giveplayerid] == 1)
                {
                    new 
username[MAX_PLAYER_NAME];
                    
GetPVarString(giveplayerid"TempNameName"usernamesizeof(username));
                    
SetPVarInt(giveplayerid"TempName"0);
                    
SetPlayerName(giveplayeridusername);
                    
format(stringsizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s"PlayerInfo[giveplayerid][pAdminName], playeripGetPlayerNameEx(playerid), reason);
                    
Log("logs/ban.log"string);
                    
format(stringsizeof(string), "AdmCmd: %s was banned by %s, reason: %s"PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
                }
                else
                {
                    
format(stringsizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s"GetPlayerNameEx(giveplayerid), playeripGetPlayerNameEx(playerid), reason);
                    
Log("logs/ban.log"string);
                    
format(stringsizeof(string), "AdmCmd: %s was banned by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                }
                
SendClientMessageToAllEx(COLOR_LIGHTREDstring);
                
PlayerInfo[giveplayerid][pBanned] = 1;
                new 
ip[32];
                
GetPlayerIp(giveplayerid,ip,sizeof(ip));
                
AddBan(ip);
                
SetTimerEx("KickPlayer"500false "i"giveplayerid); 
                return 
1;
            }
        } else 
SendClientMessage(playeridCOLOR_GRAD1"Invalid player specified.");
    }
    return 
1;
}
forward KickPlayer(playerid);
public 
KickPlayer(playerid)
{
       
Kick(playerid);

replace it
Reply
#6

Quote:
Originally Posted by amirab
Посмотреть сообщение
use a timer
if you need to give the code you should pay just one REP
Mate,, i already add a timer and its not working its came from samp.wiki.com/kick something like that

yes i will rep you if you give me the code

add me on skype if you want to be scripter at my server

Skype: christianivann09
Reply
#7

no
i don't need to be your scripter i post a new code for you
Reply
#8

Let me see your stock
Reply
#9

Quote:
Originally Posted by 1fret
Посмотреть сообщение
Did you try it on yourself or on another player.
good question LOL
Reply
#10

Quote:
Originally Posted by amirab
Посмотреть сообщение
Really Thanks For Answer My Question
Any Way We Need Good Scripters

PHP код:
CMD:kick(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /kick [playerid] [reason]");
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin] && (PlayerInfo[giveplayerid][pHelper] >= || PlayerInfo[giveplayerid][pAdmin] > 0) && playerid != giveplayerid)
            {
                
format(stringsizeof(string), "ADMCMD: %s has been auto-kicked, reason: Trying to /kick a higher admin."GetPlayerNameEx(playerid));
                
ABroadCast(COLOR_YELLOW,string, (PlayerInfo[playerid][pAdmin] == 1) ? (1) : (2));
                
SetTimerEx("KickPlayer"500false "i"playerid); 
                return 
1;
            }
   else
            {
                new 
yearmonth,day;
                
getdate(yearmonthday);
                new 
playerip[32];
                
GetPlayerIp(giveplayeridplayeripsizeof(playerip));
                
format(stringsizeof(string), "ADMCMD: %s (IP:%s) has been kicked by %s, reason: %s (%d-%d-%d)"GetPlayerNameEx(giveplayerid), playeripGetPlayerNameEx(playerid), reason,month,day,year);
                
format(stringsizeof(string), "ADMCMD: %s has been kicked by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                
SendClientMessageToAllEx(COLOR_LIGHTREDstring);
                   
SetTimerEx("KickPlayer"500false "i"playerid); 
            }
            return 
1;
        }
    }
    else 
SendClientMessageEx(playeridCOLOR_GRAD1"You are not authorized to use that command!");
    return 
1;
}
CMD:skick(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /skick [playerid/partofname] [reason]");
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
PlayerInfo[giveplayerid][pAdmin] < PlayerInfo[playerid][pAdmin]) {
                new 
playerip[32];
                
GetPlayerIp(giveplayeridplayeripsizeof(playerip));
                
format(stringsizeof(string), "AdmCmd: %s(IP:%s) was silent kicked by %s, reason: %s"GetPlayerNameEx(giveplayerid), playeripGetPlayerNameEx(playerid), reason);
                
Log("logs/kick.log"string);
                
format(stringsizeof(string), "AdmCmd: %s was silent kicked by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                
ABroadCast(COLOR_LIGHTRED,string,1);
                
SetTimerEx("KickPlayer"500false "i"giveplayerid); 
            }
            return 
1;
        } else 
SendClientMessage(playeridCOLOR_GRAD1"Invalid player specified.");
    }
    return 
1;
}
CMD:ban(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 2)
    {
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /ban [playerid/partofname] [reason]");
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
            {
                if(
AdminDuty[playerid] == 1)
                {
                    new 
username[MAX_PLAYER_NAME];
                    
GetPVarString(playerid"TempNameName"usernamesizeof(username));
                    
SetPVarInt(playerid"TempName"0);
                    
SetPlayerName(playeridusername);
                }
                
format(stringsizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin."PlayerInfo[playerid][pAdminName]);
                
ABroadCast(COLOR_YELLOW,string,1);
                
PlayerInfo[playerid][pBanned] = 1;
                new 
ip[32];
                
GetPlayerIp(playerid,ip,sizeof(ip));
                
AddBan(ip);
                
SetTimerEx("KickPlayer"500false "i"playerid); 
                return 
1;
            }
            else
            {
                new 
playerip[32];
                
GetPlayerIp(giveplayeridplayeripsizeof(playerip));
                if(
AdminDuty[giveplayerid] == 1)
                {
                    new 
username[MAX_PLAYER_NAME];
                    
GetPVarString(giveplayerid"TempNameName"usernamesizeof(username));
                    
SetPVarInt(giveplayerid"TempName"0);
                    
SetPlayerName(giveplayeridusername);
                    
format(stringsizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s"PlayerInfo[giveplayerid][pAdminName], playeripGetPlayerNameEx(playerid), reason);
                    
Log("logs/ban.log"string);
                    
format(stringsizeof(string), "AdmCmd: %s was banned by %s, reason: %s"PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
                }
                else
                {
                    
format(stringsizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s"GetPlayerNameEx(giveplayerid), playeripGetPlayerNameEx(playerid), reason);
                    
Log("logs/ban.log"string);
                    
format(stringsizeof(string), "AdmCmd: %s was banned by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                }
                
SendClientMessageToAllEx(COLOR_LIGHTREDstring);
                
PlayerInfo[giveplayerid][pBanned] = 1;
                new 
ip[32];
                
GetPlayerIp(giveplayerid,ip,sizeof(ip));
                
AddBan(ip);
                
SetTimerEx("KickPlayer"500false "i"giveplayerid); 
                return 
1;
            }
        } else 
SendClientMessage(playeridCOLOR_GRAD1"Invalid player specified.");
    }
    return 
1;
}
forward KickPlayer(playerid);
public 
KickPlayer(playerid)
{
       
Kick(playerid);

replace it
Код:
C:\Users\Cris\Desktop\0.3z Server\ASRP (LRP script)\gamemodes\ASRP_V2.0.pwn(34152) : error 001: expected token: ",", but found "-string-"
C:\Users\Cris\Desktop\0.3z Server\ASRP (LRP script)\gamemodes\ASRP_V2.0.pwn(34152) : warning 215: expression has no effect
C:\Users\Cris\Desktop\0.3z Server\ASRP (LRP script)\gamemodes\ASRP_V2.0.pwn(34152) : warning 215: expression has no effect
C:\Users\Cris\Desktop\0.3z Server\ASRP (LRP script)\gamemodes\ASRP_V2.0.pwn(34152) : error 001: expected token: ";", but found ")"
C:\Users\Cris\Desktop\0.3z Server\ASRP (LRP script)\gamemodes\ASRP_V2.0.pwn(34152) : error 029: invalid expression, assumed zero
C:\Users\Cris\Desktop\0.3z Server\ASRP (LRP script)\gamemodes\ASRP_V2.0.pwn(34152) : fatal error 107: too many error messages on one line
Код:
Line 34152:   SetTimerEx("KickPlayer", 500, false "i", playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)