GetPlayerVersion

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 18:26, 19 May 2015
Seanny (Talk | contribs)

← Previous diff
Current revision
OstGot (Talk | contribs)

Line 9: Line 9:
{{Param|len|The maximum length of the version.}} {{Param|len|The maximum length of the version.}}
-{{Return|'''1''' on success and '''0''' on failure.}}+{{Return|'''1''' on success and '''0''' on failure (if player specified doesn't exist).
 +* The client version is stored in the specified array.}}
{{Note2|The string the version gets stored in will be empty if playerid is an NPC.}} {{Note2|The string the version gets stored in will be empty if playerid is an NPC.}}
 +{{Example}}
<pawn> <pawn>
public OnPlayerConnect(playerid) public OnPlayerConnect(playerid)

Current revision


GetPlayerVersion was added in SA-MP 0.3e This function was added in SA-MP 0.3e and will not work in earlier versions!


Description:

Returns the SA-MP client version, as reported by the player.


Parameters:
(playerid, version[], len)
playeridThe ID of the player to get the client version of.
version[]The string to store the player's version in, passed by reference.
lenThe maximum length of the version.


Return Values:

1 on success and 0 on failure (if player specified doesn't exist).
  • The client version is stored in the specified array.


Image:32px-Circle-style-warning.png

Important
Note

The string the version gets stored in will be empty if playerid is an NPC.


Example Usage:

public OnPlayerConnect(playerid)
{
    new string[40];
    GetPlayerVersion(playerid, string, sizeof(string));
    format(string, sizeof(string), "Your version of SA-MP: %s", string);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    // possible text: "Your version of SA-MP: 0.3.7"
    return 1;
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.

Personal tools
In other languages