Underscores
#1

Hello, I got a problem, I'm not very good at scripting and still learning but.. How do I fix this? When I remove underscores it works for playerid, but with giveplayerid it bugs, sends messages to the wrong players etc or wrong names

Код:
stock RemoveUnderScore(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;
}

stock RPN(giveplayerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(giveplayerid,name,sizeof(name));
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}
That's what I got to remove underscores.

Example of a command;

Код:
	if(strcmp(cmd, "/freeze", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /freeze [playerid/PartOfName]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if(PlayerInfo[playerid][pAdmin] >= 2)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
				        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						TogglePlayerControllable(playa, 0);
						PlayerFrozen[playerid] = 1;
						format(string, sizeof(string), "{FF0000}Server action{FF0000}: You have been frozen by an Admin %s.",RemoveUnderScore(playerid));
						SendClientMessage(giveplayerid, COLOR_RED, string);
						format(string, sizeof(string), "{FF0000}Server action{FF0000}: You have frozen %s.", RPN(giveplayerid));
						SendClientMessage(playerid, COLOR_RED, string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
			}
		}
		return 1;
	}
The message supposed to go at the reciever gets sent to me, and it gives my name on all..
Reply


Messages In This Thread
Underscores - by whando - 01.06.2013, 22:50
Re: Underscores - by Vince - 01.06.2013, 22:56
Re: Underscores - by whando - 01.06.2013, 23:13
Re: Underscores - by Scenario - 01.06.2013, 23:18
Re: Underscores - by whando - 01.06.2013, 23:25
Re: Underscores - by Jefff - 02.06.2013, 00:18
Re: Underscores - by whando - 02.06.2013, 00:41
Re: Underscores - by Jefff - 02.06.2013, 00:42
Re: Underscores - by whando - 02.06.2013, 00:46

Forum Jump:


Users browsing this thread: 1 Guest(s)