PDA

View Full Version : Detecting when a player picks up a jetpack


Derexi
04/03/2015, 01:04 PM
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?

Ritzy2K
04/03/2015, 01:09 PM
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 :(

Golimad
04/03/2015, 01:13 PM
http://wiki.sa-mp.com/wiki/OnPlayerPickUpPickup

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == 370)
{
// code
}
return 1;
}

Jimmy0wns
04/03/2015, 01:17 PM
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? (http://wiki.sa-mp.com/wiki/Pickup_IDs)
Or what about testing it? hmm

Djole1337
04/03/2015, 01:22 PM
https://gist.github.com/anonymous/81b132445e35df3a4681

Should work fine.

Kaliber
04/03/2015, 01:22 PM
The pickup model, is not the pickupid!!!

So you must do sth like this:

new jetpack;

//OnGameModeInit
jetpack = CreatePickup(370,...);

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == jetpack)
{
// code
}
return 1;
}

Greekz :cool:

Golimad
04/03/2015, 01:23 PM
http://wiki.sa-mp.com/wiki/Pickup_IDs

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

nickdodd25
04/03/2015, 02:51 PM
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.

Vince
04/03/2015, 03:03 PM
How about you use your mind and look it up? (http://wiki.sa-mp.com/wiki/Pickup_IDs)
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.