PDA

View Full Version : clicking on textdraw.


faff
24/02/2014, 05:53 PM
Hello there.
I've been trying to fix this problem for 2 weeks right now.

When i'm trying to click on the ''EXIT'' textdraw. It doenst work :(.

This is the code.

public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
if(GetPVarInt(playerid, "vspawner_active") == 0) return 0;

new curpage = GetPVarInt(playerid, "vspawner_page");

// Handle: next button
if(playertextid == gNextButtonTextDrawId[playerid]) {
if(curpage < (GetNumberOfPages() - 1)) {
SetPVarInt(playerid, "vspawner_page", curpage + 1);
ShowPlayerModelPreviews(playerid);
UpdatePageTextDraw(playerid);
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
} else {
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
return 1;
}

// Handle: previous button
if(playertextid == gPrevButtonTextDrawId[playerid]) {
if(curpage > 0) {
SetPVarInt(playerid, "vspawner_page", curpage - 1);
ShowPlayerModelPreviews(playerid);
UpdatePageTextDraw(playerid);
PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0);
} else {
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
return 1;
}

// Search in the array of textdraws used for the items
new x=0;
while(x != SELECTION_ITEMS) {
if(playertextid == gSelectionItems[playerid][x]) {
HandlePlayerItemSelection(playerid, x);
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
DestroySelectionMenu(playerid);
CancelSelectTextDraw(playerid);
SetPVarInt(playerid, "vspawner_active", 0);
return 1;
}
x++;
}
if(playertextid == DLexit[playerid]) {
SetCameraBehindPlayer(playerid);
PlayerTextDrawHide(playerid, DLbox1[playerid]);
PlayerTextDrawHide(playerid, DLbox2[playerid]);
PlayerTextDrawHide(playerid, DLbox3[playerid]);
PlayerTextDrawHide(playerid, DLmodify[playerid]);
PlayerTextDrawHide(playerid, DLspeedtest[playerid]);
PlayerTextDrawHide(playerid, DLcitytest[playerid]);
PlayerTextDrawHide(playerid, DLpaint[playerid]);
PlayerTextDrawHide(playerid, DLbuy[playerid]);
PlayerTextDrawHide(playerid, DLexit[playerid]);
CancelSelectTextDraw(playerid);
return 1;
}

return 0;
}

The textdraw code:

new PlayerText:DLexit[MAX_PLAYERS];

DLexit[playerid] = CreatePlayerTextDraw(playerid, 552.000000, 274.000000, "EXIT");
PlayerTextDrawBackgroundColor(playerid, DLexit[playerid], 255);
PlayerTextDrawFont(playerid, DLexit[playerid], 1);
PlayerTextDrawLetterSize(playerid, DLexit[playerid], 1.130000, 7.400000);
PlayerTextDrawColor(playerid, DLexit[playerid], -1);
PlayerTextDrawSetOutline(playerid, DLexit[playerid], 0);
PlayerTextDrawSetProportional(playerid, DLexit[playerid], 1);
PlayerTextDrawSetShadow(playerid, DLexit[playerid], 1);
PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 1);
PlayerTextDrawTextSize(playerid, DLexit[playerid], 1000.0000, 160.0000000);




I would appreciate it if someone could help me..
Thank you very much!

Edit; Yes i've enabled the textdraw selection. so the mouse button is actually showing tho'.

CuervO
24/02/2014, 06:18 PM
PlayerTextDrawTextSize(playerid, DLexit[playerid], 1000.0000, 160.0000000);

The clickable area for the textdraw is higher than the screen itself so that could render a problem.

faff
25/02/2014, 08:55 AM
Well, When i hover over the text, it changes color. But when i click on it, it doesnt do any shitty thing.

So personally i think the problem is in here.

public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
if(GetPVarInt(playerid, "vspawner_active") == 0) return 0;

new curpage = GetPVarInt(playerid, "vspawner_page");

// Handle: next button
if(playertextid == gNextButtonTextDrawId[playerid]) {
if(curpage < (GetNumberOfPages() - 1)) {
SetPVarInt(playerid, "vspawner_page", curpage + 1);
ShowPlayerModelPreviews(playerid);
UpdatePageTextDraw(playerid);
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
} else {
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
return 1;
}

// Handle: previous button
if(playertextid == gPrevButtonTextDrawId[playerid]) {
if(curpage > 0) {
SetPVarInt(playerid, "vspawner_page", curpage - 1);
ShowPlayerModelPreviews(playerid);
UpdatePageTextDraw(playerid);
PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0);
} else {
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
return 1;
}

// Search in the array of textdraws used for the items
new x=0;
while(x != SELECTION_ITEMS) {
if(playertextid == gSelectionItems[playerid][x]) {
HandlePlayerItemSelection(playerid, x);
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
DestroySelectionMenu(playerid);
CancelSelectTextDraw(playerid);
SetPVarInt(playerid, "vspawner_active", 0);
return 1;
}
x++;
}
if(playertextid == DLexit[playerid]) {
SetCameraBehindPlayer(playerid);
PlayerTextDrawHide(playerid, DLbox1[playerid]);
PlayerTextDrawHide(playerid, DLbox2[playerid]);
PlayerTextDrawHide(playerid, DLbox3[playerid]);
PlayerTextDrawHide(playerid, DLmodify[playerid]);
PlayerTextDrawHide(playerid, DLspeedtest[playerid]);
PlayerTextDrawHide(playerid, DLcitytest[playerid]);
PlayerTextDrawHide(playerid, DLpaint[playerid]);
PlayerTextDrawHide(playerid, DLbuy[playerid]);
PlayerTextDrawHide(playerid, DLexit[playerid]);
CancelSelectTextDraw(playerid);
return 1;
}

return 0;
}


But i've been trying and trying, but couldnt find it..

faff
25/02/2014, 02:43 PM
anybody?