SA-MP Forums Archive
/enter and /exit on F problem - 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: /enter and /exit on F problem (/showthread.php?tid=610644)



/enter and /exit on F problem - PepsiCola23 - 26.06.2016

I tried to make the /enter and /exit command into pressing F / Enter and it worked 50%.
When i press F to enter,nothing bad happens,it works perfectly.
When i press F to exit , it teleports me outside and then instantly back inside ,so i can`t get outside.
Here is the CMD,what`s wrong? Ty in advance.

PHP код:
    if(newkeys KEY_SECONDARY_ATTACK)
    {
    if (
PlayerToPoint(4.0playerid,1412.0304,-1700.1549,13.5395))
    {
//enter cladire-spawn
        
SetPlayerPos(playerid,16.0883,33.4171,973.3144);
        
SetPlayerFacingAngle(playerid270.7579);
        
TogglePlayerControllable(playerid0);
        
SetTimerEx("UnfreezeT"30000"d"playerid);
    }
    else if (
PlayerToPoint(2.0playerid,-1.3946,19.1643,973.3081))
    {
//sport room
        
SetPlayerPos(playerid,-1.3711,22.2146,973.4081);
    }
    else if (
PlayerToPoint(2.0playerid,22.1204,27.4664,973.3081))
    {
//main room
        
SetPlayerPos(playerid,22.1380,29.9197,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,22.2507,20.9277,973.3081))
    {
//rest room
        
SetPlayerPos(playerid,22.2184,18.6323,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,2486.5198,-1645.2394,14.0772) && faction == 2)
    {
//HQ Grove Street
        
PlayerData[playerid][InHQ] = 2;
        
SetPlayerPos(playerid,942.171997,-16.542755,1000.929687);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid2);
    }
    else if (
PlayerToPoint(2.0playerid,2000.0482,-1114.3588,27.1250) && faction == 3)
    {
//Ballas
        
PlayerData[playerid][InHQ] = 3;
        
SetPlayerPos(playerid,964.106994,-53.205497,1001.124572);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid3);
    }
    else if (
PlayerToPoint(2.0playerid,1899.4996,-2005.1289,13.5469) && faction == 4)
    {
//Varrio Nuevo Estrada
        
PlayerData[playerid][InHQ] = 4;
        
SetPlayerPos(playerid,1710.433715,-1669.379272,20.225049);
        
SetPlayerInterior(playerid,18);
        
SetPlayerVirtualWorld(playerid4);
    }
    else if (
PlayerToPoint(2.0playerid,1653.7765,-1655.5151,22.5156) && faction == 5)
    {
//SA GOV
        
PlayerData[playerid][InHQ] = 5;
        
SetPlayerPos(playerid,1494.3252,1304.9429,1093.2891);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid5);
    }
    else if (
PlayerToPoint(2.0playerid,755.3737,-1362.3281,13.5131) && faction == 6)
    {
//SAN Network
        
PlayerData[playerid][InHQ] = 6;
        
SetPlayerPos(playerid,1494.3252,1304.9429,1093.2891);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid6);
    }
    else if (
PlayerToPoint(2.0playerid,1172.4932,-1323.3479,15.4030) && faction == 7)
    {
//Emergency Dept.
        
PlayerData[playerid][InHQ] = 7;
        
SetPlayerPos(playerid,1494.3252,1304.9429,1093.2891);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid7);
    }
    else if (
PlayerToPoint(2.0playerid,1555.2115,-1675.6229,16.1953))
    {
//LS - enter - section
        
SetPlayerPos(playerid,1118.5378,328.2394,583.7659);
        
SetPlayerFacingAngle(playerid90.0);
        
TogglePlayerControllable(playerid0);
        
SetTimerEx("UnfreezeT"30000"d"playerid);
    }
    else if (
PlayerToPoint(2.0playerid,1117.6843,326.2397,583.7659))
    {
//section - enter - PD control
    
}
    else if (
PlayerToPoint(2.0playerid,1127.5112,328.8745,583.7659))
    {
//section - enter - jail
    
}
    if(
PlayerData[playerid][InHouse] > 0)
    {
        new 
PlayerData[playerid][InHouse];
        
SetPlayerPos(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
        
SetPlayerInterior(playerid,0);
        
SetPlayerVirtualWorld(playerid0);
        
PlayerData[playerid][InHouse] = -1;
    }
    if(
PlayerData[playerid][InBizz] > 0)
    {
        new 
PlayerData[playerid][InBizz];
        
PlayerData[playerid][InBizz] = -1;
        
SetPlayerInterior(playerid,0);
        
SetPlayerVirtualWorld(playerid0);
        
SetPlayerPos(playerid,BizzInfo[i][bEntranceX],BizzInfo[i][bEntranceY],BizzInfo[i][bEntranceZ]);
    }
    else if (
PlayerToPoint(2.0playerid,-1.3711,22.2146,973.4081))
    {
//sport room
        
SetPlayerPos(playerid,-1.3946,19.1643,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,22.1380,29.9197,973.3081))
    {
//main room
        
SetPlayerPos(playerid,22.1204,27.4664,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,22.2184,18.6323,973.3081))
    {
//rest room
        
SetPlayerPos(playerid,22.2507,20.9277,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,38.1737,33.4262,973.3081))
    {
//exit spawn room
        
SetPlayerPos(playerid,1412.0304,-1700.1549,13.5395);
    }
    else if (
PlayerToPoint(2.0playerid,-15.9546,32.5763,973.3081))
    {
//exit spawn room
        
SetPlayerPos(playerid,1412.0304,-1700.1549,13.5395);
    }
    else if (
PlayerToPoint(2.0playerid,942.171997,-16.542755,1000.929687))
    {
//HQ Grove Street
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,2486.5198,-1645.2394,14.0772);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,964.106994,-53.205497,1001.124572))
    {
//Ballas
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,2000.0482,-1114.3588,27.1250);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1710.433715,-1669.379272,20.225049))
    {
//Varrio Nuevo Estrada
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,1899.4996,-2005.1289,13.5469);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1494.3252,1304.9429,1093.2891) && PlayerData[playerid][InHQ] == 5)
    {
//SA GOV
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,1653.7765,-1655.5151,22.5156);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1494.3252,1304.9429,1093.2891) && PlayerData[playerid][InHQ] == 6)
    {
//SAN Network
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,755.3737,-1362.3281,13.5131);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1494.3252,1304.9429,1093.2891) && PlayerData[playerid][InHQ] == 7)
    {
//Emergency Dept.
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,1172.4932,-1323.3479,15.4030);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1119.1720,330.5911,583.7659))
    {
//section - exit - LS
        
SetPlayerPos(playerid,1552.3688,-1675.5404,16.1953);
        
SetPlayerFacingAngle(playerid90.0);
    }
    } 



Re: /enter and /exit on F problem - Matz - 26.06.2016

Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
Use
Код:
if(PRESSED(KEY_SECONDARY_ATTACK))
Instead of

Код:
if(newkeys & KEY_SECONDARY_ATTACK)
Edit: It can be a problem related to range, if exit and enters are very close. So you can decrease its range


Re: /enter and /exit on F problem - PepsiCola23 - 26.06.2016

Right now it looks like this:

Still got the same bug...

PHP код:
    if(PRESSED(KEY_SECONDARY_ATTACK))
    {
    if (
PlayerToPoint(4.0playerid,1412.0304,-1700.1549,13.5395))
    {
//enter cladire-spawn
        
SetPlayerPos(playerid,16.0883,33.4171,973.3144);
        
SetPlayerFacingAngle(playerid270.7579);
        
TogglePlayerControllable(playerid0);
        
SetTimerEx("UnfreezeT"30000"d"playerid);
    }
    else if (
PlayerToPoint(2.0playerid,-1.3946,19.1643,973.3081))
    {
//sport room
        
SetPlayerPos(playerid,-1.3711,22.2146,973.4081);
    }
    else if (
PlayerToPoint(2.0playerid,22.1204,27.4664,973.3081))
    {
//main room
        
SetPlayerPos(playerid,22.1380,29.9197,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,22.2507,20.9277,973.3081))
    {
//rest room
        
SetPlayerPos(playerid,22.2184,18.6323,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,2486.5198,-1645.2394,14.0772) && faction == 2)
    {
//HQ Grove Street
        
PlayerData[playerid][InHQ] = 2;
        
SetPlayerPos(playerid,942.171997,-16.542755,1000.929687);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid2);
    }
    else if (
PlayerToPoint(2.0playerid,2000.0482,-1114.3588,27.1250) && faction == 3)
    {
//Ballas
        
PlayerData[playerid][InHQ] = 3;
        
SetPlayerPos(playerid,964.106994,-53.205497,1001.124572);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid3);
    }
    else if (
PlayerToPoint(2.0playerid,1899.4996,-2005.1289,13.5469) && faction == 4)
    {
//Varrio Nuevo Estrada
        
PlayerData[playerid][InHQ] = 4;
        
SetPlayerPos(playerid,1710.433715,-1669.379272,20.225049);
        
SetPlayerInterior(playerid,18);
        
SetPlayerVirtualWorld(playerid4);
    }
    else if (
PlayerToPoint(2.0playerid,1653.7765,-1655.5151,22.5156) && faction == 5)
    {
//SA GOV
        
PlayerData[playerid][InHQ] = 5;
        
SetPlayerPos(playerid,1494.3252,1304.9429,1093.2891);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid5);
    }
    else if (
PlayerToPoint(2.0playerid,755.3737,-1362.3281,13.5131) && faction == 6)
    {
//SAN Network
        
PlayerData[playerid][InHQ] = 6;
        
SetPlayerPos(playerid,1494.3252,1304.9429,1093.2891);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid6);
    }
    else if (
PlayerToPoint(2.0playerid,1172.4932,-1323.3479,15.4030) && faction == 7)
    {
//Emergency Dept.
        
PlayerData[playerid][InHQ] = 7;
        
SetPlayerPos(playerid,1494.3252,1304.9429,1093.2891);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid7);
    }
    else if (
PlayerToPoint(2.0playerid,1555.2115,-1675.6229,16.1953))
    {
//LS - enter - section
        
SetPlayerPos(playerid,1118.5378,328.2394,583.7659);
        
SetPlayerFacingAngle(playerid90.0);
        
TogglePlayerControllable(playerid0);
        
SetTimerEx("UnfreezeT"30000"d"playerid);
    }
    else if (
PlayerToPoint(2.0playerid,1117.6843,326.2397,583.7659))
    {
//section - enter - PD control
    
}
    else if (
PlayerToPoint(2.0playerid,1127.5112,328.8745,583.7659))
    {
//section - enter - jail
    
}
    if(
PlayerData[playerid][InHouse] > 0)
    {
        new 
PlayerData[playerid][InHouse];
        
SetPlayerPos(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
        
SetPlayerInterior(playerid,0);
        
SetPlayerVirtualWorld(playerid0);
        
PlayerData[playerid][InHouse] = -1;
    }
    if(
PlayerData[playerid][InBizz] > 0)
    {
        new 
PlayerData[playerid][InBizz];
        
PlayerData[playerid][InBizz] = -1;
        
SetPlayerInterior(playerid,0);
        
SetPlayerVirtualWorld(playerid0);
        
SetPlayerPos(playerid,BizzInfo[i][bEntranceX],BizzInfo[i][bEntranceY],BizzInfo[i][bEntranceZ]);
    }
    else if (
PlayerToPoint(2.0playerid,-1.3711,22.2146,973.4081))
    {
//sport room
        
SetPlayerPos(playerid,-1.3946,19.1643,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,22.1380,29.9197,973.3081))
    {
//main room
        
SetPlayerPos(playerid,22.1204,27.4664,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,22.2184,18.6323,973.3081))
    {
//rest room
        
SetPlayerPos(playerid,22.2507,20.9277,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,38.1737,33.4262,973.3081))
    {
//exit spawn room
        
SetPlayerPos(playerid,1412.0304,-1700.1549,13.5395);
    }
    else if (
PlayerToPoint(2.0playerid,-15.9546,32.5763,973.3081))
    {
//exit spawn room
        
SetPlayerPos(playerid,1412.0304,-1700.1549,13.5395);
    }
    else if (
PlayerToPoint(2.0playerid,942.171997,-16.542755,1000.929687))
    {
//HQ Grove Street
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,2486.5198,-1645.2394,14.0772);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,964.106994,-53.205497,1001.124572))
    {
//Ballas
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,2000.0482,-1114.3588,27.1250);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1710.433715,-1669.379272,20.225049))
    {
//Varrio Nuevo Estrada
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,1899.4996,-2005.1289,13.5469);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1494.3252,1304.9429,1093.2891) && PlayerData[playerid][InHQ] == 5)
    {
//SA GOV
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,1653.7765,-1655.5151,22.5156);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1494.3252,1304.9429,1093.2891) && PlayerData[playerid][InHQ] == 6)
    {
//SAN Network
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,755.3737,-1362.3281,13.5131);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1494.3252,1304.9429,1093.2891) && PlayerData[playerid][InHQ] == 7)
    {
//Emergency Dept.
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,1172.4932,-1323.3479,15.4030);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1119.1720,330.5911,583.7659))
    {
//section - exit - LS
        
SetPlayerPos(playerid,1552.3688,-1675.5404,16.1953);
        
SetPlayerFacingAngle(playerid90.0);
    }
    }