29.09.2010, 14:55
Quote:
hey.. I put code too! : (
http://forum.sa-mp.com/showpost.php?...3&postcount=19 btw, to create arrays with unsigned 8bit integers, simply use the "char" keyword. pawn Code:
![]() |
![Sad](images/smilies/sad.gif)
You previous post looks ok, i assume you chose the OnPlayerUpdate method only as an example to display a use for the XOR operator. If thats what you were doing, good job. You should probably note that ideally you would use the OnPlayerKeyStateChange callback though, and that it was just an example.
I've never really played with packed strings before, so i know very little when it comes to the char operator. So cant really comment on this subject. Im not sure if i'll even mess with it (the operator in general) to be honest, it seems like a ton of work for saving a bit of ram (also i imagine unpacking/checking for it would just be slow, so not sure if its worth it to me).
EDIT
Quote:
Say you have around 10 arrays size 500 that don't have values higher than 255 or lower than 0. Storing those in 4-byte cells would use a total of 20000 bytes, roughly 20kb. If you were using the arrays for packed strings, you would use only 5000 bytes (5 kb).
|
In order for me to sacrifice speed for memory (which i have a lot of) it has to be pretty well worth it to me lol.