GetPVarType
From SA-MP Wiki
Gets the type of a Player Variable.
(playerid, varname[])
| playerid | The ID of the player whose player variable you're getting the type of. |
| varname | The name of the player variable. |
| Returns | Returns the type of the PVar. |
public OnPlayerConnect(playerid) { SetPVarInt(playerid, "twenty", 20); SetPVarFloat(playerid, "twopoint4", 2.4); SetPVarString(playerid, "hellotext", "Hello"); printf("Null type: %d", GetPVarType(playerid, "nothinghere")); printf("Int type (%d): %d", GetPVarInt(playerid, "twenty"), GetPVarType(playerid, "twenty")); printf("Float type (%f): %d", GetPVarFloat(playerid, "twopoint4"), GetPVarType(playerid, "twopoint4")); new text[10]; GetPVarString(playerid, "hellotext", text, sizeof(text)); printf("String type (%s): %d", text, GetPVarType(playerid, "hellotext")); return 1; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- SetPVarInt: Set an integer for a player variable.
- GetPVarInt: Get a player variable as an integer.
- SetPVarString: Set a string for a player variable.
- GetPVarString: Get the previously set string from a player variable.
- SetPVarFloat: Set a float for a player variable.
- GetPVarFloat: Get the previously set float from a player variable.
- DeletePVar: Delete the player variable.
