SA-MP Forums Archive
Entering buildings - 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: Entering buildings (/showthread.php?tid=545343)



Entering buildings - AdzeeH - 07.11.2014

Hello,

I've seen this on plenty of servers but i've never known myself how to do it.

When you enter buildings / houses / businesses instead of typing /enter you can just press 'Y' and you'll enter, how can I do this?

Thanks.


Re: Entering buildings - Capua - 07.11.2014

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange


Re: Entering buildings - AdzeeH - 07.11.2014

Quote:
Originally Posted by Capua
Посмотреть сообщение
Would you be able to do a script for me so I can add it into my server?


Re: Entering buildings - Sabur - 08.11.2014

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if (PRESSED(KEY_YES))
	{
        return cmd_enter(playerid, params[]);
	}
	return 1;
}
There you go.


Re: Entering buildings - AdzeeH - 10.11.2014

Where do I put this code?


Re: Entering buildings - HY - 10.11.2014

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (PRESSED( KEY_FIRE ))
    {
        SetPlayerPos(playerid, X,Y,Z);
    }
    return 1;
}

/*

Example of script ;

*/
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

- Add that public, in your GM/Filescript. If you have it, only put define at the top of script and code inside public.


Re: Entering buildings - Dziugsas - 10.11.2014

Dont forget to setplayerinterior.


Re: Entering buildings - AdzeeH - 10.11.2014

Can you explain this a bit more? Where do I put the code and what's the exact script of it?


Re: Entering buildings - Pottus - 11.11.2014

Quote:
Originally Posted by AdzeeH
Посмотреть сообщение
Where do I put this code?
I couldn't stop laughing when I read this, this section is for people who already know how to script but have a problem. You should really look at the tutorials first before trying to do these kinds of things.