10.08.2014, 04:35
I've been working in a dynamic entrance/exit system.
I have the following cmds:
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.
Thanks for replying.
I have the following cmds:
PHP код:
CMD:enter(playerid, params[])
{
new id = GetClosestStoreEntrance(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;
}
return 1;
}
CMD:exit(playerid, params[])
{
new di = StoreID[playerid];
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;
}
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_SECONDARY_ATTACK))
{
new id = GetClosestStoreEntrance(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;
}
}
if(PRESSED(KEY_SECONDARY_ATTACK))
{
new di = StoreID[playerid];
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;
}