memset tag mismatch - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: memset tag mismatch (
/showthread.php?tid=635765)
memset tag mismatch -
Riwerry - 13.06.2017
Hey, I've found useful function from Slice called memset.
PHP код:
stock memset(variable[], cells, value) {
new address;
#emit LOAD.S.pri variable
#emit STOR.S.pri address
raw_memset(address, cells, value);
}
stock raw_memset(address, cells, value) {
new param_adr;
#emit LCTRL 6
#emit MOVE.alt
#emit LCTRL 0
#emit ADD
#emit MOVE.alt
#emit LCTRL 1
#emit SUB.alt
#emit ADD.C 92
#emit STOR.S.pri param_adr
#emit LOAD.S.pri cells
#emit SHL.C.pri 2
#emit SREF.S.pri param_adr
#emit LOAD.S.alt address
#emit LOAD.S.pri value
#emit FILL 0
}
So I decided to use it here instead of loop setting all values to -1, but it outputs tag mismatch warning. When I tried to pass PlayerText:-1, warning still persists. Seems to be working fine in game though.
PHP код:
enum E_MDC
{
PlayerText:E_MDC_TEXTDRAW[MDC_TEXTDRAW_SIZE],
//rest
}
memset(MDC_g_sPlayer[playerid][E_MDC_TEXTDRAW], MDC_TEXTDRAW_SIZE, -1);
Re: memset tag mismatch -
Nero_3D - 13.06.2017
You should recheck which parameter caused the tag mistake
I think it is the first and not the third, try that (_: to untag the variable / array)
PHP код:
memset(_: MDC_g_sPlayer[playerid][E_MDC_TEXTDRAW], MDC_TEXTDRAW_SIZE, -1);
Also I am pretty sure that you aren't using raw_memset in your code, you could combine them in one function to remove the function overhead and shift the opcodes around to remove the variable
PHP код:
stock memset(address[], cells, value) {
#emit LCTRL 6
#emit MOVE.alt
#emit LCTRL 0
#emit ADD
#emit MOVE.alt
#emit LCTRL 1
#emit SUB.alt
#emit ADD.C 92
#emit LOAD.S.alt address
#emit STOR.S.pri address
#emit LOAD.S.pri cells
#emit SHL.C.pri 2
#emit SREF.S.pri address
#emit LOAD.S.pri value
#emit FILL 0
}