Ban message
#1

Im using tkadmin.
The thing im trying to get is,
When i ban a person e.g. /ban 12 Hacks
I want that person to get this message

*You have been banned by: Trixor becuse of: Hacks. Banned wrongly? Appeal on the forums.

Код:
CMD:ban(playerid, params[])
{
	levelerror(1);
	if (sscanf(params, "us[200]", plid, estring)) return SendErrorMessage(playerid, "Usage: /ban <id> <reason>");
	if (!IsPlayerConnected(plid)) return SendErrorMessage(playerid, "Player Not Connected!");
	format(string, sizeof(string), "You have banned {FFFFFF}%s(%d)", PlayerName(plid), plid);
	SendClientMessage(playerid, 0x66FF33, string);
	format(largestring, sizeof(largestring), "Admin %s banned you from the server\r\nReason:%s", PlayerName(playerid), estring);
	ShowPlayerDialog(plid, DIALOG_KICK, DIALOG_STYLE_MSGBOX, "You have been banned", largestring, "Ok", "Cancel");
	GetPlayerIp(plid, PIP, 50);
	new Hour, Minute, Second, Year, Month, Day;
	gettime(Hour, Minute, Second);
	getdate(Year, Month, Day);
	format(string, sizeof(string), "%02d:%02d:%02d on %02d/%02d/%d", Hour, Minute, Second, Day, Month, Year);
    format(Query, sizeof(Query), "INSERT INTO `banlog` (`time`, `name`, `ip`, `reason`, `admin`, `banned`) VALUES ('%s', '%s', '%s', '%s', '%s', 1)", string, escpname(plid), PIP, escstring(estring), escpname(playerid));
	mysql_query(Query);
	mysql_free_result();
	Kick(plid);
	return 1;
}
Код:
	format(largestring, sizeof(largestring), "Admin %s banned you from the server\r\nReason:%s", PlayerName(playerid), estring);
Dosnt show

Would love some help.


TKadmin
http://forum.sa-mp.com/showthread.ph...hlight=tkadmin
Reply
#2

you must do that with timer like this


Quote:

SetTimerEx("Kick", 1000, false, "d",playerid); ---> you put this in that cmd

kick(plid); delete from that cmd, and do this

Quote:

forward Kick(playerid);
public Kick(playerid)
{
Kick(playerid);
return 1;
}

Reply
#3

Use a 100ms timer which trigerrs these lines:
pawn Код:
GetPlayerIp(plid, PIP, 50);
    new Hour, Minute, Second, Year, Month, Day;
    gettime(Hour, Minute, Second);
    getdate(Year, Month, Day);
    format(string, sizeof(string), "%02d:%02d:%02d on %02d/%02d/%d", Hour, Minute, Second, Day, Month, Year);
    format(Query, sizeof(Query), "INSERT INTO `banlog` (`time`, `name`, `ip`, `reason`, `admin`, `banned`) VALUES ('%s', '%s', '%s', '%s', '%s', 1)", string, escpname(plid), PIP, escstring(estring), escpname(playerid));
    mysql_query(Query);
    mysql_free_result();
    Kick(plid);
EDIT: late
Reply
#4

Instead of 1 use timer, you can use stock.

pawn Код:
stock pkick()
{
     SetTimer("kicking", 500, false);
     return 1;
}

forward kicking(playerid);
public kicking(playerid)
{
      Kick(playerid);
      return 1;
}
And instead of 'Kick(plid)' use 'pkick();'.

Regards.
Reply
#5

Quote:
Originally Posted by Private200
Посмотреть сообщение
Instead of 1 use timer, you can use stock.
So the stock structure provides the needed delay? interesting.
EDIT: OH I DIDN'T SEE THE TIMER SORRY.
Reply
#6

No but, you can use it every-time instead of creating a new timer each moment you want to create new command that kicks the player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)