SA-MP Forums Archive
Get a variable's tag... - 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: Get a variable's tag... (/showthread.php?tid=442111)



Get a variable's tag... - Scenario - 05.06.2013

I did a quick search but I didn't really come across anything. Basically, I would like to be able to determine a variable's tag.

For example:

pawn Код:
new
    bool:varName,
    Float:varName2
;
varName is has a bool tag, varName2 has a float tag. Is there a function in PAWN I can use to determine what those are for particular variables?


Re: Get a variable's tag... - eblood1 - 05.06.2013

I don't think you can. Why would you need it, anyway?


Re: Get a variable's tag... - Scenario - 05.06.2013

Quote:
Originally Posted by eblood1
Посмотреть сообщение
I don't think you can. Why would you need it, anyway?
Originally, I had a piece of code that basically goes through an enum and clears each piece of data, but some of the data has a "Timer:" tag that corresponds with the timers I have using y_timers. I wanted to make sure I could go through the enum in a loop and search to see if the tag equaled "Timer:" and if it did, it would just use the "stop" function y_timers has.

Nevertheless, I have found a solution around that. I'm still interested to see if this is even possible, though.

EDIT: Thanks ******, I'll check it out.

EDIT 2: Okay, this piece of code crashes the compiler... I tried it with a Float: tag, but that didn't work either...

pawn Код:
new
    Timer:tempTimerVar;
   
for(new i = 0; enumPlayerInfo:i < enumPlayerInfo; i++)
{
    if(tagof(enumPlayerInfo:i) == tagof(tempTimerVar))
    {
        stop pStats[playerid][enumPlayerInfo:i];
        continue;
    }
       
    pStats[playerid][enumPlayerInfo:i] = 0;
}



Re: Get a variable's tag... - Scenario - 06.06.2013

Oh okay, that makes sense. It's getting late here, maybe I should go to sleep...

Thanks anyways, but it seems I don't even need to do this now.