SA-MP Forums Archive
message flooding bug.. - 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: message flooding bug.. (/showthread.php?tid=591460)



message flooding bug.. - Karolukas123 - 12.10.2015

Hey again need help...

VIDEO:
https://*********/WUqOK94zlgA

Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
	if(clickedid == Darbo_TD[playerid][6])
	{
		SendClientMessage(playerid, -1, "Press button");
		CancelSelectTextDraw(playerid);
		for(new s = 0; s < 15; s++) TextDrawHideForPlayer(playerid, Darbo_TD[playerid][s]);
		return 1;
	}
 	else if(clickedid == Text:INVALID_TEXT_DRAW)
	{
		SendClientMessage(playerid, -1, "Press Esc");
		CancelSelectTextDraw(playerid);
		for(new s = 0; s < 15; s++) TextDrawHideForPlayer(playerid, Darbo_TD[playerid][s]);
		return 1;
	}
	return 1;



Re: message flooding bug.. - ZeMuNaC - 12.10.2015

Try.
Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
	if(clickedid == Darbo_TD[playerid][6])
	{
		CancelSelectTextDraw(playerid);
		for(new s = 0; s < 15; s++) TextDrawHideForPlayer(playerid, Darbo_TD[playerid][s]);
                SendClientMessage(playerid, -1, "Press button");
		return 1;
	}
 	else if(clickedid == Text:INVALID_TEXT_DRAW)
	{
		CancelSelectTextDraw(playerid);
		for(new s = 0; s < 15; s++) TextDrawHideForPlayer(playerid, Darbo_TD[playerid][s]);
                SendClientMessage(playerid, -1, "Press Esc");
		return 1;
	}
	return 1;
        }



Re: message flooding bug.. - Karolukas123 - 12.10.2015

ZeMunaC no still flooding


Re: message flooding bug.. - jlalt - 12.10.2015

you don't need else
PHP код:
public OnPlayerClickTextDraw(playeridText:clickedid)
{
    if(
clickedid == Darbo_TD[playerid][6])
    {
        
CancelSelectTextDraw(playerid);
        for(new 
015s++) TextDrawHideForPlayer(playeridDarbo_TD[playerid][s]);
                
SendClientMessage(playerid, -1"Press button");
        return 
1;
    }
     if(
clickedid == Text:INVALID_TEXT_DRAW)
    {
        
CancelSelectTextDraw(playerid);
        for(new 
015s++) TextDrawHideForPlayer(playeridDarbo_TD[playerid][s]);
                
SendClientMessage(playerid, -1"Press Esc");
        return 
1;
    }
    return 
1;




Re: message flooding bug.. - Karolukas123 - 12.10.2015

jlalt still flooding


Re: message flooding bug.. - jlalt - 12.10.2015

may it cuz of this for(new.... try this one:
PHP код:
public OnPlayerClickTextDraw(playeridText:clickedid)
{
    if(
clickedid == Darbo_TD[playerid][6])
    {
        
CancelSelectTextDraw(playerid);
        
SendClientMessage(playerid, -1"Press button");
        for(new 
015s++) { TextDrawHideForPlayer(playeridDarbo_TD[playerid][s]); }
        return 
1;
    }
     if(
clickedid == Text:INVALID_TEXT_DRAW)
    {
        
CancelSelectTextDraw(playerid);
        
SendClientMessage(playerid, -1"Press Esc");
        for(new 
015s++) { TextDrawHideForPlayer(playeridDarbo_TD[playerid][s]); }
        return 
1;
    }
    return 
1;




Re: message flooding bug.. - ZeMuNaC - 12.10.2015

You can simply remove SendClientMessages,don't see reason why are you using them?


Re: message flooding bug.. - Karolukas123 - 12.10.2015

because, i need text.. and if i remove problem still here..


Re: message flooding bug.. - Vince - 12.10.2015

You must not use CancelSelectTextDraw if the clickedid is INVALID_TEXT_DRAW, because CancelSelectTextDraw calls OnPlayerClickTextdraw again with INVALID_TEXT_DRAW, thus creating an infinite loop. This is also outlined on the wiki page: https://sampwiki.blast.hk/wiki/CancelSelectTextDraw


Re: message flooding bug.. - Karolukas123 - 12.10.2015

Vince thanks.. its fixed.. but i dont know why if i press button its send 2 messages

Код:
SendClientMessage(playerid, -1, "Press Esc");

SendClientMessage(playerid, -1, "Press button");