Kicks, but doesn't display the SendClientMessage
#1

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(playeridparams[])
{
     if(
UserStats[playerid][role] <2) return ShowBottomText(playeridERROR_1);
     new 
usermessage[64], string[128];
    if(
sscanf(params"us[64]"usermessage)) return SendClientMessage(playerid, -1"Usage: /kick [player][reason]");
    
format(stringsizeof(string), "Staff action: %s kicked %s. Reason: %s"GetRPName(playerid), GetRPName(user), message);
    
SendClientMessageToAll(0xFF0000FFstring);
    
Kick(user);
    return 
1;

Reply
#2

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.
Reply
#3

Yeah, I found it like 20 seconds after I've posted, thanks.
Sorry for being an idiot.
You may delete the topic.
Reply
#4

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;
}
Reply
#5

I run a 0.3cR5 server and i dont need that kick timer...?!??
Reply
#6

Because 0.3c doesn't have the security enhancements that 0.3x has.
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)