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



OnPlayerClickTextDraw - Gangasta300 - 05.04.2013

Yo,
Is it possible to disable ESC button until OnPlayerSpawn?
I need this coz I made selectable textdraw as login... and when someone presses esc he cant select anymore.


Re: OnPlayerClickTextDraw - Azazelo - 05.04.2013

Why you not try this:

When they press ESC and if they not logged in then show the drawn next time if they do this more then 3 time kick.


Re: OnPlayerClickTextDraw - MP2 - 05.04.2013

OnPlayerClickTextDraw gets called with INVALID_TEXT_DRAW. Do note however, OnPlayerClickPLAYERTextDraw is NOT.


Re: OnPlayerClickTextDraw - Pottus - 05.04.2013

Really easy to fix do something like this....

Code:
new bool:CloseTextDraw[MAX_PLAYERS];

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
	// Close code
	if(Text:INVALID_TEXT_DRAW == clickedid)
	{
	        if(!CloseTextDraw[playerid])  SelectTextDraw(playerid, 0x00FF00FF);
                else 
                {
                    HideTextDraws(playerid);
                    CloseTextDraw[playerid] = false;
                 }
	}

        // Close Click
	if(Text:Close_Click == clickedid)
        {
               CloseTextDraw[playerid] = true;
               CancelSelectTextDraw(playerid);
        }

HideTextDraws(playerid)
{
     TextDrawHideForPlayer(playerid, MyDraw);
}

}



Re: OnPlayerClickTextDraw - Gangasta300 - 05.04.2013

Quote:
Originally Posted by MP2
View Post
OnPlayerClickTextDraw gets called with INVALID_TEXT_DRAW. Do note however, OnPlayerClickPLAYERTextDraw is NOT.
And what is the difference between those two?
only that one is called with INVALID_TEXT_DRAW and another is not?


Re: OnPlayerClickTextDraw - Pottus - 05.04.2013

Gangasta: That would be correct.

The difference is one is for player textdraws the other is for standard global textdraws both can be intermixed and even if your only using player textdraws OnPlayerClickTextDraw() will still be called when cancelling your textdraw selection or pressing esc.


Re: OnPlayerClickTextDraw - Gangasta300 - 05.04.2013

Quote:
Originally Posted by [uL]Pottus
View Post
Gangasta: That would be correct.

The difference is one is for player textdraws the other is for standard global textdraws both can be intermixed and even if your only using player textdraws OnPlayerClickTextDraw() will still be called when cancelling your textdraw selection or pressing esc.
so should I use your script or OnPlayerClickPlayerTextDraw?


Re: OnPlayerClickTextDraw - Pottus - 05.04.2013

My script will prevent any clickable textdraws from closing player textdraws and global textdraws alike by pressing escape it will only close when you do these lines which can actually be done anywhere in the script.

CloseTextDraw[playerid] = true;
CancelSelectTextDraw(playerid);


Re: OnPlayerClickTextDraw - Gangasta300 - 05.04.2013

I have set my login textdraws to OnPlayerClickPlayerTextDraw but when I click ESC it still Canceles select.


Re: OnPlayerClickTextDraw - Pottus - 05.04.2013

You need to this as well!

Code:
new bool:CloseTextDraw[MAX_PLAYERS];

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
	// Close code
	if(Text:INVALID_TEXT_DRAW == clickedid)
	{
	        if(!CloseTextDraw[playerid])  SelectTextDraw(playerid, 0x00FF00FF);
                else 
                {
                    HideTextDraws(playerid);
                    CloseTextDraw[playerid] = false;
                 }
	}

        // Close Click you can remove this
	if(Text:Close_Click == clickedid)
        {
               // These two lines will close the textdraw put them where you need them in your script!
               CloseTextDraw[playerid] = true;
               CancelSelectTextDraw(playerid);
        }
}