Selectable textdraws not working
#1

hey, im trying to make selectable textdraws using TDeditor for my new DM server but when i put the curse at any selectable textdraw it don't change the text color and also won't respond when i click at it

here is my codes
pawn Код:
//This on OnGameModeInit
TDEditor_TD[0] = TextDrawCreate(207.071823, 116.500053, "Welcome_to_United_Team_Deathmatch");
TextDrawLetterSize(TDEditor_TD[0], 0.509229, 3.626663);
TextDrawTextSize(TDEditor_TD[0], 427.325775, 4.179999);
TextDrawAlignment(TDEditor_TD[0], 1);
TextDrawColor(TDEditor_TD[0], -1);
TextDrawUseBox(TDEditor_TD[0], 1);
TextDrawBoxColor(TDEditor_TD[0], 255);
TextDrawSetShadow(TDEditor_TD[0], 0);
TextDrawSetOutline(TDEditor_TD[0], 0);
TextDrawBackgroundColor(TDEditor_TD[0], 255);
TextDrawFont(TDEditor_TD[0], 0);
TextDrawSetProportional(TDEditor_TD[0], 1);
TextDrawSetShadow(TDEditor_TD[0], 0);

TDEditor_TD[1] = TextDrawCreate(116.178619, 167.833358, "Team_deathmatches");
TextDrawLetterSize(TDEditor_TD[1], 0.337217, 3.752501);
TextDrawTextSize(TDEditor_TD[1], 238.008834, 0.000000);
TextDrawAlignment(TDEditor_TD[1], 1);
TextDrawColor(TDEditor_TD[1], -1);
TextDrawUseBox(TDEditor_TD[1], 1);
TextDrawBoxColor(TDEditor_TD[1], 255);
TextDrawSetShadow(TDEditor_TD[1], 0);
TextDrawSetOutline(TDEditor_TD[1], 0);
TextDrawBackgroundColor(TDEditor_TD[1], 255);
TextDrawFont(TDEditor_TD[1], 3);
TextDrawSetProportional(TDEditor_TD[1], 1);
TextDrawSetShadow(TDEditor_TD[1], 0);
TextDrawSetSelectable(TDEditor_TD[1], true);

TDEditor_TD[2] = TextDrawCreate(248.770111, 167.833358, "Normal_Deathmatches");
TextDrawLetterSize(TDEditor_TD[2], 0.338622, 3.729168);
TextDrawTextSize(TDEditor_TD[2], 379.802612, 0.000000);
TextDrawAlignment(TDEditor_TD[2], 1);
TextDrawColor(TDEditor_TD[2], -1);
TextDrawUseBox(TDEditor_TD[2], 1);
TextDrawBoxColor(TDEditor_TD[2], 255);
TextDrawSetShadow(TDEditor_TD[2], 0);
TextDrawSetOutline(TDEditor_TD[2], 0);
TextDrawBackgroundColor(TDEditor_TD[2], 255);
TextDrawFont(TDEditor_TD[2], 3);
TextDrawSetProportional(TDEditor_TD[2], 1);
TextDrawSetShadow(TDEditor_TD[2], 0);

TDEditor_TD[3] = TextDrawCreate(389.795166, 167.833267, "Airplane_Deathmatches");
TextDrawLetterSize(TDEditor_TD[3], 0.320351, 3.775835);
TextDrawTextSize(TDEditor_TD[3], 518.484924, 0.000000);
TextDrawAlignment(TDEditor_TD[3], 1);
TextDrawColor(TDEditor_TD[3], -1);
TextDrawUseBox(TDEditor_TD[3], 1);
TextDrawBoxColor(TDEditor_TD[3], 255);
TextDrawSetShadow(TDEditor_TD[3], 0);
TextDrawSetOutline(TDEditor_TD[3], 0);
TextDrawBackgroundColor(TDEditor_TD[3], 255);
TextDrawFont(TDEditor_TD[3], 3);
TextDrawSetProportional(TDEditor_TD[3], 1);
TextDrawSetShadow(TDEditor_TD[3], 0);
TextDrawSetSelectable(TDEditor_TD[3], true);

TDEditor_TD[4] = TextDrawCreate(108.213851, 225.583404, "Derby_Deathmatches");
TextDrawLetterSize(TDEditor_TD[4], 0.358770, 3.781668);
TextDrawTextSize(TDEditor_TD[4], 237.371749, 0.000000);
TextDrawAlignment(TDEditor_TD[4], 1);
TextDrawColor(TDEditor_TD[4], -1);
TextDrawUseBox(TDEditor_TD[4], 1);
TextDrawBoxColor(TDEditor_TD[4], 255);
TextDrawSetShadow(TDEditor_TD[4], 0);
TextDrawSetOutline(TDEditor_TD[4], 0);
TextDrawBackgroundColor(TDEditor_TD[4], 255);
TextDrawFont(TDEditor_TD[4], 3);
TextDrawSetProportional(TDEditor_TD[4], 1);
TextDrawSetShadow(TDEditor_TD[4], 0);
TextDrawSetSelectable(TDEditor_TD[4], true);

TDEditor_TD[5] = TextDrawCreate(253.455047, 224.999984, "Gang_war_deathmatches");
TextDrawLetterSize(TDEditor_TD[5], 0.392971, 3.245002);
TextDrawTextSize(TDEditor_TD[5], 419.626464, 0.000000);
TextDrawAlignment(TDEditor_TD[5], 1);
TextDrawColor(TDEditor_TD[5], -1);
TextDrawUseBox(TDEditor_TD[5], 1);
TextDrawBoxColor(TDEditor_TD[5], 255);
TextDrawSetShadow(TDEditor_TD[5], 0);
TextDrawSetOutline(TDEditor_TD[5], 0);
TextDrawBackgroundColor(TDEditor_TD[5], 255);
TextDrawFont(TDEditor_TD[5], 3);
TextDrawSetProportional(TDEditor_TD[5], 1);
TextDrawSetShadow(TDEditor_TD[5], 0);
TextDrawSetSelectable(TDEditor_TD[5], true);

TDEditor_TD[6] = TextDrawCreate(430.088073, 223.250000, "Freeroam");
TextDrawLetterSize(TDEditor_TD[6], 0.648783, 3.174999);
TextDrawTextSize(TDEditor_TD[6], 537.394531, 0.000000);
TextDrawAlignment(TDEditor_TD[6], 1);
TextDrawColor(TDEditor_TD[6], -1);
TextDrawUseBox(TDEditor_TD[6], 1);
TextDrawBoxColor(TDEditor_TD[6], 255);
TextDrawSetShadow(TDEditor_TD[6], 0);
TextDrawSetOutline(TDEditor_TD[6], 0);
TextDrawBackgroundColor(TDEditor_TD[6], 255);
TextDrawFont(TDEditor_TD[6], 3);
TextDrawSetProportional(TDEditor_TD[6], 1);
TextDrawSetShadow(TDEditor_TD[6], 0);
TextDrawSetSelectable(TDEditor_TD[6], true);

TDEditor_TD[7] = TextDrawCreate(148.037994, 285.767517, "Please_select_any_mode_you_want");
TextDrawLetterSize(TDEditor_TD[7], 0.446851, 3.262500);
TextDrawAlignment(TDEditor_TD[7], 1);
TextDrawColor(TDEditor_TD[7], -1);
TextDrawSetShadow(TDEditor_TD[7], 0);
TextDrawSetOutline(TDEditor_TD[7], 0);
TextDrawBackgroundColor(TDEditor_TD[7], 255);
TextDrawFont(TDEditor_TD[7], 2);
TextDrawSetProportional(TDEditor_TD[7], 1);
TextDrawSetShadow(TDEditor_TD[7], 0);

//And this added after the login and registration
TextDrawShowForPlayer(playerid,TDEditor_TD[0]);
TextDrawShowForPlayer(playerid,TDEditor_TD[1]);
TextDrawShowForPlayer(playerid,TDEditor_TD[2]);
TextDrawShowForPlayer(playerid,TDEditor_TD[3]);
TextDrawShowForPlayer(playerid,TDEditor_TD[4]);
TextDrawShowForPlayer(playerid,TDEditor_TD[5]);
TextDrawShowForPlayer(playerid,TDEditor_TD[6]);
TextDrawShowForPlayer(playerid,TDEditor_TD[7]);
SelectTextDraw(playerid, 0x721650FF);

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == TDEditor_TD[6])//i use this for test and its not responding at all..
    {
        SetPlayerPos(playerid,1998.1221,-2630.8013,13.5469);
        CancelSelectTextDraw(playerid);
            SendClientMessage(playerid,RED,"TEST");
    }
    return 1;
}
Reply
#2

Did you put this:

pawn Код:
SelectTextDraw(playerid, textdrawName);
Reply
#3

Try using this

Код:
TextDrawSetSelectable(TDEditor_TD[6], 1);//instead of true
Reply
#4

Quote:
Originally Posted by Stanford
Посмотреть сообщение
Did you put this:

pawn Код:
SelectTextDraw(playerid, textdrawName);
Yes, i added this when it show the textdraw...
BTW its
Код:
SelectTextDraw(playerid, HOVERCOLOR);
Not
Код:
SelectTextDraw(playerid, textdrawName);
Quote:
Originally Posted by hamzajaved780
Посмотреть сообщение
Try using this

Код:
TextDrawSetSelectable(TDEditor_TD[6], 1);//instead of true
I have already tried that and i got the same results..
Reply
#5

Anyone?
Reply
#6

Try to edit:

PHP код:
TextDrawTextSize 
Reply
#7

okay, i edited it now and it work but there are some problems in selecting TD it selects two TDs when i point at one TD like when i point at Derby deathmatches highlighting in normal deathmatches and the derby deathmatches..any one got idea about that?

Код:
SM1 = TextDrawCreate(178.038055, 132.416732, "Welcome to United Team Deathmatches");
TextDrawLetterSize(SM1, 0.585870, 2.708333);
TextDrawAlignment(SM1, 1);
TextDrawColor(SM1, -2147450625);
TextDrawSetShadow(SM1, 0);
TextDrawSetOutline(SM1, 1);
TextDrawBackgroundColor(SM1, 51);
TextDrawFont(SM1, 0);
TextDrawSetProportional(SM1, 1);

SM2 = TextDrawCreate(146.178634, 184.333343, "Team Deathmatches");
TextDrawLetterSize(SM2, 0.421418, 3.910001);
TextDrawTextSize(SM2, 302.196502, 189.583389);
TextDrawAlignment(SM2, 1);
TextDrawColor(SM2, -1);
TextDrawUseBox(SM2, true);
TextDrawBoxColor(SM2, -5963521);
TextDrawSetShadow(SM2, 0);
TextDrawSetOutline(SM2, 1);
TextDrawBackgroundColor(SM2, 51);
TextDrawFont(SM2, 3);
TextDrawSetProportional(SM2, 1);
TextDrawSetSelectable(SM2, true);

SM3 = TextDrawCreate(514.094482, 162.500091, "usebox");
TextDrawLetterSize(SM3, 0.000000, 21.310625);
TextDrawTextSize(SM3, 128.193252, 0.000000);
TextDrawAlignment(SM3, 1);
TextDrawColor(SM3, 0);
TextDrawUseBox(SM3, true);
TextDrawBoxColor(SM3, 102);
TextDrawSetShadow(SM3, 0);
TextDrawSetOutline(SM3, 0);
TextDrawBackgroundColor(SM3, 255);
TextDrawFont(SM3, 0);

SM4 = TextDrawCreate(356.076416, 180.833465, "Normal Deathmatches");
TextDrawLetterSize(SM4, 0.336616, 4.055837);
TextDrawTextSize(SM4, 494.290069, 169.166687);
TextDrawAlignment(SM4, 1);
TextDrawColor(SM4, -1);
TextDrawUseBox(SM4, true);
TextDrawBoxColor(SM4, -5963521);
TextDrawSetShadow(SM4, 0);
TextDrawSetOutline(SM4, 1);
TextDrawBackgroundColor(SM4, 51);
TextDrawFont(SM4, 3);
TextDrawSetProportional(SM4, 1);
TextDrawSetSelectable(SM4, true);

SM5 = TextDrawCreate(144.773086, 242.083282, "Airplane Deathmatches");
TextDrawLetterSize(SM5, 0.375503, 3.991670);
TextDrawTextSize(SM5, 302.196197, -142.916656);
TextDrawAlignment(SM5, 1);
TextDrawColor(SM5, -1);
TextDrawUseBox(SM5, true);
TextDrawBoxColor(SM5, -5963521);
TextDrawSetShadow(SM5, 0);
TextDrawSetOutline(SM5, 1);
TextDrawBackgroundColor(SM5, 51);
TextDrawFont(SM5, 3);
TextDrawSetProportional(SM5, 1);
TextDrawSetSelectable(SM5, true);

SM6 = TextDrawCreate(356.076171, 245.583343, "Derby Deathmatches");
TextDrawLetterSize(SM6, 0.362869, 3.851668);
TextDrawTextSize(SM6, 496.632385, 43.750000);
TextDrawAlignment(SM6, 1);
TextDrawColor(SM6, -1);
TextDrawUseBox(SM6, true);
TextDrawBoxColor(SM6, -5963521);
TextDrawSetShadow(SM6, 0);
TextDrawSetOutline(SM6, 1);
TextDrawBackgroundColor(SM6, 51);
TextDrawFont(SM6, 3);
TextDrawSetProportional(SM6, 1);
TextDrawSetSelectable(SM6, true);

SM7 = TextDrawCreate(144.773071, 300.416839, "Gang war deathmatches");
TextDrawLetterSize(SM7, 0.346939, 3.553352);
TextDrawTextSize(SM7, 300.322631, 44.333324);
TextDrawAlignment(SM7, 1);
TextDrawColor(SM7, -1);
TextDrawUseBox(SM7, true);
TextDrawBoxColor(SM7, -5963521);
TextDrawSetShadow(SM7, 0);
TextDrawSetOutline(SM7, 1);
TextDrawBackgroundColor(SM7, 51);
TextDrawFont(SM7, 3);
TextDrawSetProportional(SM7, 1);
TextDrawSetSelectable(SM7, true);

SM8 = TextDrawCreate(357.950012, 302.166625, "Freeroam");
TextDrawLetterSize(SM8, 0.527304, 3.075837);
TextDrawTextSize(SM8, 496.164550, 64.166656);
TextDrawAlignment(SM8, 1);
TextDrawColor(SM8, -1);
TextDrawUseBox(SM8, true);
TextDrawBoxColor(SM8, -5963521);
TextDrawSetShadow(SM8, 0);
TextDrawSetOutline(SM8, 1);
TextDrawBackgroundColor(SM8, 51);
TextDrawFont(SM8, 3);
TextDrawSetProportional(SM8, 1);
TextDrawSetSelectable(SM8, true);

SM9 = TextDrawCreate(146.178344, 338.916625, "Please Select Any Mode You Want");
TextDrawLetterSize(SM9, 0.449999, 1.600000);
TextDrawAlignment(SM9, 1);
TextDrawColor(SM9, -2139062017);
TextDrawSetShadow(SM9, 0);
TextDrawSetOutline(SM9, 1);
TextDrawBackgroundColor(SM9, 51);
TextDrawFont(SM9, 2);
TextDrawSetProportional(SM9, 1);
Reply
#8

As what the members above said. You have to edit the text size until it fits the way you want it.

Example:
pawn Код:
TextDrawTextSize(TextDraw0, 0, 0);
Reply
#9

Okay thanks its now working, but anyone know any way to make the player can't spawn until he select any of these TextDraws?
Reply
#10

You could spawn the player with SpawnPlayer(playerid), and then TogglePlayerSpectating(playerid, true).
Reply
#11

Add "TogglePlayerSpectating(playerid, true);" on connect, and when they choose a mode, add "TogglePlayerSpectating(playerid, false);". It will bring them to the class selection after they choose a mode.
Reply
#12

Thanks guys again for help!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)