SA-MP Forums Archive
Clickable textdraw problem - 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 problem (/showthread.php?tid=423901)



Clickable textdraw problem - 2K9CON - 19.03.2013

Hey guys im a little new to pawn scripting so forgive me if this is a really simple fix but..

I am trying to make a textdraw login system i know how to do the login system and everything else but when i click the textdraws nothing happens

PHP код:
#include <a_samp>
#include <zcmd>
new Text:BoxDraw0;
new 
Text:LogoDraw;
new 
Text:LoginRegDraw;
new 
Text:WebDraw;
new 
Text:CreditsDraw;
new 
Text:QuitDraw;
new 
Text:OtherDraw;
public 
OnFilterScriptInit()
{
    
BoxDraw0 TextDrawCreate(470.000000, -11.000000"_~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~__~n~_");
    
TextDrawBackgroundColor(BoxDraw0255);
    
TextDrawFont(BoxDraw01);
    
TextDrawLetterSize(BoxDraw00.5000002.799999);
    
TextDrawColor(BoxDraw0, -1);
    
TextDrawSetOutline(BoxDraw00);
    
TextDrawSetProportional(BoxDraw01);
    
TextDrawSetShadow(BoxDraw01);
    
TextDrawUseBox(BoxDraw01);
    
TextDrawBoxColor(BoxDraw0255);
    
TextDrawTextSize(BoxDraw0650.000000, -38.000000);
    
TextDrawSetSelectable(BoxDraw00);
    
LogoDraw TextDrawCreate(471.00000010.000000"..:2013 Dogfights:...");
    
TextDrawBackgroundColor(LogoDraw16777215);
    
TextDrawFont(LogoDraw1);
    
TextDrawLetterSize(LogoDraw0.5000003.000000);
    
TextDrawColor(LogoDraw, -16776961);
    
TextDrawSetOutline(LogoDraw1);
    
TextDrawSetProportional(LogoDraw1);
    
TextDrawUseBox(LogoDraw1);
    
TextDrawBoxColor(LogoDraw707406536);
    
TextDrawTextSize(LogoDraw660.000000, -4.000000);
    
TextDrawSetSelectable(LogoDraw0);
    
LoginRegDraw TextDrawCreate(473.00000060.000000"Login / Register");
    
TextDrawBackgroundColor(LoginRegDraw255);
    
TextDrawFont(LoginRegDraw1);
    
TextDrawLetterSize(LoginRegDraw0.6399993.300000);
    
TextDrawColor(LoginRegDraw, -1);
    
TextDrawSetOutline(LoginRegDraw0);
    
TextDrawSetProportional(LoginRegDraw1);
    
TextDrawSetShadow(LoginRegDraw1);
    
TextDrawUseBox(LoginRegDraw1);
    
TextDrawBoxColor(LoginRegDraw707406536);
    
TextDrawTextSize(LoginRegDraw700.0000000.000000);
    
TextDrawSetSelectable(LoginRegDrawtrue);
    
WebDraw TextDrawCreate(475.000000115.000000"Website");
    
TextDrawBackgroundColor(WebDraw255);
    
TextDrawFont(WebDraw1);
    
TextDrawLetterSize(WebDraw0.6399993.300000);
    
TextDrawColor(WebDraw, -1);
    
TextDrawSetOutline(WebDraw0);
    
TextDrawSetProportional(WebDraw1);
    
TextDrawSetShadow(WebDraw1);
    
TextDrawUseBox(WebDraw1);
    
TextDrawBoxColor(WebDraw707406536);
    
TextDrawTextSize(WebDraw670.0000000.000000);
    
TextDrawSetSelectable(WebDrawtrue);
    
CreditsDraw TextDrawCreate(475.000000165.000000"Credits");
    
TextDrawBackgroundColor(CreditsDraw255);
    
TextDrawFont(CreditsDraw1);
    
TextDrawLetterSize(CreditsDraw0.6399993.300000);
    
TextDrawColor(CreditsDraw, -1);
    
TextDrawSetOutline(CreditsDraw0);
    
TextDrawSetProportional(CreditsDraw1);
    
TextDrawSetShadow(CreditsDraw1);
    
TextDrawUseBox(CreditsDraw1);
    
TextDrawBoxColor(CreditsDraw707406536);
    
TextDrawTextSize(CreditsDraw690.0000000.000000);
    
TextDrawSetSelectable(CreditsDrawtrue);
    
QuitDraw TextDrawCreate(477.000000392.000000"QUIT");
    
TextDrawBackgroundColor(QuitDraw, -1);
    
TextDrawFont(QuitDraw1);
    
TextDrawLetterSize(QuitDraw0.8400005.300000);
    
TextDrawColor(QuitDraw, -16776961);
    
TextDrawSetOutline(QuitDraw1);
    
TextDrawSetProportional(QuitDraw1);
    
TextDrawUseBox(QuitDraw1);
    
TextDrawBoxColor(QuitDraw707406536);
    
TextDrawTextSize(QuitDraw680.000000, -20.000000);
    
TextDrawSetSelectable(QuitDrawtrue);
    
OtherDraw TextDrawCreate(475.000000217.000000"Other");
    
TextDrawBackgroundColor(OtherDraw255);
    
TextDrawFont(OtherDraw1);
    
TextDrawLetterSize(OtherDraw0.6399993.300000);
    
TextDrawColor(OtherDraw, -1);
    
TextDrawSetOutline(OtherDraw0);
    
TextDrawSetProportional(OtherDraw1);
    
TextDrawSetShadow(OtherDraw1);
    
TextDrawUseBox(OtherDraw1);
    
TextDrawBoxColor(OtherDraw707406536);
    
TextDrawTextSize(OtherDraw730.0000000.000000);
    
TextDrawSetSelectable(OtherDrawtrue);
    return 
1;
}
public 
OnFilterScriptExit()
{
    
TextDrawHideForAll(BoxDraw0);
    
TextDrawDestroy(BoxDraw0);
    
TextDrawHideForAll(LogoDraw);
    
TextDrawDestroy(LogoDraw);
    
TextDrawHideForAll(LoginRegDraw);
    
TextDrawDestroy(LoginRegDraw);
    
TextDrawHideForAll(WebDraw);
    
TextDrawDestroy(WebDraw);
    
TextDrawHideForAll(CreditsDraw);
    
TextDrawDestroy(CreditsDraw);
    
TextDrawHideForAll(QuitDraw);
    
TextDrawDestroy(QuitDraw);
    
TextDrawHideForAll(OtherDraw);
    
TextDrawDestroy(OtherDraw);
    return 
1;
}
public 
OnPlayerClickTextDraw(playeridText:clickedid)
{
    if(
_:clickedid != INVALID_TEXT_DRAW
    {
        if(
clickedid == LoginRegDraw)
        {
            
SendClientMessage(playerid,-1,"* LOGIN / REG *");
        }
        else if(
clickedid == WebDraw)
        {
            
SendClientMessage(playerid,-1,"* WEBSITE *");
        }
        else if(
clickedid == CreditsDraw)
        {
            
SendClientMessage(playerid,-1,"* CREDITS *");
        }
        else if(
clickedid == QuitDraw)
        {
            
SendClientMessage(playerid,-1,"* QUIT *");
        }
        else if(
clickedid == OtherDraw)
        {
            
SendClientMessage(playerid,-1,"* OTHER *");
        }
        
TextDrawHideForPlayer(playeridBoxDraw0);
        
TextDrawHideForPlayer(playeridLogoDraw);
        
TextDrawHideForPlayer(playeridLoginRegDraw);
        
TextDrawHideForPlayer(playeridWebDraw);
        
TextDrawHideForPlayer(playeridCreditsDraw);
        
TextDrawHideForPlayer(playeridQuitDraw);
        
TextDrawHideForPlayer(playeridOtherDraw);
        
CancelSelectTextDraw(playerid);
    }
    return 
1;
}
CMD:testscreen(playeridparams[])
    {
        
TextDrawShowForPlayer(playeridBoxDraw0);
        
TextDrawShowForPlayer(playeridLogoDraw);
        
TextDrawShowForPlayer(playeridLoginRegDraw);
        
TextDrawShowForPlayer(playeridWebDraw);
        
TextDrawShowForPlayer(playeridCreditsDraw);
        
TextDrawShowForPlayer(playeridQuitDraw);
        
TextDrawShowForPlayer(playeridOtherDraw);
        
SelectTextDraw(playerid0xA3B4C5FF);
         return 
1;
    }
public 
OnPlayerSpawn(playerid)
{
    return 
1;

Or Pastebin

Can somebody please tell me what i'm doing wrong?

Note: Yes this is a filterscript i will put it in the real gamemode but this was just to test.


Re: Clickable textdraw problem - Vince - 19.03.2013

TextDrawTextSize must not be zero or negative. These values define the clickable area.


Re: Clickable textdraw problem - 2K9CON - 19.03.2013

Quote:
Originally Posted by Vince
Посмотреть сообщение
TextDrawTextSize must not be zero or negative. These values define the clickable area.
I did not make them zero or negative?


PHP код:
TextDrawTextSize(BoxDraw0650.000000, -38.000000);
TextDrawTextSize(LogoDraw660.000000, -4.000000);
TextDrawTextSize(LoginRegDraw700.0000000.000000);
TextDrawTextSize(WebDraw670.0000000.000000);
TextDrawTextSize(CreditsDraw690.0000000.000000);
TextDrawTextSize(QuitDraw680.000000, -20.000000);
TextDrawTextSize(OtherDraw730.0000000.000000); 



Re: Clickable textdraw problem - 2K9CON - 19.03.2013

Quote:
Originally Posted by Vince
Посмотреть сообщение
TextDrawTextSize must not be zero or negative. These values define the clickable area.
Ah you where right sorry Some are zero, works now thanks for your help