Posts: 92
Threads: 26
Joined: Aug 2012
Reputation:
0
Hello all,
I'm interested in whether it is possible to change the server name only.
Example:
My name is Almir_Delic, whether it is possible to do now to change the Almir_%s.",text);,
and is it possible to take the name apart from the names of the players... exanmple GetPlayerSurname,
Actually I need this:
1) GetPlayerSurname(playerid);
2) SetPlayerSurname(playerid, surname);
Posts: 2,593
Threads: 34
Joined: Dec 2007
pawn Код:
GetPlayerSurname(playerid)
{
new Nick[MAX_PLAYER_NAME + 1], pos;
GetPlayerName(playerid,Nick,sizeof(Nick));
if((pos = strfind(Nick,"_",true)) != -1)
strdel(Nick,0,pos+1);
return Nick;
}
SetPlayerSurname(playerid, const surname[])
{
new Nick[MAX_PLAYER_NAME + 1], pos;
GetPlayerName(playerid,Nick,sizeof(Nick));
if((pos = strfind(Nick,"_",true)) != -1)
{
Nick[pos+1] = EOS;
strins(Nick, surname, pos+1); // or strcat(Nick[pos+1], surname, sizeof(Nick));
SetPlayerName(playerid, Nick);
}
}
Posts: 92
Threads: 26
Joined: Aug 2012
Reputation:
0
Hahahhaaaaaaaa, thankk youuuuuuu very much...
Posts: 92
Threads: 26
Joined: Aug 2012
Reputation:
0
And could you do the same for:
1) GetPlayerName(playerid);
2) SetPlayerName(playerid, name);
or without surname?
Posts: 2,593
Threads: 34
Joined: Dec 2007
pawn Код:
GetPlayerNameEx(playerid)
{
new Nick[MAX_PLAYER_NAME + 1], pos;
GetPlayerName(playerid,Nick,sizeof(Nick));
if((pos = strfind(Nick,"_",true)) != -1)
Nick[pos] = EOS;
return Nick;
}
SetPlayerNameEx(playerid, const name[])
{
new Nick[MAX_PLAYER_NAME + 1], pos;
GetPlayerName(playerid,Nick,sizeof(Nick));
if((pos = strfind(Nick,"_",true)) != -1)
{
strdel(Nick,0,pos);
strins(Nick, name, 0);
SetPlayerName(playerid, Nick);
}
}