Detecting when a player picks up a jetpack
#1

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

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

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

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

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

Should work fine.
Reply
#6

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

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

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

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)