OnPlayerKeyStateChange is not working for dynamic entrances
#1

I've been working in a dynamic entrance/exit system.

I have the following cmds:

PHP код:
CMD:enter(playeridparams[])
{
    new 
id GetClosestStoreEntrance(playerid);
    if(
IsPlayerInRangeOfPoint(playerid3.0ZoneRBInfo[id][RBentranceX], ZoneRBInfo[id][RBentranceY], ZoneRBInfo[id][RBentranceZ]))
    {
        
SetPlayerPos(playeridZoneRBInfo[id][RBexitX], ZoneRBInfo[id][RBexitY], ZoneRBInfo[id][RBexitZ]);//Rob store exit
        
SetPlayerInterior(playeridZoneRBInfo[id][RBinterior]);
        
SetPlayerVirtualWorld(playeridZoneRBInfo[id][RBworld]);
        
StoreID[playerid] = id;
    }
    return 
1;
}
CMD:exit(playeridparams[])
{
    new 
di StoreID[playerid];
    if(
IsPlayerInRangeOfPoint(playerid3.0ZoneRBInfo[di][RBexitX], ZoneRBInfo[di][RBexitY], ZoneRBInfo[di][RBexitZ]))
    {
        
SetPlayerPos(playeridZoneRBInfo[di][RBentranceX], ZoneRBInfo[di][RBentranceY], ZoneRBInfo[di][RBentranceZ]);//Rob store entrance
        
SetPlayerInterior(playerid0);
        
SetPlayerVirtualWorld(playerid0);
    }
    return 
1;

Those cmds given above work great, however I want to set a lonely key to enter/exit. However, it only works for entering a interior but it doesn't work once you want to exit it.

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
PRESSED(KEY_SECONDARY_ATTACK))
    {
        new 
id GetClosestStoreEntrance(playerid);
        if(
IsPlayerInRangeOfPoint(playerid3.0ZoneRBInfo[id][RBentranceX], ZoneRBInfo[id][RBentranceY], ZoneRBInfo[id][RBentranceZ]))
        {
            
SetPlayerPos(playeridZoneRBInfo[id][RBexitX], ZoneRBInfo[id][RBexitY], ZoneRBInfo[id][RBexitZ]);//Rob store exit
            
SetPlayerInterior(playeridZoneRBInfo[id][RBinterior]);
            
SetPlayerVirtualWorld(playeridZoneRBInfo[id][RBworld]);
            
StoreID[playerid] = id;
        }
    }
    if(
PRESSED(KEY_SECONDARY_ATTACK))
    {
        new 
di StoreID[playerid];
        if(
IsPlayerInRangeOfPoint(playerid3.0ZoneRBInfo[di][RBexitX], ZoneRBInfo[di][RBexitY], ZoneRBInfo[di][RBexitZ]))
        {
            
SetPlayerPos(playeridZoneRBInfo[di][RBentranceX], ZoneRBInfo[di][RBentranceY], ZoneRBInfo[di][RBentranceZ]);//Rob store entrance
            
SetPlayerInterior(playerid0);
            
SetPlayerVirtualWorld(playerid0);
        }
    }
    return 
1;

Thanks for replying.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)