21.01.2015, 00:03
CMD:on does allocate memory, and calling it again will cause leaking memory.
Using strval(params) without checks is not a good idea IMO.
CMD:off just sets the pointer to zero, which is bad, because the allocated memory is still allocated and you just lost the reference to it. See https://sampwiki.blast.hk/wiki/Memory_ac...in#Memory_leak
Use MEM:free to de-allocate it and set the pointer to NULL, so you won't cause leaking memory at all.
If you can't use NULL, because some other include may already defined it, you can use Pointer:0 or define MEM_NULL_EX before including memory.inc, so you can use Pointer:MEM_EX::NULL for the same result.
Using strval(params) without checks is not a good idea IMO.
CMD:off just sets the pointer to zero, which is bad, because the allocated memory is still allocated and you just lost the reference to it. See https://sampwiki.blast.hk/wiki/Memory_ac...in#Memory_leak
Use MEM:free to de-allocate it and set the pointer to NULL, so you won't cause leaking memory at all.
If you can't use NULL, because some other include may already defined it, you can use Pointer:0 or define MEM_NULL_EX before including memory.inc, so you can use Pointer:MEM_EX::NULL for the same result.