OnPlayerKeyStateChange is not working for dynamic entrances
#2

Why not simplify the code? There's no need for two seperate commands or two seperate if(PRESSED) statements.

Try something like this:

pawn Код:
CMD:enterexit(playerid)
{
    new id = GetClosestStoreEntrance(playerid), di = StoreID[playerid];

    if(IsPlayerInRangeOfPoint(playerid, 3.0, ZoneRBInfo[id][RBentranceX], ZoneRBInfo[id][RBentranceY], ZoneRBInfo[id][RBentranceZ]))
    {
        SetPlayerPos(playerid, ZoneRBInfo[id][RBexitX], ZoneRBInfo[id][RBexitY], ZoneRBInfo[id][RBexitZ]);//Rob store exit
        SetPlayerInterior(playerid, ZoneRBInfo[id][RBinterior]);
        SetPlayerVirtualWorld(playerid, ZoneRBInfo[id][RBworld]);
        StoreID[playerid] = id;
    }

    else if(IsPlayerInRangeOfPoint(playerid, 3.0, ZoneRBInfo[di][RBexitX], ZoneRBInfo[di][RBexitY], ZoneRBInfo[di][RBexitZ]))
    {
        SetPlayerPos(playerid, ZoneRBInfo[di][RBentranceX], ZoneRBInfo[di][RBentranceY], ZoneRBInfo[di][RBentranceZ]);//Rob store entrance
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 0);
    }
   
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_SECONDARY_ATTACK))
    {
        return cmd_enterexit(playerid);
    }
   
    return 1;
}
(might not work as I'm exhausted atm but you get the point)
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)