SA-MP Forums Archive
OPKeyStateChange, isn't being called.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OPKeyStateChange, isn't being called.. (/showthread.php?tid=546005)



OPKeyStateChange, isn't being called.. - Adawg - 12.11.2014

ONPLAYERKEYSTAGECHANGE
----------------------------

I don't understand why it's isn't working, I'm not so new at scripting so I know my code is good but for somes reasons OPKeyStateChange isn't called.

CODE/SCRIPT PART
-------------------

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

// the problems :
// --------------

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsOnLobby[playerid] == 1 && PRESSED(KEY_YES)) { //printf("test0");
        if(co_SafeZone[playerid] == 1) { //printf("test1");
            SetSpawnInfo( playerid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), //printf("test2");
            SpawnPlayer(playerid), SetPlayerInterior(playerid, 0), //printf("test3");
            SetPlayerVirtualWorld(playerid, 0); //printf("test4");
            return 1;
        }
    }
    return 1;
}
A QUESTIONS
-------------

I can change the keys to a basic commands, IF you confirm me OPKSTC(onplayerkeystagechange) isn't working when we use SelectTextdraw(playerid, COLOR);
Because, my code seems to don't have any problems.. Thanks for reading.


Re: OPKeyStateChange, isn't being called.. - Ahmad45123 - 12.11.2014

Are you sure you have the var set to 1 ?


Re: OPKeyStateChange, isn't being called.. - Adawg - 12.11.2014

Yes the vars is setted to 1, any mores answer? Because it's really annoying me, dashiet.


Re: OPKeyStateChange, isn't being called.. - Dziugsas - 12.11.2014

This maybe?
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsOnLobby[playerid] == 1 && PRESSED(KEY_YES))
    { //printf("test0");
        if(co_SafeZone[playerid] == 1)
        { //printf("test1");
            SetSpawnInfo( playerid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); //printf("test2");
            SpawnPlayer(playerid);
            SetPlayerInterior(playerid, 0); //printf("test3");
            SetPlayerVirtualWorld(playerid, 0); //printf("test4");
            return 1;
        }
    }
    return 1;
}



Re: OPKeyStateChange, isn't being called.. - Adawg - 12.11.2014

The indentation doesn't matter, I've tested to change the indentations before asking and it's still the same problems..


Re: OPKeyStateChange, isn't being called.. - Dziugsas - 12.11.2014

Quote:

[**] Supported since 0.3d. Not detectable in earlier versions. This key can not be detected when the player is in spectator mode.

Maybe this is the problem?


Re: OPKeyStateChange, isn't being called.. - Adawg - 12.11.2014

Ooooohw, shiet. It's was what I thinked their was a problems with that can you send me a link where you got this informations, and thanks by the way.
woops : https://sampwiki.blast.hk/wiki/Keys


Re: OPKeyStateChange, isn't being called.. - Dziugsas - 12.11.2014

Everything that you can find is from the wiki https://sampwiki.blast.hk/wiki/Keys.