Kicks, but doesn't display the SendClientMessage -
Kaaajmak - 09.04.2013
The problem is that the script kicks before the message is visible.
This is on every point where Kick is used.
Here's the code
PHP код:
CMD:kick(playerid, params[])
{
if(UserStats[playerid][role] <2) return ShowBottomText(playerid, ERROR_1);
new user, message[64], string[128];
if(sscanf(params, "us[64]", user, message)) return SendClientMessage(playerid, -1, "Usage: /kick [player][reason]");
format(string, sizeof(string), "Staff action: %s kicked %s. Reason: %s", GetRPName(playerid), GetRPName(user), message);
SendClientMessageToAll(0xFF0000FF, string);
Kick(user);
return 1;
}
Re: Kicks, but doesn't display the SendClientMessage -
Scenario - 09.04.2013
If only you would of searched before posting (as stated in the rules), you would of found your answer.
Since SA:MP 0.3x, new security measures were added and instead of waiting a little while to kick someone, once Kick() is called, it literally does it immediately.
So, in order to send messages BEFORE the kick, you have to put the kick on a timer.
So, create a 150-200 ms timer that will call the Kick() function.
Re: Kicks, but doesn't display the SendClientMessage -
Kaaajmak - 09.04.2013
Yeah, I found it like 20 seconds after I've posted, thanks.
Sorry for being an idiot.
You may delete the topic.
Re: Kicks, but doesn't display the SendClientMessage -
[XST]O_x - 09.04.2013
This has been discussed several times already.
https://sampforum.blast.hk/showthread.php?tid=411763
You can improvise something:
pawn Код:
kick2(playerid)
{
SetTimerEx("ActualKick", 100, false, "i", playerid);
}
forward ActualKick(playerid);
public ActualKick(playerid)
{
return Kick(playerid);
}
CMD:kick(playerid, params[])
{
if(UserStats[playerid][role] <2) return ShowBottomText(playerid, ERROR_1);
new user, message[64], string[128];
if(sscanf(params, "us[64]", user, message)) return SendClientMessage(playerid, -1, "Usage: /kick [player][reason]");
format(string, sizeof(string), "Staff action: %s kicked %s. Reason: %s", GetRPName(playerid), GetRPName(user), message);
SendClientMessageToAll(0xFF0000FF, string);
kick2(user);
return 1;
}
Re: Kicks, but doesn't display the SendClientMessage -
HurtLocker - 09.04.2013
I run a 0.3cR5 server and i dont need that kick timer...?!??
Re: Kicks, but doesn't display the SendClientMessage -
Scenario - 09.04.2013
Because 0.3c doesn't have the security enhancements that 0.3x has.
Re: Kicks, but doesn't display the SendClientMessage -
RiChArD_A - 09.04.2013
Quote:
Originally Posted by Kaaajmak
Yeah, I found it like 20 seconds after I've posted, thanks.
Sorry for being an idiot.
You may delete the topic.
|
This is no reason to call your self idiot LOL. We all make mistakes.