Thread: bytes question
View Single Post
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 09-29-2007 , 04:47   Re: bytes question
Reply With Quote #2

As you know the format of the message, you can safely jump over the null terminators without the fear of overflowing the buffer or getting garbage data.

PHP Code:
new type Sdata[4]

decl String:hostname[32]
strcopy(hostname,sizeof hostnameSdata[6])

decl String:map[32], String:moddir[16], String:desc[64]

new 
len strcopy(map,sizeof mapSdata[7]) + 7
len 
+= strcopy(moddir,sizeof moddirSdata[len 1]) + 1
len 
+= strcopy(desc,sizeof descSdata[len 1]) + 1

new playercount Sdata[len 2]    //skip the null terminator and steam appid
new maxplayers Sdata[len 3]
new 
bool:password Sdata[len 7] ? true false

... 
__________________
plop

Last edited by p3tsin; 09-29-2007 at 05:01.
p3tsin is offline