OPKeyStateChange, isn't being called..
#1

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

Are you sure you have the var set to 1 ?
Reply
#3

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

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

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

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

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
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)