NEED HELP With VARAIABLE - Global
#10

Use
pawn Код:
SetPVarString(playerid, str[], string_return, len);
to store strings into player variables.

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;
}
Reply


Messages In This Thread
NEED HELP With VARAIABLE - Global - by Micheal_ - 11.07.2011, 15:20
Re: NEED HELP With VARAIABLE - Global - by Micheal_ - 11.07.2011, 16:08
Re: NEED HELP With VARAIABLE - Global - by [GTA]AmericanGangster - 11.07.2011, 16:10
Re: NEED HELP With VARAIABLE - Global - by Micheal_ - 11.07.2011, 16:16
Re: NEED HELP With VARAIABLE - Global - by [GTA]AmericanGangster - 11.07.2011, 16:19
Re: NEED HELP With VARAIABLE - Global - by Adil - 11.07.2011, 16:27
Re: NEED HELP With VARAIABLE - Global - by Micheal_ - 11.07.2011, 16:30
Re: NEED HELP With VARAIABLE - Global - by Adil - 11.07.2011, 16:33
Re: NEED HELP With VARAIABLE - Global - by Micheal_ - 11.07.2011, 17:23
Re: NEED HELP With VARAIABLE - Global - by BigETI - 11.07.2011, 17:41

Forum Jump:


Users browsing this thread: 1 Guest(s)