#emit, What's it?
#1

Here what does the #emit codes do? What is happening here?

PHP код:
stock SendStaffMessage(color, const str[], {Float,_}:...)
{
    static
        
args,
        
start,
        
end,
        
string[144]
    ;
    
#emit LOAD.S.pri 8
    #emit STOR.pri args
    
if (args 8)
    {
        
#emit ADDR.pri str
        #emit STOR.pri start
        
for (end start + (args 8); end startend -= 4)
        {
            
#emit LREF.pri end
            #emit PUSH.pri
        
}
        
#emit PUSH.S str
        #emit PUSH.C 144
        #emit PUSH.C string
        #emit LOAD.S.pri 8
        #emit ADD.C 4
        #emit PUSH.pri
        #emit SYSREQ.C format
        #emit LCTRL 5
        #emit SCTRL 4
        
foreach (new Player)
        {
            if ((!
PlayerData[i][pDisableStaff]) && (PlayerData[i][pHelper] >= || PlayerData[i][pAdmin] > 0)) {
                  
SendClientMessage(icolorstring);
            }
        }
        return 
1;
    }
    foreach (new 
Player)
    {
        if ((!
PlayerData[i][pDisableStaff]) && (PlayerData[i][pHelper] >= || PlayerData[i][pAdmin] > 0)) {
            
SendClientMessage(icolorstr);
        }
    }
    return 
1;

Reply
#2

https://sampwiki.blast.hk/wiki/Keywordsirectives#.23emit
Reply
#3

It calls pseudo-assembler code. It's not something you want to mess with as a beginner.
Reply
#4

That code seems like it handles the formatting, although I'm not completely sure. If you want to do something like this and not have to hassle with the more complicated code, ****** has function vararg formatting in y_va.inc (in YSI).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)