Kick command not working
#1

Kick and ban command not working when i type server got crashed

Код:
CMD:kick(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 1)
	{
		new target,reason[64],str[128],logstring[200],month,day,year;
		new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, Adminname, sizeof(Adminname));
		GetPlayerName(target, Playername, sizeof(Playername));
		getdate(year, month, day);
		if(sscanf(params, "us[64]", target,reason)) return SCM(playerid, bojaz, "[INFO]: /kick [playerid] [reason]");
		if(!IsPlayerConnected(target))
			return SCM(playerid, bojaz, "Player is not connected!");
		format(str, sizeof(str), "[Adm] %s has been kicked by '%s'. Reason: %s (%d-%d-%d) ", Playername, Adminname, reason,year,month,day);
		printf(str);
		format(logstring, sizeof(logstring), "Info: %s was kicked by %s, reason: %s (%d-%d-%d).",sendername(target),sendername(playerid),reason,year,month,day);
		KickLog(logstring);
		SetTimerEx("kicktimer", 1000, false, "d", target);

	}
	else
	{
		SCM(playerid,bojaz,"You re not admin");
	}
	return 1;
}
Код:
CMD:ban(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 1)
	{
		new target;
		new reason[64];
		new str[128];
		new day,month,year;
		getdate(year, month, day);
		new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, Adminname, sizeof(Adminname));
		GetPlayerName(target, Playername, sizeof(Playername));
		if(sscanf(params, "us[64]", target,reason)) return SCM(playerid, -1,"[INFO]: /ban [playerid] [reason]");
		if(!IsPlayerConnected(target))	return SCM(playerid,bojaz, "** Player not found.");
		format(str, sizeof(str), "[Adm] %s has been banned by %s. Reason: %s (%d-%d-%d) ", Playername, Adminname, reason,year,month,day);
		SendClientMessageToAll(bojaz, str);
		printf(str);
		BanLog(str);
		PlayerInfo[target][pBanned] = 1;
		SetTimerEx("bantimer", 1000, false, "d", target);
	}
	else
	{
		SCM(playerid,bojaz,"Your not admin");
	}
	return 1;
}
Reply
#2

Try this
PHP код:
CMD:kick(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 1) return SCM(playerid,bojaz,"Your not admin");
    {
        new 
target,reason[64],str[128],logstring[200],month,day,year;
        new 
Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridAdminnamesizeof(Adminname));
        
GetPlayerName(targetPlayernamesizeof(Playername));
        
getdate(yearmonthday);
        if(
sscanf(params"us[64]"target,reason)) return SCM(playeridbojaz"[INFO]: /kick [playerid] [reason]");
        if(!
IsPlayerConnected(target))
            return 
SCM(playeridbojaz"Player is not connected!");
        
format(strsizeof(str), "[Adm] %s has been kicked by '%s'. Reason: %s (%d-%d-%d) "PlayernameAdminnamereason,year,month,day);
        
printf(str);
        
format(logstringsizeof(logstring), "Info: %s was kicked by %s, reason: %s (%d-%d-%d).",sendername(target),sendername(playerid),reason,year,month,day);
        
KickLog(logstring);
        
SetTimerEx("kicktimer"1000false"d"target);
            return 
1;

add under the CMD

PHP код:
forward kicktimer(playerid); 
PHP код:
public kicktimer(playeridKick(playerid); 
PHP код:
CMD:ban(playeridparams[])
{
            if (
PlayerInfo[playerid][pAdmin] >= 1) return SCM(playerid,bojaz,"Your not admin");
        new 
target;
        new 
reason[64];
        new 
str[128];
        new 
day,month,year;
        
getdate(yearmonthday);
        new 
Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridAdminnamesizeof(Adminname));
        
GetPlayerName(targetPlayernamesizeof(Playername));
        if(
sscanf(params"us[64]"target,reason)) return SCM(playerid, -1,"[INFO]: /ban [playerid] [reason]");
        if(!
IsPlayerConnected(target))    return SCM(playerid,bojaz"** Player not found.");
        
format(strsizeof(str), "[Adm] %s has been banned by %s. Reason: %s (%d-%d-%d) "PlayernameAdminnamereason,year,month,day);
        
SendClientMessageToAll(bojazstr);
        
printf(str);
        
BanLog(str);
        
PlayerInfo[target][pBanned] = 1;
        
SetTimerEx("bantimer"1000false"d"target);
            return 
1;

and add,
under the CMD,
PHP код:
forward bantimer(playerid); 
PHP код:
public bantimer(playerid); Ban(playerid); 
Reply
#3

you add } else { for SSCANF not admin permission also if you wanna add it, its should be } else return your message ....

try:
PHP код:
CMD:kick(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
target,reason[64],str[128],logstring[200],month,day,year;
        new 
Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridAdminnamesizeof(Adminname));
        
GetPlayerName(targetPlayernamesizeof(Playername));
        
getdate(yearmonthday);
        if(
sscanf(params"us[64]"target,reason)) return SCM(playeridbojaz"[INFO]: /kick [playerid] [reason]");
        if(!
IsPlayerConnected(target))
            return 
SCM(playeridbojaz"Player is not connected!");
        
format(strsizeof(str), "[Adm] %s has been kicked by '%s'. Reason: %s (%d-%d-%d) "PlayernameAdminnamereason,year,month,day);
        
printf(str);
        
format(logstringsizeof(logstring), "Info: %s was kicked by %s, reason: %s (%d-%d-%d).",sendername(target),sendername(playerid),reason,year,month,day);
        
KickLog(logstring);
        
SetTimerEx("kicktimer"1000false"d"target);
    } else return 
SCM(playerid,bojaz,"You re not admin");
    return 
1;
}
CMD:ban(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
target;
        new 
reason[64];
        new 
str[128];
        new 
day,month,year;
        
getdate(yearmonthday);
        new 
Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridAdminnamesizeof(Adminname));
        
GetPlayerName(targetPlayernamesizeof(Playername));
        if(
sscanf(params"us[64]"target,reason)) return SCM(playerid, -1,"[INFO]: /ban [playerid] [reason]");
        if(!
IsPlayerConnected(target))    return SCM(playerid,bojaz"** Player not found.");
        
format(strsizeof(str), "[Adm] %s has been banned by %s. Reason: %s (%d-%d-%d) "PlayernameAdminnamereason,year,month,day);
        
SendClientMessageToAll(bojazstr);
        
printf(str);
        
BanLog(str);
        
PlayerInfo[target][pBanned] = 1;
        
SetTimerEx("bantimer"1000false"d"target);
    } else return 
SCM(playerid,bojaz,"Your not admin");
    return 
1;

dude you kiding xD?
PHP код:
if (PlayerInfo[playerid][pAdmin] >= 1) return SCM(playerid,bojaz,"Your not admin"); 
it will not let any admin that higher than or level 1 to use the command instead of it you can use:
PHP код:
if (PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid,bojaz,"Your not admin"); 
Reply
#4

Quote:
Originally Posted by jlalt
Посмотреть сообщение
you add } else { for SSCANF not admin permission also if you wanna add it, its should be } else return your message ....

try:
PHP код:
CMD:kick(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
target,reason[64],str[128],logstring[200],month,day,year;
        new 
Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridAdminnamesizeof(Adminname));
        
GetPlayerName(targetPlayernamesizeof(Playername));
        
getdate(yearmonthday);
        if(
sscanf(params"us[64]"target,reason)) return SCM(playeridbojaz"[INFO]: /kick [playerid] [reason]");
        if(!
IsPlayerConnected(target))
            return 
SCM(playeridbojaz"Player is not connected!");
        
format(strsizeof(str), "[Adm] %s has been kicked by '%s'. Reason: %s (%d-%d-%d) "PlayernameAdminnamereason,year,month,day);
        
printf(str);
        
format(logstringsizeof(logstring), "Info: %s was kicked by %s, reason: %s (%d-%d-%d).",sendername(target),sendername(playerid),reason,year,month,day);
        
KickLog(logstring);
        
SetTimerEx("kicktimer"1000false"d"target);
     }
    } else 
SCM(playerid,bojaz,"You re not admin");
    return 
1;
}
CMD:ban(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
target;
        new 
reason[64];
        new 
str[128];
        new 
day,month,year;
        
getdate(yearmonthday);
        new 
Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridAdminnamesizeof(Adminname));
        
GetPlayerName(targetPlayernamesizeof(Playername));
        if(
sscanf(params"us[64]"target,reason)) return SCM(playerid, -1,"[INFO]: /ban [playerid] [reason]");
        if(!
IsPlayerConnected(target))    return SCM(playerid,bojaz"** Player not found.");
        
format(strsizeof(str), "[Adm] %s has been banned by %s. Reason: %s (%d-%d-%d) "PlayernameAdminnamereason,year,month,day);
        
SendClientMessageToAll(bojazstr);
        
printf(str);
        
BanLog(str);
        
PlayerInfo[target][pBanned] = 1;
        
SetTimerEx("bantimer"1000false"d"target);
     }
    } else 
SCM(playerid,bojaz,"Your not admin");
    return 
1;

dude you kiding xD?
PHP код:
if (PlayerInfo[playerid][pAdmin] >= 1) return SCM(playerid,bojaz,"Your not admin"); 
it will not let any admin that higher than or level 1 to use the command instead of it you can use:
PHP код:
if (PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid,bojaz,"Your not admin"); 
Quote:

(837) : warning 209: function "cmd_kick" should return a value
pwn(837) : error 010: invalid function or declaration
pwn(83 : error 010: invalid function or declaration
pwn(862) : warning 209: function "cmd_ban" should return a value
pwn(862) : error 010: invalid function or declaration
pwn(863) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

i got 4 errors
Reply
#5

PHP код:
CMD:kick(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
target,reason[64],str[128],logstring[200],month,day,year;
        new 
Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridAdminnamesizeof(Adminname));
        
GetPlayerName(targetPlayernamesizeof(Playername));
        
getdate(yearmonthday);
        if(
sscanf(params"us[64]"target,reason)) return SCM(playeridbojaz"[INFO]: /kick [playerid] [reason]");
        if(!
IsPlayerConnected(target))
            return 
SCM(playeridbojaz"Player is not connected!");
        
format(strsizeof(str), "[Adm] %s has been kicked by '%s'. Reason: %s (%d-%d-%d) "PlayernameAdminnamereason,year,month,day);
        
printf(str);
        
format(logstringsizeof(logstring), "Info: %s was kicked by %s, reason: %s (%d-%d-%d).",sendername(target),sendername(playerid),reason,year,month,day);
        
KickLog(logstring);
        
SetTimerEx("kicktimer"1000false"d"target);
    } else return 
SCM(playerid,bojaz,"You re not admin");
    return 
1;
}

CMD:ban(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
target;
        new 
reason[64];
        new 
str[128];
        new 
day,month,year;
        
getdate(yearmonthday);
        new 
Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridAdminnamesizeof(Adminname));
        
GetPlayerName(targetPlayernamesizeof(Playername));
        if(
sscanf(params"us[64]"target,reason)) return SCM(playerid, -1,"[INFO]: /ban [playerid] [reason]");
        if(!
IsPlayerConnected(target))    return SCM(playerid,bojaz"** Player not found.");
        
format(strsizeof(str), "[Adm] %s has been banned by %s. Reason: %s (%d-%d-%d) "PlayernameAdminnamereason,year,month,day);
        
SendClientMessageToAll(bojazstr);
        
printf(str);
        
BanLog(str);
        
PlayerInfo[target][pBanned] = 1;
        
SetTimerEx("bantimer"1000false"d"target);
    } else return 
SCM(playerid,bojaz,"Your not admin");
    return 
1;

Updated
Reply
#6

Loll...... jlalt, my bad hahaa, I didn't notice he did

PHP код:
if(PlayerInfo[playerid][pAdmin] > 1
Should be < lol....
Change it to
PHP код:
if(PlayerInfo[playerid][pAdmin] < 1
Reply
#7

again same problem server got crashed
Reply
#8

can you show
kicktimer?
Reply
#9

pawn Код:
forward kicktimer(playerid);
public kicktimer(playerid) Kick(playerid);
CMD:kick(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 1)
    {
        new target,reason[64],str[128],logstring[200],month,day,year;
        new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Adminname, sizeof(Adminname));
        GetPlayerName(target, Playername, sizeof(Playername));
        getdate(year, month, day);
        if(sscanf(params, "us[64]", target,reason)) return SCM(playerid, bojaz, "[INFO]: /kick [playerid] [reason]");
        if(!IsPlayerConnected(target))
            return SCM(playerid, bojaz, "Player is not connected!");
        format(str, sizeof(str), "[Adm] %s has been kicked by '%s'. Reason: %s (%d-%d-%d) ", Playername, Adminname, reason,year,month,day);
        printf(str);
        format(logstring, sizeof(logstring), "Info: %s was kicked by %s, reason: %s (%d-%d-%d).",sendername(target),sendername(playerid),reason,year,month,day);
        KickLog(logstring);
        SetTimerEx("kicktimer", 1000, false, "d", target);
    } else return SCM(playerid,bojaz,"You re not admin");
    return 1;
}
forward bantimer(playerid);
public bantimer(playerid);
CMD:ban(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 1)
    {
        new target;
        new reason[64];
        new str[128];
        new day,month,year;
        getdate(year, month, day);
        new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Adminname, sizeof(Adminname));
        GetPlayerName(target, Playername, sizeof(Playername));
        if(sscanf(params, "us[64]", target,reason)) return SCM(playerid, -1,"[INFO]: /ban [playerid] [reason]");
        if(!IsPlayerConnected(target))    return SCM(playerid,bojaz, "** Player not found.");
        format(str, sizeof(str), "[Adm] %s has been banned by %s. Reason: %s (%d-%d-%d) ", Playername, Adminname, reason,year,month,day);
        SendClientMessageToAll(bojaz, str);
        printf(str);
        BanLog(str);
        PlayerInfo[target][pBanned] = 1;
        SetTimerEx("bantimer", 1000, false, "d", target);
    } else return SCM(playerid,bojaz,"Your not admin");
    return 1;
}
Reply
#10

Use
PHP код:
SetTimerEx("DelayedKick"1000false"i"target); 
and for ban,
PHP код:
SetTimerEx("DelayedBan"1000false"i"target); 
+
use
PHP код:
SetTimerEx("DelayedBan"1000false"i"target); 
Use "i"

AND:: put a empty line between the
PHP код:
public bantimer 
PHP код:
CMD:ban 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)