Problem in detecting if a portion of the screen is being clicked by the mouse. -
RajatPawar - 08.02.2013
I used this kind of code.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
{
new Float:x, Float:y, Float:z;
GetPlayerCameraPos(playerid,x, y, z);
if( (x<392 || x>358) && (y>152 || y<182) ) //Checking for the textdraw area
{
SendClientMessage(playerid, -1, "Done."); //For testing
}
}
return 1;
}
I tried it ingame, didn't work!
Please do help.
Re: Problem in detecting if a portion of the screen is being clicked by the mouse. -
Vince - 08.02.2013
OnPlayerClickTextdraw? Or am I missing something here?
Re: Problem in detecting if a portion of the screen is being clicked by the mouse. -
RajatPawar - 08.02.2013
Err yeah, that's the problem, it's not a single Textdraw, it's about .. 893 textdraws, a collection which forms an 'image,' to be exact.
So I should use a if(textdrawid == 0 || .......)
EDIT:
I have used SelectTextDraw to enable the cursor. I click anywhere on the screen, nothing happens. I cancelled the cursor (ESC) and then clicked, i.e. Punched the air, it returned me "Done" every damn time.
Re: Problem in detecting if a portion of the screen is being clicked by the mouse. -
Sinner - 08.02.2013
Loop over all the textdraws and see if you clicked any of them?
pawn Код:
new Text:ImageTextDraws[800];
pawn Код:
for(new i=0; i<800; i++) {
if(clickedid == ImageTextDraws[i]) {
// You clicked i
}
}
Re: Problem in detecting if a portion of the screen is being clicked by the mouse. -
RajatPawar - 08.02.2013
Err, yes, I am sorry, but could you debrief me on how to create an 'invisible' textdraw. Should I just enable the box and then set it's color to the transparent color thingy..which you find on SetPlayerMarkerColor page on wiki?
Re: Problem in detecting if a portion of the screen is being clicked by the mouse. -
RajatPawar - 08.02.2013
Out of the box and genius, the solution, is, really. Thanks.