Why do people make SendClientMessageEx?
#7

Quote:
Originally Posted by sammp
Посмотреть сообщение
Kick() was fixed back in SA-MP 0.3x RC3 when it didn't always send kick messages. I think it was given higher packet priority or something, so KickEx() was introduced by people to work around that and send custom messages, fire a timer of like 500ms and then kick them, thus allowing time for the server to send a message back to the client before they got kicked. At least, that's the original reason it was adopted. Other variations were KickWithMessage(), which while more verbose than KickEx, it offers more clarity in its purpose.

Edit// just realised you're talking about the actual name of the function rather than its purpose, see last sentence for a more appropriate answer
Are you sure messages not being sent before Kick() was fixed? They still aren't sent for me.

Back on topic - my SendClientMessageEx/SendClientMessageToAllEx functions are named SendClientMessage2/SendClientMessageToAll2:
Код:
#define MAX_CLIENT_MSG_LENGTH 144

SendClientMessage2(playerid, color, message[])
{
    if (strlen(message) <= MAX_CLIENT_MSG_LENGTH) return SendClientMessage(playerid, color, message);
    new string[MAX_CLIENT_MSG_LENGTH + 1];
    strmid(string, message, 0, MAX_CLIENT_MSG_LENGTH);
    return SendClientMessage(playerid, color, string);
}

SendClientMessageToAll2(color, message[])
{
    if (strlen(message) <= MAX_CLIENT_MSG_LENGTH) return SendClientMessageToAll(color, message);
    new string[MAX_CLIENT_MSG_LENGTH + 1];
    strmid(string, message, 0, MAX_CLIENT_MSG_LENGTH);
    return SendClientMessageToAll(color, string);
}
If a client message longer than 144 is sent, the message won't be visible. So I use SendClientMessage2/SendClientMessageToAll2 to crop the message if it's longer than 144.
Reply


Messages In This Thread
Why do people make SendClientMessageEx? - by Stefhan - 22.12.2018, 18:43
Re: Why do people make SendClientMessageEx? - by Stefhan - 22.12.2018, 19:32
Re: Why do people make SendClientMessageEx? - by Infin1ty - 22.12.2018, 19:50
Re: Why do people make SendClientMessageEx? - by TheToretto - 22.12.2018, 22:08
Re: Why do people make SendClientMessageEx? - by cuber - 22.12.2018, 22:33
Re: Why do people make SendClientMessageEx? - by sammp - 24.12.2018, 02:56
Re: Why do people make SendClientMessageEx? - by BeckzyBoi - 24.12.2018, 05:18
Re: Why do people make SendClientMessageEx? - by Jay_ - 24.12.2018, 10:30
Re: Why do people make SendClientMessageEx? - by BeckzyBoi - 24.12.2018, 11:06
Re: Why do people make SendClientMessageEx? - by GhostHacker9 - 24.12.2018, 14:55

Forum Jump:


Users browsing this thread: 3 Guest(s)