this not working. where to put? - 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: this not working. where to put? (
/showthread.php?tid=337965)
this not working. where to put? -
TheDiscussionCafe - 28.04.2012
i have this:
pawn Код:
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?
Re: this not working. where to put? -
Niko_boy - 28.04.2012
put this some where at last of your script thats it
and then you have to use it
in like
pawn Код:
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
}
Re: this not working. where to put? -
TheDiscussionCafe - 28.04.2012
okay so i put
pawn Код:
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?
Re: this not working. where to put? -
TheDiscussionCafe - 28.04.2012
help?
Re: this not working. where to put? -
Rudy_ - 28.04.2012
any errors?
Re: this not working. where to put? -
Rudy_ - 28.04.2012
try this
pawn Код:
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;
}
Re: this not working. where to put? -
TheDiscussionCafe - 28.04.2012
Quote:
Originally Posted by Rudy_
try this
pawn Код:
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!
Re: this not working. where to put? -
Rudy_ - 28.04.2012
Np....