Problem in detecting if a portion of the screen is being clicked by the mouse.
#1

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.
Reply
#2

OnPlayerClickTextdraw? Or am I missing something here?
Reply
#3

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.
Reply
#4

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
    }
}
Reply
#5

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?
Reply
#6

Out of the box and genius, the solution, is, really. Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)