Why do people make SendClientMessageEx?
#1

What's the difference between SCM and SCMEx for people to make a function?
Reply
#2

Thanks a lot for the clarification, so this goes for anything with Ex? Such as KickEx
Reply
#3

amen
Reply
#4

Quote:
Originally Posted by Infin1ty
Посмотреть сообщение
amen
lmaooo
Reply
#5

amen brother
Reply
#6

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
Can you figure out what a function named `KickEx` would do? I sure can't... Does it kick the player with a reason message? Does it kick the player after a timer? Does it kick the player and order me a pizza via a HTTP call to the Dominos web API?
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
Reply
#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
#8

Quote:
Originally Posted by BeckzyBoi
Посмотреть сообщение
Back on topic - my SendClientMessageEx/SendClientMessageToAllEx functions are named SendClientMessage2/SendClientMessageToAll2:
I think you've missed the point...
Reply
#9

Quote:
Originally Posted by Jay_
Посмотреть сообщение
I think you've missed the point...
I was showing an example of why some people would use their own alternative SendClientMessage function?
Reply
#10

I name my function SendClientMessageDecember2018
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)