Closed nnsdev closed 4 years ago
What does get
and getDefault
return in game? From the API given it seems like that this methods are just methods of a simple key-value-pair-object.
Btw. Aren't you missing the set
method?
It returns strings, at least for this value I have tried. However, I do not know if it potentially returns numbers on other label strings, because I do not know other labels to try.
set
= add
, as far as I can tell. 1.0 Changelog only referenced these methods
Added: Client-side: mp.game.gxt.add(labelNameOrHash, newLabelValue) Added: Client-side: mp.game.gxt.get(labelNameOrHash) Added: Client-side: mp.game.gxt.getDefault(labelNameOrHash) Added: Client-side: mp.game.gxt.reset()
However, I do not know if it potentially returns numbers on other label strings, because I do not know other labels to try.
Well, you could try adding a label with a number as a value. Either you can set a number or not. You'll probably will get an error by doing so.
However, if you can set a number check if the get
method returns a number aswell by using the same key. This would justify using any
. Otherwise we should use string
, because it is more specific and type-safe.
set = add, as far as I can tell. 1.0 Changelog only referenced these methods
Oh okay. You wrote in your description set
. Nvm.
Okay looking at this file: https://gist.githubusercontent.com/alloc8or/057e4d573cdfe238db31ec5edf2efbbb/raw/a8831b6c39292f7b4769fa6a183c8bbdb7fb1273/GTAV_All_Text_Labels_1737.txt
Going by this file, I am going to assume that the types are all just strings?
Going by this file, I am going to assume that the types are all just strings?
I would say so, but we should prove it to be sure.
Okay seems like .add(irrelevant, number)
sets it to the default, which means only strings are accepted.
And what is the default? An empty ""
?
For the one I have tried, it'd technically be "Grand Theft Auto V" (which is what the getDefault
returns), however RAGE overwrites it to "RAGE Multiplayer" by default
Alright, then we should change it to the return type string
.
get
andgetDefault
currently haveany
assigned to them, because I am not sure what those return, I have not gotten around to test it in-depth yet.Only thing I got to test so far is
mp.game.gxt.add("PM_PAUSE_HDR", "Content");
which would mean thegetDefault
andget
would return a string, however I am not sure if that is potentially the only type that this can return, so any will do for now.