SA-MP Forums Archive
Little problem. - 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: Little problem. (/showthread.php?tid=568719)



Little problem. - AlterEGO - 24.03.2015

Hey, It's been my second time today but..
I'm trying to remove the underscore in the WHOLE string,
Like any other roleplay script, Ive been trying few guides But I can't get it to work.
Can someone explain to me what to do carefully, or just help me to script it.
If it can come in a filterscript it will help, Thanks in advance.


Re: Little problem. - JaydenJason - 24.03.2015

Код:
stock GetRPName(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;
}
You'll have to use GetRPName instead of GetPlayerName if you want to remove underscores, just stick this anywhere in your game mode


Re: Little problem. - fuckingcruse - 24.03.2015

Cool one jaydenJason bhai


Re: Little problem. - zork - 24.03.2015

Lighter one:
PHP код:
stock GetName(playerid)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    
name[strfind(name,"_")] = ' ';
    return 
name;




Re: Little problem. - AlterEGO - 29.03.2015

I don't understand where Do I put it? Cus it aint working


Re: Little problem. - ATGOggy - 29.03.2015

Just put this:
PHP код:
stock GetRPName(playerid)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    for(new 
0MAX_PLAYER_NAMEi++)
    {
        if(
name[i] == '_'name[i] = ' ';
    }
    return 
name;

anywhere in the script.


Re: Little problem. - JaydenJason - 29.03.2015

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
Just put this:
PHP код:
stock GetRPName(playerid)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    for(new 
0MAX_PLAYER_NAMEi++)
    {
        if(
name[i] == '_'name[i] = ' ';
    }
    return 
name;

anywhere in the script.
Thanks for the credits


Re: Little problem. - CalvinC - 29.03.2015

And then use it by doing something like this:
pawn Код:
format(string, sizeof(string), "%s", GetRPName(playerid));



Re: Little problem. - AlterEGO - 29.03.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
And then use it by doing something like this:
pawn Код:
format(string, sizeof(string), "%s", GetRPName(playerid));
Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
Thanks for the credits
Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
Just put this:
PHP код:
stock GetRPName(playerid)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    for(new 
0MAX_PLAYER_NAMEi++)
    {
        if(
name[i] == '_'name[i] = ' ';
    }
    return 
name;

anywhere in the script.
Quote:
Originally Posted by zork
Посмотреть сообщение
Lighter one:
PHP код:
stock GetName(playerid)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    
name[strfind(name,"_")] = ' ';
    return 
name;

Y'all helped me a lot! Thank you!