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



enter and exit - AhmedMohamed - 25.03.2014

I see in many servers that you can enter bussines/pd/hospital/etc. by pressing " y "
how can i do it?


Re: enter and exit - AhmedMohamed - 25.03.2014

bump


Re: enter and exit - vassilis - 25.03.2014

you use the OnPlayerKeyStateChange callback!


Re: enter and exit - AhmedMohamed - 25.03.2014

what function should i use on that callback ??
please explain more


Re: enter and exit - Kyance - 25.03.2014

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_YES)
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, /*Coordinate1*/, /*Coordinate2*/, /*Coordinate3*/)
        {
            //Stuff here
        }
    }
    return 1;
}



Re: enter and exit - AhmedMohamed - 25.03.2014

REP+ kyance but i am still not understand , I wanna know how you do it?


Re: enter and exit - AhmedMohamed - 25.03.2014

heey!!


Re: enter and exit - vassilis - 25.03.2014

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_YES)
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, float:x, float:y, float:z) // gets if the player is close to the point you want him to enter.. if he is.. then if he press KEY_YES he will be teleported on the pos you will set
        {
            SetPlayerPos(playerid,Float:x,Float:y,Float:z);
        }
    }
    return 1;
}



Re: enter and exit - Konstantinos - 25.03.2014

An example of another thread I posted in: http://forum.sa-mp.com/showpost.php?...07&postcount=2

Replace cmd_enter(playerid, ""); and cmd_exit(playerid, ""); with your code for entering and exiting.


Re: enter and exit - AhmedMohamed - 25.03.2014

thanks again