Repost: RP Name help
#1

Note: I posted this before, but people seem to stop replying, and i still need help
Hello guys, i made this function to return the player name without the "_" but it returns nothing at all

Here's the code
PHP код:
stock RPname(playerid) { 
    new 
playerName[MAX_PLAYER_NAME]; 
    
GetPlayerName(playeridplayerNamesizeof(playerName)); 
    new 
RName[MAX_PLAYER_NAME]; 
    for(new 
0strlen(Name(playerid)); i++) { 
        if(!
strcmp(playerName[i], "_"true)) { 
            
strins(RName" "strlen(RName)); 
        } 
        else { 
            
strcat(RNameplayerName[i], strlen(RName)); 
        } 
    } 
    return 
RName

What's wrong here?
Reply
#2

uhm, i cant bother reading that code, you could've easily done this:

PHP код:
rpname(playerid) {
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof name);
    for(new 
charEx 0charEx strlen(name); charEx++)
        if(
name[charEx] == '_')
         
name[charEx] = ' ';
    return 
name;

simple ye?
Reply
#3

Quote:
Originally Posted by Meller
Посмотреть сообщение
uhm, i cant bother reading that code, you could've easily done this:

PHP код:
rpname(playerid) {
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof name);
    for(new 
charEx 0charEx strlen(name); charEx++)
        if(
name[charEx] == '_')
         
name[charEx] = ' ';
    return 
name;

simple ye?
I did that ands it's not working for me.
Reply
#4

Код:
stock Name(playerid)
{
	new Role_Play_Name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, Role_Play_Name, sizeof(Role_Play_Name));

	for(new i = 0; i < MAX_PLAYER_NAME; i++) // By.: Gentleman
	{
   		if(Role_Play_Name[i] == '_')
   		{
        	Role_Play_Name[i] = ' ';
   		}
	}

	return Role_Play_Name;
}
Reply
#5

Quote:
Originally Posted by Arbico
Посмотреть сообщение
I did that ands it's not working for me.





Then you did something wrong.
Reply
#6

We already told you what's the error.
You forgot the %s specifier in your format function, before the SendClientMessage function.
Reply
#7

meller whats that text editor i really want it?
Atom?
Reply
#8

Quote:
Originally Posted by n00blek
Посмотреть сообщение
meller whats that text editor i really want it?
Atom?
https://www.sublimetext.com/
https://sampforum.blast.hk/showthread.php?tid=511195
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)