Problem with string range
#7

Not tested, but this should fix it:

Код:
public OnPlayerText(playerid, text[])
{
    new message[128];
    new Float:Pos[3];
    if(AccInfo[playerid][Muted] == 0)
	{
        GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
        format(message, sizeof(message), "%s says: %s", GetRoleplayName(playerid), text);
        IC_ChatLog(message);
        SetPlayerChatBubble(playerid, text, 0xFFFFFF, 10.0, 3000);
        foreach(new i : Player)
		{
            if(IsPlayerInRangeOfPoint(i,10,Pos[0],Pos[1],Pos[2]))
			{
                format(message, sizeof(message), "{FFFFFF} %s", text);
                SendRPMessage(playerid,10,message);
                return 0;
            }
       		else if(IsPlayerInRangeOfPoint(i,20,Pos[0],Pos[1],Pos[2]))
			{
                format(message, sizeof(message), "{BABABA} %s", text);
                SendRPMessage(playerid,20,message);
                return 0;
            }
        }
    }
    else
	{
        Msg(playerid,COLOR_RED,"You are muted. You cannot speak");
        return 0;
    }
    return 0;
}
Tell me if it didn't though.

EDIT: Your problem is this:

Код:
            if(IsPlayerInRangeOfPoint(i,10,Pos[0],Pos[1],Pos[2]))
            {
                format(message, sizeof(message), "{FFFFFF} %s", text);
                SendRPMessage(playerid,10,message);
               
            }
       	    else if(IsPlayerInRangeOfPoint(i,20,Pos[0],Pos[1],Pos[2]))
	    {
                format(message, sizeof(message), "{BABABA} %s", text);
                SendRPMessage(playerid,20,message);
                
            }
Basically, the player will be in range of 10.0 and 20.0, because 10 is included in 20 , so you just have to end the loop at one of that, by adding return 0; to end it.
Reply


Messages In This Thread
Problem with string range - by TwinkiDaBoss - 04.01.2016, 22:11
Re: Problem with string range - by Lucky13 - 04.01.2016, 22:53
Re: Problem with string range - by TwinkiDaBoss - 04.01.2016, 23:13
Re: Problem with string range - by Lucky13 - 04.01.2016, 23:15
Re: Problem with string range - by TwinkiDaBoss - 05.01.2016, 14:45
Re: Problem with string range - by Lucky13 - 05.01.2016, 14:52
Re: Problem with string range - by Lucky13 - 05.01.2016, 14:54
Re: Problem with string range - by TwinkiDaBoss - 05.01.2016, 15:09
Re: Problem with string range - by Lucky13 - 05.01.2016, 15:18
Re: Problem with string range - by TwinkiDaBoss - 05.01.2016, 15:25

Forum Jump:


Users browsing this thread: 1 Guest(s)