SA-MP Forums Archive
Can someone tell me what it is ( _: ) - 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: Can someone tell me what it is ( _: ) (/showthread.php?tid=552011)



Can someone tell me what it is ( _: ) - RaeF - 22.12.2014

Hey can someone tell me what _: use for?


Re: Can someone tell me what it is ( _: ) - CalvinC - 22.12.2014

Depends on your script i guess?
Show where you've seen it or something, then we might be able to tell you.


Re: Can someone tell me what it is ( _: ) - Kyance - 22.12.2014

I've used that in a stock to get the distance between 2 players:

pawn Код:
stock GetDistance(playerid, targetid)
{
    new Float:tX, Float:tY, Float:tZ, Float:distance;
    GetPlayerPos(targetid, tX, tY, tZ), distance = GetPlayerDistanceFromPoint(playerid, tX, tY, tZ);
    return _:distance;
}
So I guess it returns floats?


Re: Can someone tell me what it is ( _: ) - Threshold - 22.12.2014

No, it doesn't return floats. Normally you would have to define that function as:
pawn Код:
stock Float:GetDistance(playerid, targetid)
Then you just 'return distance;', but '_:' lets the compiler determine the nature of the variable, whether it's a float or integer etc.

I'm not 100% sure, but I know that it allows you to treat floats as integers technically speaking... I'm probably not wording this right, but hopefully there's someone that can give you a better explanation.


Re: Can someone tell me what it is ( _: ) - Evocator - 22.12.2014

"_:" is used to eliminate pawno 213 warning.

pawn Код:
new Text3D:Forks; printf("%i", Forks); //tag mismatch
pawn Код:
new Text3D:Forks; printf("%i",_:Forks); //smooth



Re: Can someone tell me what it is ( _: ) - Vince - 22.12.2014

It's a tag override. It basically removes the tag of a variable if it has one. This is mostly used to get rid "argument type mismatch" warnings when variables with non-standard tags (e.g. Text:, Db_result:, ...) are passed to functions like format or CallLocalFunction.

If you look up the definition of those two functions you will notice that it has a parameter:
Код:
{Float,_}:...
This means that it accepts variables that are either Float or have no tag. Trying to pass any of the types mentioned above will result in a warning.


Re: Can someone tell me what it is ( _: ) - RaeF - 22.12.2014

Ok thank's all, now i understood +Rep for all