SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 20/07/2014, 04:54 PM   #1
JordanSmith
Big Clucker
 
JordanSmith's Avatar
 
Join Date: Sep 2013
Location: United Kingdom
Posts: 54
Reputation: 0
Question Problem with /kick & /ban

When I kick, or ban someone it does not say why the got kicked, or banned for
anyone know how to fix this?

Pawn Code:
Quote:
CMD:kick(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 2 || PlayerInfo[playerid][pDonateRank] == 6)
{
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) was kicked by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
Log("logs/kick.log", string);
if(PlayerInfo[playerid][pAdmin] == 1) Log("logs/moderator.log", string);
format(string, sizeof(string), "PlayerKick: %s was kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
SendClientMessageToAllEx(COLOR_LIGHTRED, string);
Kick(giveplayerid);
}
return 1;
}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}

Pawn Code:
Quote:
CMD:ban(playerid, params[])
{
if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
if (PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128], giveplayerid, reason[64];
if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /ban [playerid] [reason]");

if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
{
format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", GetPlayerNameEx(playerid));
ABroadCast(COLOR_YELLOW,string,2);
PlayerInfo[playerid][pBanned] = 1;
new ip[32];
GetPlayerIp(playerid,ip,sizeof(ip));
AddBan(ip);
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) was banned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
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;
format(PlayerInfo[giveplayerid][pFlag], 128, "");
new ip[32];
GetPlayerIp(giveplayerid,ip,sizeof(ip));
AddBan(ip);
Kick(giveplayerid);
return 1;
}

}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}
JordanSmith is offline   Reply With Quote
Old 20/07/2014, 05:26 PM   #2
Scottas
Huge Clucker
 
Scottas's Avatar
 
Join Date: Jul 2010
Location: Lithuania
Posts: 332
Reputation: 28
Default Re: Problem with /kick & /ban

Use timers for that, show message first, then call a callback that contains Kick or Ban function, like:
pawn Code:
forward KickEx(playerid);
public KickEx(playerid)
{
    Kick(playerid);
}

// and instead of Kick function use
SetTimerEx("KickEx", 100, 0, "d", playerid);
// Or redefine your Kick function into this, so you don't need to change your code, just include some.
Scottas 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
0.3x Kick() Problem Skimmer Scripting Help 8 04/02/2013 05:16 PM
/kick CMD problem Noles2197 Scripting Help 7 17/01/2013 11:29 PM
[PROBLEM] Kick Gun [HELP PLEASE!] UnknownGamer Scripting Help 1 27/06/2012 06:57 AM
Little problem with kick SomebodyAndMe Scripting Help 5 21/11/2011 02:07 PM
Kick and ban problem nicu90 Help Archive 3 07/10/2009 02:09 PM


All times are GMT. The time now is 11:17 AM.


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