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=619500)



onplayerclicktextdraw - MrCesar - 18.10.2016

Hey, I got this:
Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
	if(_:clickedid != INVALID_TEXT_DRAW)  
	{
		if(clickedid == Textdraw35) 
		{
		    if(IsPlayerInRangeOfPoint(playerid, 5, 2503.34814, 63.47102, 51.74720) && eStatus == false)
		    {
					MoveDynamicObject(elevatorclosedright, 2501.55591, 63.58260, 51.73350, 2.9);
	    			MoveDynamicObject(elevatorclosedleft, 2505.2759, 67.3250, 51.7335, 2.9);
	    			SendClientMessage(playerid, COLOR_RED, "You have opened elevator doors");
	    			eStatus = true;
	    		
			}
		}
		else if(clickedid == Textdraw36)
		{
  			if(IsPlayerInRangeOfPoint(playerid, 5, 2503.34814, 63.47102, 51.74720) && eStatus == true)
   			{
				MoveDynamicObject(elevatorclosedright, 2503.27588, 63.58260, 51.73350, 2.9);
				MoveDynamicObject(elevatorclosedleft, 2503.2959, 67.3250, 51.7335, 2.9);
 				eStatus = false;
			}
		}
		else if(clickedid == Textdraw37)
		{
  			TextDrawHideForPlayer(playerid, Textdraw22);
   			TextDrawHideForPlayer(playerid, Textdraw23);
			TextDrawHideForPlayer(playerid, Textdraw24);
 			TextDrawHideForPlayer(playerid, Textdraw25);
  			TextDrawHideForPlayer(playerid, Textdraw26);
   			TextDrawHideForPlayer(playerid, Textdraw27);
	    	TextDrawHideForPlayer(playerid, Textdraw28);
    		TextDrawHideForPlayer(playerid, Textdraw29);
	    	TextDrawHideForPlayer(playerid, Textdraw30);
	    	TextDrawHideForPlayer(playerid, Textdraw31);
	    	TextDrawHideForPlayer(playerid, Textdraw32);
	    	TextDrawHideForPlayer(playerid, Textdraw33);
    		TextDrawHideForPlayer(playerid, Textdraw34);
	    	TextDrawHideForPlayer(playerid, Textdraw35);
	    	TextDrawHideForPlayer(playerid, Textdraw36);
	    	TextDrawHideForPlayer(playerid, Textdraw37);
		}
		TextDrawHideForPlayer(playerid, Textdraw22);
 		TextDrawHideForPlayer(playerid, Textdraw23);
		TextDrawHideForPlayer(playerid, Textdraw24);
 		TextDrawHideForPlayer(playerid, Textdraw25);
  		TextDrawHideForPlayer(playerid, Textdraw26);
   		TextDrawHideForPlayer(playerid, Textdraw27);
   		TextDrawHideForPlayer(playerid, Textdraw28);
   		TextDrawHideForPlayer(playerid, Textdraw29);
    	TextDrawHideForPlayer(playerid, Textdraw30);
    	TextDrawHideForPlayer(playerid, Textdraw31);
    	TextDrawHideForPlayer(playerid, Textdraw32);
    	TextDrawHideForPlayer(playerid, Textdraw33);
   		TextDrawHideForPlayer(playerid, Textdraw34);
    	TextDrawHideForPlayer(playerid, Textdraw35);
    	TextDrawHideForPlayer(playerid, Textdraw36);
    	TextDrawHideForPlayer(playerid, Textdraw37);
		CancelSelectTextDraw(playerid); // This will indeed call OnPlayerClickTextDraw again, but with an ID of 65535. The code above stops it from resulting in an eternal loop.
	}
	return 1;
}
it compiles fine but doesnt respond in game, i don't know where is the mistake tho


EDIT: only the "open" doors function works, and why does it mark everything when I hover my mouse over the options with like this?
Код:
SelectTextDraw(playerid, COLOR_ORANGE);



Re: onplayerclicktextdraw - ThatFag - 18.10.2016

Код:
 if(_:clickedid != INVALID_TEXT_DRAW)
to

Код:
if(clickedid != INVALID_TEXT_DRAW)
??


Re: onplayerclicktextdraw - MrCesar - 18.10.2016

Quote:
Originally Posted by ThatFag
Посмотреть сообщение
Код:
 if(_:clickedid != INVALID_TEXT_DRAW)
to

Код:
if(clickedid != INVALID_TEXT_DRAW)
??
Код:
warning 213: tag mismatch



Re: onplayerclicktextdraw - ThatFag - 18.10.2016

Код:
if(clickedid !== INVALID_TEXT_DRAW)



Re: onplayerclicktextdraw - Micko123 - 18.10.2016

Just add this
PHP код:
SelectTextDraw(playerid0xFFFFFFFF); 
Add it where it opens your textdraws..


Re: onplayerclicktextdraw - MrCesar - 18.10.2016

Quote:
Originally Posted by ThatFag
Посмотреть сообщение
Код:
if(clickedid !== INVALID_TEXT_DRAW)
this game me 4 error lines:
Код:
C:\Users\Shani\Desktop\Anonymous Creek Roleplay\gamemodes\ANO.pwn(2721) : error 029: invalid expression, assumed zero
C:\Users\Shani\Desktop\Anonymous Creek Roleplay\gamemodes\ANO.pwn(2721) : warning 215: expression has no effect
C:\Users\Shani\Desktop\Anonymous Creek Roleplay\gamemodes\ANO.pwn(2721) : error 001: expected token: ";", but found ")"
C:\Users\Shani\Desktop\Anonymous Creek Roleplay\gamemodes\ANO.pwn(2721) : error 029: invalid expression, assumed zero
C:\Users\Shani\Desktop\Anonymous Creek Roleplay\gamemodes\ANO.pwn(2721) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Quote:
Originally Posted by Micko123
Посмотреть сообщение
Just add this
PHP код:
SelectTextDraw(playerid0xFFFFFFFF); 
Add it where it opens your textdraws..

lol the idea is to color it :/


Re: onplayerclicktextdraw - Micko123 - 18.10.2016

Dude first of all. This
PHP код:
if(clickedid !== INVALID_TEXT_DRAW
DOES NOT EXIST!!!!!!!!

Second of all did you try my option??

If you did problem might be at creating your TextDraws. Show me your TextDraws that should be clickable..


Re: onplayerclicktextdraw - MrCesar - 18.10.2016

Quote:
Originally Posted by MrCesar
Посмотреть сообщение
this gave me 4 error lines:
Код:
C:\Users\Shani\Desktop\Anonymous Creek Roleplay\gamemodes\ANO.pwn(2721) : error 029: invalid expression, assumed zero
C:\Users\Shani\Desktop\Anonymous Creek Roleplay\gamemodes\ANO.pwn(2721) : warning 215: expression has no effect
C:\Users\Shani\Desktop\Anonymous Creek Roleplay\gamemodes\ANO.pwn(2721) : error 001: expected token: ";", but found ")"
C:\Users\Shani\Desktop\Anonymous Creek Roleplay\gamemodes\ANO.pwn(2721) : error 029: invalid expression, assumed zero
C:\Users\Shani\Desktop\Anonymous Creek Roleplay\gamemodes\ANO.pwn(2721) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



lol the idea is to color it :/
but it doesnt respond to functions, no matter where i click lol, only executes the 1st function which is to open the doors, it doesnt close or anything


Re: onplayerclicktextdraw - Micko123 - 18.10.2016

Lets do it link this. Explain me in details how many buttons you have and what every button should do..


Re: onplayerclicktextdraw - MrCesar - 18.10.2016

It has 6 buttons, fl1, fl2, roof, open doors, close doors, and exit the gui..
it's basically an elevator system lol

here are the two buttons I am using at the script I posted:
Код:
Textdraw35 = TextDrawCreate(458.666625, 257.706756, "open");
	TextDrawLetterSize(Textdraw35, 0.234761, 0.806400);
	TextDrawAlignment(Textdraw35, 1);
	TextDrawColor(Textdraw35, -1);
	TextDrawSetShadow(Textdraw35, 0);
	TextDrawSetOutline(Textdraw35, 1);
	TextDrawBackgroundColor(Textdraw35, 51);
	TextDrawFont(Textdraw35, 2);
	TextDrawSetProportional(Textdraw35, 1);
	

	Textdraw36 = TextDrawCreate(497.761718, 257.426757, "close");
	TextDrawLetterSize(Textdraw36, 0.234761, 0.806400);
	TextDrawAlignment(Textdraw36, 1);
	TextDrawColor(Textdraw36, -1);
	TextDrawSetShadow(Textdraw36, 0);
	TextDrawSetOutline(Textdraw36, 1);
	TextDrawBackgroundColor(Textdraw36, 51);
	TextDrawFont(Textdraw36, 2);
	TextDrawSetProportional(Textdraw36, 1);
on the bottom of them I have this:
Код:
TextDrawSetSelectable(Textdraw35, true); // open doors
	TextDrawSetSelectable(Textdraw36, true); // close doors