Is it possible?
#1

Hello, i have /enter command to enter buildings etc. Now is it possible to make it enterable with the enter key but without creating everything new, so if a player presses ENTER KEY, it automaticly calls the /enter command?
Reply
#2

pawn Код:
CallLocalFunction("OnPlayerCommandText", "is", playerid, "/enter");
Reply
#3

Thank you but i use zcmd so i don't think OnPlayerCommandText is for it
Reply
#4

If you're using ZCMD, you can just call cmd_enter(playerid, "parameters");. You can use CallLocalFunction to call this, but I'm not sure if it's anymore effective than just calling the function directly.
Reply
#5

I just tested with OnPlayerCommandText and it's working ^^ thanks +rep for both
Reply
#6

Okay i have a small problem there, if i press enter it automaticly stops me from walking, example if i want to enter a car

pawn Код:
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys)
{
    if(newkeys & 16)
    {
        CallLocalFunction("OnPlayerCommandText", "is", playerid, "/enter");
        CallLocalFunction("OnPlayerCommandText", "is", playerid, "/exit");
    }
Reply
#7

Check if player near any door, then execute the CallLocalFunction fucntion.
Reply
#8

Quote:
Originally Posted by =WoR=Varth
Посмотреть сообщение
Check if player near any door, then execute the CallLocalFunction fucntion.
No, it's only somehow buggy with the /exit command, if i type /exit the player automaticly stops moving, but /enter is fine and the commands are almost the same
Reply
#9

Code?
I suggest you to do my advise, check if player near any door then execute the CallLocalFunction function, if not, it will called everytime you press ENTER KEY.
Reply
#10

Quote:
Originally Posted by =WoR=Varth
Посмотреть сообщение
Code?
I suggest you to do my advise, check if player near any door then execute the CallLocalFunction function, if not, it will called everytime you press ENTER KEY.
Doesn't really matter if it gets called everytime, here the command

pawn Код:
CMD:exit(playerid, params[])
    {
        if(IsPlayerConnected(playerid))
        {
            for(new i = 0; i < sizeof(Houses); i++)
            {
                if(IsPlayerInRangeOfPoint( playerid, 3, Houses[PlayerInfo[playerid][pInHouse]][hInteriorX], Houses[PlayerInfo[playerid][pInHouse] ][hInteriorY], Houses[PlayerInfo[playerid][pInHouse] ][hInteriorZ]) )
                {
                        SetPlayerVirtualWorld( playerid, 0 );
                        SetPlayerInterior( playerid, 0);
                        SetPlayerPos( playerid, Houses[PlayerInfo[playerid][pInHouse]][hExteriorX], Houses[PlayerInfo[playerid][pInHouse]][hExteriorY], Houses[PlayerInfo[playerid][pInHouse]][hExteriorZ]);
                        PlayerInfo[playerid][pInHouse] = 0;

                }
            }
            for( new i = 0; i < sizeof( Businesses ); i++ )
            {
                if(IsPlayerInRangeOfPoint( playerid, 3, Businesses[PlayerInfo[playerid][pInBusiness] ][bInteriorX], Businesses[PlayerInfo[playerid][pInBusiness] ][bInteriorY], Businesses[PlayerInfo[playerid][pInBusiness] ][bInteriorZ]) )
                {

                            SetPlayerInterior( playerid, 0);
                            SetPlayerPos( playerid, Businesses[PlayerInfo[playerid][pInBusiness] ][bExteriorX], Businesses[PlayerInfo[playerid][pInBusiness] ][bExteriorY], Businesses[PlayerInfo[playerid][pInBusiness] ][bExteriorZ]);
                            SetPlayerVirtualWorld(playerid, 0);
                            PlayerInfo[playerid][pInBusiness] = 0;

                }
            }
            for(new i = 0; i <  sizeof(BizzInfo); i++)
            {
                //printf("Bizz :%d",i);
                if (PlayerToPoint(3, playerid,BizzInfo[i][bExitX], BizzInfo[i][bExitY], BizzInfo[i][bExitZ]))
                {
                    SetPlayerInterior(playerid,0);
                    PlayerInfo[playerid][pInt] = 0;
                    SetPlayerPos(playerid,BizzInfo[i][bEntranceX],BizzInfo[i][bEntranceY],BizzInfo[i][bEntranceZ]);
                    PlayerInfo[playerid][pLocal] = 255;
                }
            }
            new carid = GetPlayerVehicleID(playerid);
            if(IsARentCar(carid) || IsARentBike(carid) || IsARentBike1(carid) || IsAnAvioRent(carid) ||IsABike25(carid))
            {
                TogglePlayerControllable(playerid, 1);
                RemovePlayerFromVehicle(playerid);
                TextDrawDestroy(Cijena1[playerid]);
                TextDrawHideForPlayer(playerid, Cijena1[playerid]);

                TextDrawHideForPlayer(playerid, Rentcar);

            }
            if (PlayerToPoint(3.0, playerid,387.7978,173.8582,1008.3828))
            {
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,1481.0206,-1771.1138,18.7958);
                PlayerInfo[playerid][pInt] = 0;
                PlayerInfo[playerid][pLocal] = 255;
            }
            if (PlayerToPoint(3.0, playerid,834.1572,7.3856,1004.1870)) // Casino
            {
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,1368.3273,-1432.3353,14.0547);
                GameTextForPlayer(playerid, "~y~Los Santos", 5000, 1);
                PlayerInfo[playerid][pInt] = 0;
            }
            if(IsPlayerInRangeOfPoint(playerid, 3.0, 1705.3492,1183.5206,35.8359))
            {
                SetPlayerPos(playerid, 1734.4749,1169.5908,10.8203);
            }
            else if (PlayerToPoint(3.0, playerid,288.8122,166.9863,1007.1719))
            {
                if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
                {
                    SetPlayerInterior(playerid,3);
                    SetPlayerPos(playerid,611.0582,-583.4951,18.2109);
                    PlayerInfo[playerid][pInt] = 0;

                }
            }
            if (IsPlayerInRangeOfPoint( playerid,3.0, 318.68615722656,1114.8942871094,1083.8828125))
            {
                if(PlayerInfo[playerid][pMember] != 1 || PlayerInfo[playerid][pMember] != 2 || PlayerInfo[playerid][pMember] != 3 || PlayerInfo[playerid][pLeader] != 1 || PlayerInfo[playerid][pLeader] != 2 || PlayerInfo[playerid][pLeader] != 3 )
                {

                if(GetPVarInt(playerid, "Job") == 4)
                {
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,2362.9539,-654.0048,128.9525);
                PlayerInfo[playerid][pInt] = 0;
                PlayerInfo[playerid][pLocal] = 0;
                }
            }
            }
            if (IsPlayerInRangeOfPoint( playerid,3.0,2541.9001464844, -1304.0466308594, 1025.0703125))
            {
                if(PlayerInfo[playerid][pMember] != 1 || PlayerInfo[playerid][pMember] != 2 || PlayerInfo[playerid][pMember] != 3 || PlayerInfo[playerid][pLeader] != 1 || PlayerInfo[playerid][pLeader] != 2 || PlayerInfo[playerid][pLeader] != 3 )
                {
                if(GetPVarInt(playerid, "Job") == 4 )
                {
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,2508.2346,-2205.7024,13.5469);
                GameTextForPlayer(playerid, "~w~Willkommen in der Fabrik", 5000, 1);
                PlayerInfo[playerid][pInt] = 0;
                PlayerInfo[playerid][pLocal] = 0;
                }
            }
            }
            else if (PlayerToPoint(3.0, playerid,-2158.8403320313,642.78790283203,1052.375))
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid, 2196.6521,1677.1517,12.3672);
                }

            else if (PlayerToPoint(3.0, playerid,2305.6890,-16.0881,26.7496))
            {

                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid,1462.3958,-1012.3912, 26.8438);
                    PlayerInfo[playerid][pInt] = 0;
            }
            else if (PlayerToPoint(3.0, playerid,1204.7012939453, -1812.1450195313, 30.035457611084))
                {
                if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10)
                {
                    SetPlayerInterior(playerid,3);
                    SetPlayerPos(playerid,1038.3101806641, -3.9410219192505, 1001.2844848633);
                    PlayerInfo[playerid][pInt] = 3;
                }
            }
            else if (PlayerToPoint(3.0, playerid,2187.9929,1697.2837,20.3906)) // Yakuza exit von landeplatz
                {
                if(PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
                {
                    SetPlayerInterior(playerid,1);
                    SetPlayerPos(playerid,-2170.7009,645.2266,1057.5938);
                    PlayerInfo[playerid][pInt] = 1;
                }
            }
            else if (PlayerToPoint(3.0, playerid,-2158.7041,642.6734,1052.3750)) // Yakuza exit von innen
                {
                if(PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid,937.6331,1733.2104,8.8516);
                    PlayerInfo[playerid][pInt] = 0;
                }
            }
            else if (PlayerToPoint(3.0, playerid,-2636.8112792969,1403.1235351563,906.4609375))
            {
                if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid, 1213.1655273438, -1655.0930175781,10.796875);
                    PlayerInfo[playerid][pInt] = 0;
                }
            }
            else if (PlayerToPoint(3.0, playerid,246.44731140137,107.80811309814,1003.21875))
            {
                if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid,937.5753,1733.2877,8.8516);
                    PlayerInfo[playerid][pInt] = 0;

                }
            }
            else if (PlayerToPoint(3.0, playerid,952.9737,1773.9888,15.7941))
            {
                if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid,960.6966,1773.2705,8.8516);
                    PlayerInfo[playerid][pInt] = 0;

                }
            }
            else if (PlayerToPoint(3.0, playerid,1274.5483398438,-1689.0384521484,34.79907989502))
            {
                if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
                {
                    SetPlayerInterior(playerid,3);
                    SetPlayerPos(playerid, -2634.4772949219, 1409.7459716797,906.46466064453);
                    PlayerInfo[playerid][pInt] = 3;
                }
            }
            else if (PlayerToPoint(3.0, playerid,238.72360229492,138.92004394531,1003.0234375))
                {
                if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid,627.5256,-571.8169,17.6686);
                    PlayerInfo[playerid][pInt] = 0;
                }
            }
            else if (PlayerToPoint(3.0, playerid,1726.8814697266,-1638.4230957031,20.22322845459))
            {
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,1172.3878173828,-1325.3787841797,15.406136512756);
                GameTextForPlayer(playerid, "~w~LS Medical Department", 5000, 1);
                PlayerInfo[playerid][pInt] = 0;
            }
            else if (PlayerToPoint(3.0, playerid,1163.3824462891,-1329.9652099609,31.484870910645))
            {
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,1147.9493408203,-1343.2375488281,13.647164344788);
                GameTextForPlayer(playerid, "~w~LS Medical Department", 5000, 1);
                PlayerInfo[playerid][pInt] = 0;
            }
            else if (PlayerToPoint(3.0, playerid,2187.9099,1696.7245,20.3906))
            {
                if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10)
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid,1221.9865722656, -1811.9674072266, 16.59375);
                    PlayerInfo[playerid][pInt] = 0;
                }
            }
            else if (PlayerToPoint(3.0, playerid,-229.0830078125, 1401.263671875, 27.765625))
            {
                if(PlayerInfo[playerid][pMember] == 12||PlayerInfo[playerid][pLeader] == 12)
                {
                GameTextForPlayer(playerid, "~y~Mara  ~n~ Salvatrucha", 5000, 1);
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid, 2795.6608886719,-1619.4602050781,10.921875);
                }
            }
            else if (PlayerToPoint(3.0, playerid, 2791.8693847656, -1629.4299316406, 21.366069793701))
            {
                if(PlayerInfo[playerid][pMember] == 12||PlayerInfo[playerid][pLeader] == 12)
                {
                GameTextForPlayer(playerid, "~y~Mara  ~n~ Salvatrucha", 5000, 1);
                SetPlayerInterior(playerid,18);
                SetPlayerPos(playerid, -217.90686035156,1402.7664794922,27.7734375);
                }
            }
            else if (PlayerToPoint(3.0, playerid, 966.53601074219, -53.183700561523, 1001.1245727539))
            {
                if(PlayerInfo[playerid][pMember] == 13||PlayerInfo[playerid][pLeader] == 13)
                {
                GameTextForPlayer(playerid, "~y~Crips ", 5000, 1);
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid, 2000.0712,-1114.1925,27.1250);
                }
            }
            else if (PlayerToPoint(6.0, playerid,-1404.5299,-259.0602,1043.6563))
            {
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,2695.6235,-1704.6960,11.8438);
            }
            else if (PlayerToPoint(3.0, playerid,1565.080078125,-1686.3544921875,28.395587921143))
            {
                if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
                {
                GameTextForPlayer(playerid, "~w~LSPD Landeplatz", 5000, 1);
                SetPlayerInterior(playerid,6);
                SetPlayerPos(playerid,246.49775695801,88.030456542969,1003.640625);
                }
            }
            else if (PlayerToPoint(3.0, playerid,2000.5802,1874.1870,27.4594))
            {
                if(PlayerInfo[playerid][pMember] == 5||PlayerInfo[playerid][pLeader] == 5)
                {
                GameTextForPlayer(playerid, "~w~La Cosa Nostra", 5000, 1);
                SetPlayerInterior(playerid,5);
                SetPlayerPos(playerid,1287.5757,-772.3320,1091.9063);
                }
            }
            else if (PlayerToPoint(3.0, playerid,1261.0331,-785.3127,1091.9063))
            {
                if(PlayerInfo[playerid][pMember] == 5||PlayerInfo[playerid][pLeader] == 5)
                {
                GameTextForPlayer(playerid, "~y~Las Venturas", 5000, 1);
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,2017.6384,1919.8505,12.3421);
                }
            }
            else if (PlayerToPoint(3.0, playerid,-2026.9858398438, -104.23425292969, 1035.171875))
            {
                if(PlayerInfo[playerid][pMember] == 9||PlayerInfo[playerid][pLeader] == 9)
                {
                GameTextForPlayer(playerid, "~w~Cable News Network", 5000, 1);
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,302.9536,-1534.1265,24.9219);
                }
            }
            else if (PlayerToPoint(3.0, playerid,-2029.8651123047, -119.2935333252, 1035.171875))
            {
                if(PlayerInfo[playerid][pMember] == 9||PlayerInfo[playerid][pLeader] == 9)
                {
                GameTextForPlayer(playerid, "~w~Cable News Network", 5000, 1);
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,324.0020,-1518.4167,36.0325);
                }
            }
            else if (PlayerToPoint(3.0, playerid, 246.7840,63.9002,1003.6406))
            {
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,1553.1412,-1675.6227,16.1953);
            }
            else if (PlayerToPoint(8.0, playerid,-1443.0554,-581.1879,1055.0472))
            {
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,-2111.5686,-443.9720,38.7344);
            }
            else if (PlayerToPoint(8.0, playerid,-1464.7732,1557.5533,1052.5313))
            {
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,-2080.3079,-406.0309,38.7344);
            }
            else if(NoFuel[playerid] == 1)
            {
                TogglePlayerControllable(playerid, 1);
                RemovePlayerFromVehicle(playerid);
                NoFuel[playerid] = 0;
            }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)