GetPVarType

From SA-MP Wiki

Jump to: navigation, search


Gets the type of a Player Variable.


Parameters:
(playerid, varname[])
playeridThe ID of the player whose player variable you're getting the type of.
varnameThe name of the player variable.
ReturnsReturns 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.
  • GetPVarString: Get the previously set string from a player variable.
  • GetPVarFloat: Get the previously set float from a player variable.
Personal tools
In other languages