PDA

View Full Version : this not working. where to put?


TheDiscussionCafe
28/04/2012, 02:31 PM
i have this:stock GetName(playerid)
{
new
name[24];
GetPlayerName(playerid, name, sizeof(name));
strreplace(name, '_', ' ');
return name;
}

i have roleplay server. when people name like this: Firstname_lastname , it will remove the "_" from the names so it would look like Firstname lastname . but it not working. i put at the end of my script nothing happens?

Niko_boy
28/04/2012, 02:33 PM
put this some where at last of your script thats it
and then you have to use it
in like

public OnPlayerText(playerid , text[])
{
new string[128];
format(string ,sizeof(string) , "[%s]: %s",GetName(playerid),text))
SendClientMessageToAll(-1,string);// this will send a white colored message
}

TheDiscussionCafe
28/04/2012, 02:38 PM
okay so i put stock GetName(playerid)
{
new
name[24];
GetPlayerName(playerid, name, sizeof(name));
strreplace(name, '_', ' ');
return name;
} at end of script at the bottom and what else do i add, edit, or remove?

TheDiscussionCafe
28/04/2012, 04:13 PM
help?

Rudy_
28/04/2012, 04:25 PM
any errors?

Rudy_
28/04/2012, 04:28 PM
try this

stock UnderScore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}

public OnPlayerText(playerid,text[])
{
new string[128];
format(string,sizeof(string),"%s: %s", UnderScore(playerid),text);
SendClientMessageToAll(color,string);
return 0;
}

TheDiscussionCafe
28/04/2012, 04:54 PM
try this

stock UnderScore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}

public OnPlayerText(playerid,text[])
{
new string[128];
format(string,sizeof(string),"%s: %s", UnderScore(playerid),text);
SendClientMessageToAll(color,string);
return 0;
}

workings! thanks!

Rudy_
28/04/2012, 05:05 PM
Np....