Detecting preview model that is clicked by player. -
Cena44 - 24.04.2014
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.
Re: Detecting preview model that is clicked by player. -
arakuta - 24.04.2014
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.
Re: Detecting preview model that is clicked by player. -
Konstantinos - 24.04.2014
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.
Re: Detecting preview model that is clicked by player. -
iBanner - 24.04.2014
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);
}
Re: Detecting preview model that is clicked by player. -
Cena44 - 24.04.2014
So,
pawn Код:
modelindex == Heart/Skull object ID here
Right?
Re: Detecting preview model that is clicked by player. -
arakuta - 24.04.2014
Whenever you set that the text is a skull store it in a variable, then check about it later. Should be a global variable.
Re: Detecting preview model that is clicked by player. -
Cena44 - 24.04.2014
Alright, thanks guys. I really appreciate it.
Re: Detecting preview model that is clicked by player. -
arakuta - 24.04.2014
Just do not have fear to ask or try