Surname of nick
#1

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);
Reply
#2

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);
    }
}
Reply
#3

Hahahhaaaaaaaa, thankk youuuuuuu very much...
Reply
#4

And could you do the same for:

1) GetPlayerName(playerid);
2) SetPlayerName(playerid, name);


or without surname?
Reply
#5

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);
    }
}
Reply
#6

ehhh, thank you very much, thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)