SA-MP Forums Archive
Clickable TextDraw help! - 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: Clickable TextDraw help! (/showthread.php?tid=462949)



Clickable TextDraw help! - Tuntun - 09.09.2013

I made a textdraw and i'm trying to make it clickable ... please help me

Errors:

Code:
E:\My server\gamemodes\Truck.pwn(1403) : warning 213: tag mismatch
E:\My server\gamemodes\Truck.pwn(3308) : error 017: undefined symbol "i"
E:\My server\gamemodes\Truck.pwn(3309) : error 017: undefined symbol "i"
E:\My server\gamemodes\Truck.pwn(3310) : error 017: undefined symbol "i"
E:\My server\gamemodes\Truck.pwn(3311) : error 017: undefined symbol "i"
E:\My server\gamemodes\Truck.pwn(3312) : error 017: undefined symbol "i"
E:\My server\gamemodes\Truck.pwn(3313) : error 017: undefined symbol "i"
E:\My server\gamemodes\Truck.pwn(3318) : warning 213: tag mismatch
E:\My server\gamemodes\Truck.pwn(3320) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
My codes:
Code:
CMD:credits(playerid,params[])
{
	TextDrawShowForPlayer(i, Textdraw0);
	TextDrawShowForPlayer(i, Textdraw1);
	TextDrawShowForPlayer(i, Textdraw2);
	TextDrawShowForPlayer(i, Textdraw3);
	TextDrawShowForPlayer(i, Textdraw4);
	TextDrawShowForPlayer(i, Textdraw5);
	return 1;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == 5)
    {
          TextDrawHideForPlayer(playerid, 5);
    }

    CancelSelectTextDraw(playerid);
    return 1;
}
Code:
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new Text:Textdraw3;
new Text:Textdraw4;
new Text:Textdraw5;
Code:
public OnGameModeInit()
{

	TextDrawSetSelectable(5, true);
	/// text
	Textdraw0 = TextDrawCreate(230.000000, 150.000000, "Our Sever Credits");
	TextDrawBackgroundColor(Textdraw0, 255);
	TextDrawFont(Textdraw0, 1);
	TextDrawLetterSize(Textdraw0, 0.500000, 1.000000);
	TextDrawColor(Textdraw0, -1);
	TextDrawSetOutline(Textdraw0, 1);
	TextDrawSetProportional(Textdraw0, 1);
	TextDrawUseBox(Textdraw0, 1);
	TextDrawBoxColor(Textdraw0, -16776961);
	TextDrawTextSize(Textdraw0, 389.000000, 0.000000);

	Textdraw1 = TextDrawCreate(230.000000, 165.000000, "Server Owner:");
	TextDrawBackgroundColor(Textdraw1, 255);
	TextDrawFont(Textdraw1, 1);
	TextDrawLetterSize(Textdraw1, 0.500000, 1.000000);
	TextDrawColor(Textdraw1, -1);
	TextDrawSetOutline(Textdraw1, 1);
	TextDrawSetProportional(Textdraw1, 1);
	TextDrawUseBox(Textdraw1, 1);
	TextDrawBoxColor(Textdraw1, 255);
	TextDrawTextSize(Textdraw1, 389.000000, 0.000000);

	Textdraw2 = TextDrawCreate(230.000000, 180.000000, "Tuntun");
	TextDrawBackgroundColor(Textdraw2, 255);
	TextDrawFont(Textdraw2, 1);
	TextDrawLetterSize(Textdraw2, 0.500000, 1.000000);
	TextDrawColor(Textdraw2, -1);
	TextDrawSetOutline(Textdraw2, 1);
	TextDrawSetProportional(Textdraw2, 1);
	TextDrawUseBox(Textdraw2, 1);
	TextDrawBoxColor(Textdraw2, 255);
	TextDrawTextSize(Textdraw2, 389.000000, 0.000000);

	Textdraw3 = TextDrawCreate(230.000000, 195.000000, "Server Script Editor:");
	TextDrawBackgroundColor(Textdraw3, 255);
	TextDrawFont(Textdraw3, 1);
	TextDrawLetterSize(Textdraw3, 0.500000, 1.000000);
	TextDrawColor(Textdraw3, -1);
	TextDrawSetOutline(Textdraw3, 1);
	TextDrawSetProportional(Textdraw3, 1);
	TextDrawUseBox(Textdraw3, 1);
	TextDrawBoxColor(Textdraw3, 255);
	TextDrawTextSize(Textdraw3, 389.000000, 0.000000);

	Textdraw4 = TextDrawCreate(230.000000, 218.000000, "The_King$5$");
	TextDrawBackgroundColor(Textdraw4, 255);
	TextDrawFont(Textdraw4, 1);
	TextDrawLetterSize(Textdraw4, 0.500000, 1.000000);
	TextDrawColor(Textdraw4, -1);
	TextDrawSetOutline(Textdraw4, 1);
	TextDrawSetProportional(Textdraw4, 1);
	TextDrawUseBox(Textdraw4, 1);
	TextDrawBoxColor(Textdraw4, 255);
	TextDrawTextSize(Textdraw4, 389.000000, 0.000000);

	Textdraw5 = TextDrawCreate(230.000000, 233.000000, "OK");
	TextDrawBackgroundColor(Textdraw5, 255);
	TextDrawFont(Textdraw5, 1);
	TextDrawLetterSize(Textdraw5, 0.500000, 1.000000);
	TextDrawColor(Textdraw5, -1);
	TextDrawSetOutline(Textdraw5, 1);
	TextDrawSetProportional(Textdraw5, 1);
	TextDrawUseBox(Textdraw5, 1);
	TextDrawBoxColor(Textdraw5, 255);
	TextDrawTextSize(Textdraw5, 389.000000, 0.000000);



Re: Clickable TextDraw help! - Dragonsaurus - 09.09.2013

pawn Code:
CMD:credits(playerid,params[])
{
    TextDrawShowForPlayer(playerid, Textdraw0);
    TextDrawShowForPlayer(playerid, Textdraw1);
    TextDrawShowForPlayer(playerid, Textdraw2);
    TextDrawShowForPlayer(playerid, Textdraw3);
    TextDrawShowForPlayer(playerid, Textdraw4);
    TextDrawShowForPlayer(playerid, Textdraw5);
    TextDrawSetSelectable(Textdraw5);
    return 1;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == Textdraw5) // Was just 5.
    {
        TextDrawHideForPlayer(playerid, Textdraw0);
        TextDrawHideForPlayer(playerid, Textdraw1);
        TextDrawHideForPlayer(playerid, Textdraw2);
        TextDrawHideForPlayer(playerid, Textdraw3);
        TextDrawHideForPlayer(playerid, Textdraw4);
        TextDrawHideForPlayer(playerid, Textdraw5);
        CancelSelectTextDraw(playerid);
    }
    return 1;
}



Re: Clickable TextDraw help! - Tuntun - 09.09.2013

Still 2 more errors:

Code:
E:\My server\gamemodes\Truck.pwn(1403) : warning 213: tag mismatch
E:\My server\gamemodes\Truck.pwn(3314) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Line: 1403:
Code:
	TextDrawSetSelectable(5, true);
Line 3314:
Code:
 TextDrawSetSelectable(Textdraw5);



Re: Clickable TextDraw help! - Dragonsaurus - 09.09.2013

Forget what I said before. Here:
pawn Code:
Textdraw5 = TextDrawCreate(230.000000, 233.000000, "OK");
    TextDrawBackgroundColor(Textdraw5, 255);
    TextDrawFont(Textdraw5, 1);
    TextDrawLetterSize(Textdraw5, 0.500000, 1.000000);
    TextDrawColor(Textdraw5, -1);
    TextDrawSetOutline(Textdraw5, 1);
    TextDrawSetProportional(Textdraw5, 1);
    TextDrawUseBox(Textdraw5, 1);
    TextDrawBoxColor(Textdraw5, 255);
    TextDrawTextSize(Textdraw5, 389.000000, 0.000000);
    TextDrawSetSelectable(Textdraw5, true); // Add this here
pawn Code:
CMD:credits(playerid,params[])
{
    TextDrawShowForPlayer(playerid, Textdraw0);
    TextDrawShowForPlayer(playerid, Textdraw1);
    TextDrawShowForPlayer(playerid, Textdraw2);
    TextDrawShowForPlayer(playerid, Textdraw3);
    TextDrawShowForPlayer(playerid, Textdraw4);
    TextDrawShowForPlayer(playerid, Textdraw5);
    SelectTextDraw(Textdraw5, 0xFFFFFFFF);  // Change the 0xFFFFFFFF wit any color you want.
    return 1;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == Textdraw5)
    {
        TextDrawHideForPlayer(playerid, Textdraw0);
        TextDrawHideForPlayer(playerid, Textdraw1);
        TextDrawHideForPlayer(playerid, Textdraw2);
        TextDrawHideForPlayer(playerid, Textdraw3);
        TextDrawHideForPlayer(playerid, Textdraw4);
        TextDrawHideForPlayer(playerid, Textdraw5);
        CancelSelectTextDraw(playerid);
    }
    return 1;
}



Re: Clickable TextDraw help! - Tuntun - 09.09.2013

Code:
E:\My server\gamemodes\Truck.pwn(1403) : warning 213: tag mismatch
E:\My server\gamemodes\Truck.pwn(3315) : warning 213: tag mismatch
Still an error in 3315 line:

SelectTextDraw(Textdraw5, 0xFFFFFFFF);


And line: 1403
TextDrawSetSelectable(5, true);


Re: Clickable TextDraw help! - Dragonsaurus - 09.09.2013

Delete this:
pawn Code:
TextDrawSetSelectable(5, true);
And change:
pawn Code:
SelectTextDraw(Textdraw5, 0xFFFFFFFF);
to
pawn Code:
SelectTextDraw(playerid, 0xFFFFFFFF);



Re: Clickable TextDraw help! - Tuntun - 09.09.2013

Lol... there is no errors but when i click on this "OK" Button it's not closing the textdraw... look at this:

why it is not closing after click on "Ok"?


Re: Clickable TextDraw help! - Tuntun - 09.09.2013

Any help please?


Re: Clickable TextDraw help! - Dragonsaurus - 09.09.2013

pawn Code:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == Textdraw5)
    {
        TextDrawHideForPlayer(playerid, Textdraw0);
        TextDrawHideForPlayer(playerid, Textdraw1);
        TextDrawHideForPlayer(playerid, Textdraw2);
        TextDrawHideForPlayer(playerid, Textdraw3);
        TextDrawHideForPlayer(playerid, Textdraw4);
        TextDrawHideForPlayer(playerid, Textdraw5);
        CancelSelectTextDraw(playerid); // Did you add this line here?
    }
    return 1;
}



Re: Clickable TextDraw help! - Tuntun - 09.09.2013

yea i added this line..