SendClientMessageFormatted
#1

Helloo..
So I'm looking for a SendClientMessageFormatted without using y_va.
This one make crash the server after few usage
PHP код:
#define BYTES_PER_CELL                 4
stock SCMF(playeridcolorfstring[], {Float_}:...) // CREDITS to ****** and ZEEX
{
    static const 
STATIC_ARGS 3;
    new 
= (numargs() - STATIC_ARGS) * BYTES_PER_CELL;
    if(
n)
    {
        new 
message[144],arg_start,arg_end;
        
#emit CONST.alt        fstring
        #emit LCTRL          5
        #emit ADD
        #emit STOR.S.pri        arg_start
        #emit LOAD.S.alt        n
        #emit ADD
        #emit STOR.S.pri        arg_end
        
do
        {
            
#emit LOAD.I
            #emit PUSH.pri
            
arg_end -= BYTES_PER_CELL;
            
#emit LOAD.S.pri      arg_end
        
}
        while(
arg_end arg_start);
        
#emit PUSH.S          fstring
        #emit PUSH.C          144
        #emit PUSH.ADR         message
        
+= BYTES_PER_CELL 3;
        
#emit PUSH.S          n
        #emit SYSREQ.C         format
        
+= BYTES_PER_CELL;
        
#emit LCTRL          4
        #emit LOAD.S.alt        n
        #emit ADD
        #emit SCTRL          4
        
if(playerid == INVALID_PLAYER_ID)
        {
            
#pragma unused playerid
            
return SendClientMessageToAll(colormessage);
        } else {
            return 
SendClientMessage(playeridcolormessage);
        }
    } else {
        if(
playerid == INVALID_PLAYER_ID)
        {
            
#pragma unused playerid
            
return SendClientMessageToAll(colorfstring);
        } else {
            return 
SendClientMessage(playeridcolorfstring);
        }
    }

This one is not working at all (you can't return a value)
PHP код:
#define SendClientMessageEx(%0,%1,%2,%3) \
do \
{ \
    if(
strlen(%2) > 0) \
    { \
        new 
_string_[128]; \
        
format(_string_sizeof(_string_), %2, %3); \
        
SendClientMessage(%0, %1_string_); \
    } \
} \
while(
FALSE
Any help is appreciate.
Reply
#2

Here:
http://forum.sa-mp.com/showpost.php?...postcount=4225
Reply
#3

Great. I didn't found this one.
I also added credits to Nero!
Reply
#4

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Great. I didn't found this one.
I also added credits to Nero!
I don't blame you, it's from a thread from three years ago. I just remembered coming across it on the samp forums back then lol.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)