OnPlayerCancelSelectObject?
#1

Is there something like it? It's not possible to detect esc key, is there some other way to find out?
Reply
#2

Nope, but you can use the responses .. to define CANCEL and FINAL
Reply
#3

Cancel and final are in edit object, not select object
Reply
#4

OnPlayerSelectObject is triggered when you click on object, so you can't detect ESC by this.
I don't see any other way, ESC key is undetectable key.
Reply
#5

You wanna click on a selectable td and then cancel it?
Edit: like a single click?
Reply
#6

I don't know if you tried this, its not on wiki but worth a try to check if objectid is INVALID_OBJECT_ID, which could be triggered when player pressed ESC.
Reply
#7

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Is there something like it? It's not possible to detect esc key, is there some other way to find out?
I haven't used SelectObject at all but what if you would to place an innocent/transparent textdraw in some corner that is selectable as well so then you could detect ESC key by using global variables to attach it all together?

An issue might be that the textdraw selecting is interfering with SelectObject which would be very dull. Maybe worth a try if you haven't tried it out yet!

Edit: Code suggestion-alike:

Код:
new PlayerSelecting[MAX_PLAYERS];

SomeFunctions(playerid)
{
    // Somehow it ended up here

    PlayerSelecting[playerid] = 1;
    SelectObject(playerid);
    SelectTextDraw(playerid, 0xFFFFFF00);
}

public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
{
    PlayerSelecting[playerid] = 0; //assuming that the selecting process is cancelled in this callback when an object has been selected?

    // do stuff with object that was selected
}

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if (clickedid == INVALID_TEXT_DRAW && PlayerSelecting[playerid])
    {
         // do stuff
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)