STRING_TO_INT
Returns false if it's a null or empty string or if the string is too long.
Hash
0xF2DD2298B3AF23E2Runtime name
StringToIntNamespaceMISC
SideClient
NameOfficial
Docs
Since build1207
GTA V hash
0x5A5F40FE637EB584Signature
BOOL STRING_TO_INT(const char* string, int* outInteger);Parameters
| Name | Type | Description |
|---|---|---|
string | const char* | — |
outInteger | int* | — |
Returns BOOL
Description
Returns false if it's a null or empty string or if the string is too long. outInteger will be set to -999 in that case.
Usage
local retval, outInteger = StringToInt(string, outInteger)
-- always works, by hash
local retval, outInteger = Citizen.InvokeNative(0xF2DD2298B3AF23E2, string, Citizen.PointerValueIntInitialized(outInteger), Citizen.ReturnResultAnyway())JavaScript and C#
const [retval, outInteger] = StringToInt(string, outInteger);
// by hash
const [retval, outInteger] = Citizen.invokeNative('0xF2DD2298B3AF23E2', string, Citizen.pointerValueIntInitialized(outInteger), Citizen.returnResultAnyway());var outInteger = new OutputArgument();
bool retval = Function.Call<bool>((Hash)0xF2DD2298B3AF23E2, string, outInteger);
// outInteger.GetResult<int>()- The last argument is an in/out pointer: pass its initial value, and the updated value is returned after the result.
Sources
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.