SA-MP Forums Archive
Detecting when a player picks up a jetpack - 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: Detecting when a player picks up a jetpack (/showthread.php?tid=566207)



Detecting when a player picks up a jetpack - Derexi - 04.03.2015

I have a command that creates a jetpack for a player, but when they press enter and the jetpack appears next to them, I need to detect if they walk into it. How can I do this?


Re: Detecting when a player picks up a jetpack - Ritzy2K - 04.03.2015

Uhm....I don't really get you...but if u want to see if the player enters jetpack after being on foot...m not sure if m saying.right...but under OnPlayerUpdate u can check if a player's SPECIAL_ACTION_FOOT or ONFOOT m not sure changes to SPECIAL_ACTION_JETPACK hope I helped m newbie so I couldn't make a code


Re : Detecting when a player picks up a jetpack - Golimad - 04.03.2015

https://sampwiki.blast.hk/wiki/OnPlayerPickUpPickup
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == 370)
    {
        // code
    }
     return 1;
}



Re: Re : Detecting when a player picks up a jetpack - Jimmy0wns - 04.03.2015

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
Where did you get id 370 from? Are you sure this works? Did you test it?
How about you use your mind and look it up?
Or what about testing it? hmm


Re: Detecting when a player picks up a jetpack - Djole1337 - 04.03.2015

https://gist.github.com/anonymous/81b132445e35df3a4681

Should work fine.


AW: Detecting when a player picks up a jetpack - Kaliber - 04.03.2015

The pickup model, is not the pickupid!!!

So you must do sth like this:

PHP код:
new jetpack;
//OnGameModeInit
jetpack CreatePickup(370,...);
public 
OnPlayerPickUpPickup(playeridpickupid)
{
    if(
pickupid == jetpack)
    {
        
// code
    
}
    return 
1;

Greekz


Re : Detecting when a player picks up a jetpack - Golimad - 04.03.2015

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

Sorry I forgot to mention the source.
And Kaliber is right


Re: Detecting when a player picks up a jetpack - nickdodd25 - 04.03.2015

Why are you thinking that onplayerpickup gets called for jetpacks? You didn't test that did you? The only possibly way it can is if the server created a pickup for jetpacks, then yes onplayerpickup will get called.

He would need to use the SPECIAL_ACTION_USEJETPACK method, so Djole1337's method he suggested would be the best bet.


Re: Re : Detecting when a player picks up a jetpack - Vince - 04.03.2015

Quote:
Originally Posted by Jimmy0wns
Посмотреть сообщение
How about you use your mind and look it up?
Or what about testing it? hmm
I'm fairly sure that was a rhetorical question because I'm pretty sure that he already realized that it, in fact, would not work; pickupid != modelid.