Clickable Textdraw Issue
#1

I've followed some tutorials since this is my first time doing selectable text draws. It doesn't seem like it's being called..

pawn Код:
new PlayerText:CitySel[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW_PLAYER, ...};
new PlayerText:LVSpawn[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW_PLAYER, ...};
new PlayerText:SFSpawn[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW_PLAYER, ...};
 
public OnPlayerRequestClass(playerid, classid)
{
    PlayerTextDrawShow(playerid, CitySel[playerid]);
    PlayerTextDrawShow(playerid, LVSpawn[playerid]);
    PlayerTextDrawShow(playerid, SFSpawn[playerid]);
    return 1;
}
 
public OnPlayerConnect(playerid)
{
CitySel[playerid] = CreatePlayerTextDraw(playerid, 20.000000, 142.000000, "City Selection");
    PlayerTextDrawBackgroundColor(playerid, CitySel[playerid], 255);
    PlayerTextDrawFont(playerid, CitySel[playerid], 2);
    PlayerTextDrawLetterSize(playerid, CitySel[playerid], 0.360000, 1.000000);
    PlayerTextDrawColor(playerid, CitySel[playerid], -1);
    PlayerTextDrawSetOutline(playerid, CitySel[playerid], 0);
    PlayerTextDrawSetProportional(playerid, CitySel[playerid], 1);
    PlayerTextDrawSetShadow(playerid, CitySel[playerid], 0);
    PlayerTextDrawUseBox(playerid, CitySel[playerid], 1);
    PlayerTextDrawBoxColor(playerid, CitySel[playerid], 701391103);
    PlayerTextDrawTextSize(playerid, CitySel[playerid], 136.000000, 0.000000);

    LVSpawn[playerid] = CreatePlayerTextDraw(playerid, 20.000000, 159.000000, "Las Venturas");
    PlayerTextDrawBackgroundColor(playerid, LVSpawn[playerid], 701391103);
    PlayerTextDrawFont(playerid, LVSpawn[playerid], 2);
    PlayerTextDrawLetterSize(playerid, LVSpawn[playerid], 0.370000, 1.000000);
    PlayerTextDrawColor(playerid, LVSpawn[playerid], -1);
    PlayerTextDrawSetOutline(playerid, LVSpawn[playerid], 0);
    PlayerTextDrawSetProportional(playerid, LVSpawn[playerid], 1);
    PlayerTextDrawSetShadow(playerid, LVSpawn[playerid], 1);
    PlayerTextDrawUseBox(playerid, LVSpawn[playerid], 1);
    PlayerTextDrawBoxColor(playerid, LVSpawn[playerid], 1357672959);
    PlayerTextDrawTextSize(playerid, LVSpawn[playerid], 136.000000, 0.000000);
    PlayerTextDrawSetSelectable(playerid, LVSpawn[playerid], true);

    SFSpawn[playerid] = CreatePlayerTextDraw(playerid, 20.000000, 173.000000, "San Fierro");
    PlayerTextDrawBackgroundColor(playerid, SFSpawn[playerid], 701391103);
    PlayerTextDrawFont(playerid, SFSpawn[playerid], 2);
    PlayerTextDrawLetterSize(playerid, SFSpawn[playerid], 0.370000, 1.000000);
    PlayerTextDrawColor(playerid, SFSpawn[playerid], -1);
    PlayerTextDrawSetOutline(playerid, SFSpawn[playerid], 0);
    PlayerTextDrawSetProportional(playerid, SFSpawn[playerid], 1);
    PlayerTextDrawSetShadow(playerid, SFSpawn[playerid], 1);
    PlayerTextDrawUseBox(playerid, SFSpawn[playerid], 1);
    PlayerTextDrawBoxColor(playerid, SFSpawn[playerid], 1357672959);
    PlayerTextDrawTextSize(playerid, SFSpawn[playerid], 136.000000, 0.000000);
    PlayerTextDrawSetSelectable(playerid, SFSpawn[playerid], true);
    return 1;
}
 
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
    if(playertextid == LVSpawn[playerid])
    {
        SendClientMessage(playerid, COLOR_RED, "You selected LV!");
        printf("Selectd LV");
    }
     
    else if(playertextid == SFSpawn[playerid])
    {
        SendClientMessage(playerid, COLOR_RED, "You selected SF");
        printf("Selectd SF");
    }
    return 1;
}
Reply
#2

You didnt use
SetPlayerPosition function on your code
Reply
#3

What would SetPlayerPosition have to do with it?
When I click it I just want it to send me a message.
Reply
#4

Quote:
Originally Posted by itsCody
Посмотреть сообщение
What would SetPlayerPosition have to do with it?
When I click it I just want it to send me a message.
Make an SetPlayerPos after you click the textdraw.

SetPlayerPos(x, y, z)
Reply
#5

Ok, let me explain what I need/want it to do.

The textdraws shows OnPlayerRequestClass for a city selection.

When a player clicks it, it'll select that textdraw and send a message, I don't want it to SetPlayerPos as it's just a selection for a city spawn. When clicked it'll select random positions and when the player hit spawns it'll spawn them into the city that they selected.

I'm not good at explaining shit so sorry.
Reply
#6

TextDrawTextSize is 0; you have no clickable area to begin with.
Reply
#7

Replace these 2 lines
pawn Код:
PlayerTextDrawTextSize(playerid, LVSpawn[playerid], 136.000000, 0.000000);
PlayerTextDrawTextSize(playerid, SFSpawn[playerid], 136.000000, 0.000000);
with this
pawn Код:
PlayerTextDrawTextSize(playerid, LVSpawn[playerid], 136.000000, 20.000000);
PlayerTextDrawTextSize(playerid, SFSpawn[playerid], 136.000000, 20.000000);
Reply
#8

Done, still isn't doing shit
ughhh it's probably something simple and I just don't see it yet.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)