Detecting preview model that is clicked by player.
#1

Hi there, I'm wondering if it's possible to detect what textdraw the player clicks. Say you make a single box that can be used to heal and suicide, with heal having the heart object and suicide having the skull object as preview models. Is it possible to detect which ones the player is clicking? So it would heal you if you click heart, and kill you if you click the skull.

I appreciate the help.
Reply
#2

The clickedid in actually the textdraw id.

If you want two states, in the same textdraw just create a variable to store which state it is, and use this variable as a condition.
Reply
#3

The preview model has been in a specific textdraw. Check if its ID is the same as the textdraw ID the player clicked and do your code.
Reply
#4

I think it is possible. Just like when you picked a pickup with the object


Код:
new pickup_Health;
 
public OnGameModeInit()
{
    pickup_Health = CreatePickup(1240, 2, 0.0, 0.0, 9.0);
    return 1;
}
 
public OnPlayerPickUpPickup(playerid, pickupid)
{
    else if(pickupid == pickup_Health)
    {
        SetPlayerHealth(playerid, 100);
    }
    return 1;
}
But in your case use your textdraw variable.

Use this tutorial Clikable textdraw

Sample when you click a health textdraw
Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == health pickup)
    {
        SetPlayerHealth(playerid, 100);
    }
Reply
#5

So,
pawn Код:
modelindex == Heart/Skull object ID here
Right?
Reply
#6

Whenever you set that the text is a skull store it in a variable, then check about it later. Should be a global variable.
Reply
#7

Alright, thanks guys. I really appreciate it.
Reply
#8

Just do not have fear to ask or try
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)