SA-MP Forums Archive
How to remove "_" from names in RP servers? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to remove "_" from names in RP servers? (/showthread.php?tid=207984)



How to remove "_" from names in RP servers? - Injector - 07.01.2011

Like while doing an Announcement from an Admin...

Code:
		new sendername[MAX_PLAYER_NAME];
		new msg[256];
		if (sscanf(params, "s", msg)) SendClientMessage(playerid, COLOR_RED, "USAGE: /ann [text]");
		else {
		    GetPlayerName(playerid, sendername, sizeof(sendername));
		    format(msg, sizeof(msg), "Announcement from %s: %s", sendername, msg);
		    SendClientMessageToAll(COLOR_LOCALMSG, msg);
		    }
		    }
	return 1;
}
How to remove "_" from message? Thanks!


Re: How to remove "_" from names in RP servers? - Alex_Valde - 07.01.2011

Use this:

pawn Code:
stock UnderscoreToSpaceName(playerid)
{
    new Name[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
        GetPlayerName(playerid, Name, sizeof(Name));
    }
    else
    {
        Name = "Disconnected/Nothing";
    }
    for(new name = 0; name < MAX_PLAYER_NAME; name++) if(Name[name] == '_') Name[name] = ' ';
    return Name;
}
So the command will look like this:


pawn Code:
new msg[256];
        if (sscanf(params, "s", msg)) SendClientMessage(playerid, COLOR_RED, "USAGE: /ann [text]");
        else {
            format(msg, sizeof(msg), "Announcement from %s: %s", UnderscoreToSpaceName(playerid), msg);
            SendClientMessageToAll(COLOR_LOCALMSG, msg);
            }
            }
    return 1;
}



Re: How to remove "_" from names in RP servers? - Injector - 07.01.2011

Thanks!!!


Re: How to remove "_" from names in RP servers? - Alex_Valde - 07.01.2011

Quote:
Originally Posted by Injector
View Post
Thanks!!!
No problem.