Entering buildings
#1

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.
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Reply
#3

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

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

Where do I put this code?
Reply
#6

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.
Reply
#7

Dont forget to setplayerinterior.
Reply
#8

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)