Jump to content


thedyingdragon

Member Since 12 May 2010
Offline Last Active Apr 21 2013 01:11 AM

Topics I've Started

Which Is More Efficient For Online

12 May 2010 - 10:07 PM

Hello
I just wanted to know which code would be more efficient for my online engine  (Both Work Fine I've Tested Them)

The first one sends the variables Str and Def to the server by packing them both into a string and sending that
The server then deciphers the string to get the original variables back

The second one sends Str and Def as separate numbers  
The server reads them the same way

clearbuffer()
writebyte(SEND_STAT)
writeshort(playerid)
total = (string(Str)+"|"+string(Def))
writestring(total)
send_client(1)
Then to read it on the server
total = readstring()
cnt = string_pos('|',total) 
Str = real(string_copy(total,0,cnt-1))
Def = real(string_copy(total,cnt+1,cnt+4))
Or would this method be better
clearbuffer()
writebyte(SEND_STAT)
writeshort(playerid)
writeshort(Str) 
writeshort(Def)
send_client(1)
Then to read on the server
Str = readshort()
Def = readshort()

I hope someone can clear this up for me THX