Enter buildings by key..
#1

Hey.. I have this part of my /enter command.. but I want people to enter the buildings by pressing left shift (its sprint) i tried few things.. but just couldnt figure it out..
anyway.. this is the part of my /enter..

Код:
if(strcmp(cmd, "/enter", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
		    if (PlayerToPoint(2.0, playerid,2232.8140,-1159.8369,25.8906))
			{
			    if (GetPlayerKeys(playerid,KEY_SPRINT,&updown, &leftright);
			    {
			    SetPlayerInterior(playerid,15);
				SetPlayerPos(playerid,2214.6133,-1150.4756,1025.7969);
				GameTextForPlayer(playerid, "~w~Welcome to the Jefferson Hotel", 5000, 1);
				}
			}
btw.. i would love if someone explain to me how to do it instaed of just posting the code
thanks
Reply
#2

pawn Код:
//onplayerKEYstatechange
if((newkeys & (KEY_SPRINT)) == (KEY_SPRINT))
    return OnPlayerCommandText(playerid, "/enter");
Reply
#3

Do I need to add it in the public onplayerKEYstatechange?
Reply
#4

Yes... search for
pawn Код:
OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
in your script.
Reply
#5

Does
pawn Код:
if((newkeys & (KEY_SPRINT)) == (KEY_SPRINT))
actually work? It looks kinda strange to me.

If that doesn't work, replace it with

pawn Код:
if(newkeys & KEY_FIRE && !(oldkeys & KEY_FIRE))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)