11.07.2011, 17:41
Use
to store strings into player variables.
Example:
pawn Код:
SetPVarString(playerid, str[], string_return, len);
Example:
pawn Код:
public OnPlayerConnect(playerid)
{
pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
SetPVarString(playerid, "RealName", pname); //Here we'll store the real nick name into a pvar.
return 1;
}
//Somewhere in your script you can change his/her name without changing our player variable
//After this we can use the player variable on any prints (Example: A SendClientMessageToAll func in OnPlayerDisconnect)
public OnPlayerDisconnect(playerid, reason)
{
new pname[MAX_PLAYER_NAME], str[128];
GetPVarString(playerid, "RealName", pname, sizeof(pname)); //here we'll get the real nick name from pvar.
format(str, sizeof(str), "%d %s has left the server.", playerid, pname);
SendClientMessageToAll(0x999999, str);
return 1;
}