SA-MP Forums Archive
how to change the player's name on spawn? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: how to change the player's name on spawn? (/showthread.php?tid=649342)



how to change the player's name on spawn? - wallen - 07.02.2018

Well i want to make something like, we got respect so when player spawns it will change his name to 00_[SN]Wallen for example, just adds 00_ which are his total respect points (pInfo[playerid][Respect]). I've already checked samp forums and found the function "SetPlayerName" but i can't use the format and i can't add the respect points before the player's nickname like i stated before. Any helps?


Re: how to change the player's name on spawn? - JasonRiggs - 07.02.2018

this would help you..


Re: how to change the player's name on spawn? - solstice_ - 07.02.2018

PHP код:
public OnPlayerSpawn(playerid)
{
    new 
pName[MAX_PLAYER_NAME+1];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
strins(pName"%d_"pInfo[playerid][pRespect]);
    
SetPlayerName(playeridpName);

Not sure if it works, took it from here


Re: how to change the player's name on spawn? - JasonRiggs - 07.02.2018

Quote:
Originally Posted by willbedie
Посмотреть сообщение
PHP код:
public OnPlayerSpawn(playerid)
{
    new 
pName[MAX_PLAYER_NAME+1];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
strins(pName"%d_"pInfo[playerid][pRespect]);
    
SetPlayerName(playeridpName);

Not sure if it works, took it from here
Stop feeding people in mouth to get reps! Try to make them learn..


Re: how to change the player's name on spawn? - solstice_ - 07.02.2018

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
Stop feeding people in mouth to get reps! Try to make them learn..
I don't care for reps lmao i just want to help people, if i cared for reps i would make a lot of filtersciprts or post shit everyday, just fuck off.


Re: how to change the player's name on spawn? - JasonRiggs - 07.02.2018

Quote:
Originally Posted by willbedie
Посмотреть сообщение
I don't care for reps lmao i just want to help people, if i cared for reps i would make a lot of filtersciprts or post shit everyday, just fuck off.
You aren't helping people like that, retarded it might gelp him now, but won't help him in future, fuck sakes.


Re: how to change the player's name on spawn? - wallen - 07.02.2018

Oh yeah but anyway thanks for the help, i know how to use formats so strins is somehow like these, dont make a drama over this xD


Re: how to change the player's name on spawn? - solstice_ - 07.02.2018

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
You aren't helping people like that, retarded it might gelp him now, but won't help him in future, fuck sakes.
That's just a small and easy code, how am i supposed to say it to them? Just stop quoting me, i don't like to talk to you bye


Re: how to change the player's name on spawn? - wallen - 07.02.2018

I've tried do what you said, and yeah its not even adding anything before my name.

PHP код:
    new pName[MAX_PLAYER_NAME+1];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
strins(pName"%i_"pInfo[playerid][Respect]);
    
SetPlayerName(playeridpName); 



Re: how to change the player's name on spawn? - Mugala - 08.02.2018

for first, you have to save player's real name or just filter it.
when player receives or gives point, just add the name changing script.
for example, let's start with name saving.

at the top we're adding a name variable, like this new RealName[MAX_PLAYERS];
than we're saving a name as a variable, when a player connects
PHP код:
OnPlayerConnect(playerid)
{
    
GetPlayerName(playerid,RealName[playerid],28); 
so we have a real name now.
okay now we need to change a player's name when he receives or losts a points.
PHP код:
new name[28];
format(name,28,"%d_%s",pInfo[playerid][pRespect],RealName[playerid]);
SetPlayerName(playerid,name);