SA-MP Forums Archive
Changing the way you enter into a door using a button or automattly? - 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: Changing the way you enter into a door using a button or automattly? (/showthread.php?tid=544832)



Changing the way you enter into a door using a button or automattly? - dionisak0s - 04.11.2014

I would like to make a system where you will enter automattly into a door/house or once you press a certain button, can someone give me an example on how to do it?


Re: Changing the way you enter into a door using a button or automattly? - HY - 04.11.2014

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
   
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED( KEY_FIRE )) // If pressed KEY_FIRE (LMB)
    {
        if(IsPlayerInRangeOfPoint(playerid, RANGE, X,Y,Z)) // Range = Distance when he can press KEY_FIRE, X,Y,Z : Checkpoint/Pick-up/Door position !
        SetPlayerInterior(playerid, 15); // Will set his interior 15, example !
    }
    return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

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


Re: Changing the way you enter into a door using a button or automattly? - Runn3R - 04.11.2014

You can do it with public OnPlayerEnterDynamicCheckpoint(playerid, streamid)... //Without clicking a button

Create dynamic checkpoints on every entrance/doors with a stream of 5.0 so they don't show on screen the whole time..

With clicking a button check OnPlayerKeyStateChange on the SA:MP wiki.

Also you'll need to loop through all the houses/entrances when the player presses the key.


Re: Changing the way you enter into a door using a button or automattly? - dionisak0s - 04.11.2014

Quote:
Originally Posted by HY
Посмотреть сообщение
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
   
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED( KEY_FIRE )) // If pressed KEY_FIRE (LMB)
    {
        if(IsPlayerInRangeOfPoint(playerid, RANGE, X,Y,Z)) // Range = Distance when he can press KEY_FIRE, X,Y,Z : Checkpoint/Pick-up/Door position !
        SetPlayerInterior(playerid, 15); // Will set his interior 15, example !
    }
    return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Alright thanks, I will try to do it. By the way can you tell me the name of the button that you steal cars ENTER/F?


Re: Changing the way you enter into a door using a button or automattly? - HY - 04.11.2014

Enter = KEY_SECONDARY_ATTACK

You can search more at : https://sampwiki.blast.hk/wiki/Keys


Re: Changing the way you enter into a door using a button or automattly? - dionisak0s - 04.11.2014

Quote:
Originally Posted by HY
Посмотреть сообщение
Enter = KEY_SECONDARY_ATTACK

You can search more at : https://sampwiki.blast.hk/wiki/Keys
Alright thank you very much.