GetPVarString

From SA-MP Wiki

Revision as of 12:32, 2 August 2010; view current revision
←Older revision | Newer revision→
Jump to: navigation, search



Description:

Gets a player variable as a string.


Parameters:
(playerid, varname[], string_return[], len)
playeridThe ID of the player whose player variable you're getting.
varnameThe name of the player variable.
string_returnThe string to store the PVarString in, passed by reference.
lenNumber of cells the string has been assigned.

Return Values:

This function returns the length of player's PVarString.


public OnPlayerConnect(playerid,reason)
{
    new pmsg[128];
    GetPVarString(playerid, "msg", pmsg, 128);// Get the msg string from the PVar
    printf("Player Message: %s", pmsg);// will print 'Player Message: *message*'
    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 the previously set integer from a player variable.
  • GetPVarFloat: Get the previously set float from a player variable.
Personal tools