[HELP] How to make swat trucks give armor
#1

Hi, the server I play on gives anyone who enters a swat truck free armor. I'd like to make that possible on my server. If anyone knows how to make this happen, I'd appreciate any help.
Reply
#2

this should do it

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 601){
        SetPlayerArmour(playerid, 100.0);
    }
    return 1;
}
Reply
#3

You're awesome thank you very much.

Btw, you should put that in the snippets thread.
Reply
#4

na its just simple
really this should check if you actually got in the vehicle
this kinda happens before you enter.

could be done in OnPlayerStateChange
and check if the player is a driver or passenger then if they are in SWAT(601)
if yes then give them armor.

ill update tomorrow if you like

regards.
Reply
#5

Cool. I'll be looking out for that. I'm not picky though. You still have to hit the button to enter the vehicle and thats really all that matters.
Reply
#6

Better use OnPlayerStateChange, just to make sure the player is actually in the vehicle.
OnPlayerEnter vehicles is when the player starts the animation to get in a vahicle, you can just simply walk away from it.
Reply
#7

heres the update, this is only for drivers,
let me know if you want the same for a passenger.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        if(GetVehicleModel(vehicleid) == 601)
        SetPlayerArmour(playerid, 100.0);
    }
    return 1;
}
Quote:
Originally Posted by Incog_Nito
Посмотреть сообщение
Cool. I'll be looking out for that. I'm not picky though. You still have to hit the button to enter the vehicle and thats really all that matters.
this is fine unless you have the car locked!!
this is why i posted the new way.

regards,
Reply
#8

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
heres the update, this is only for drivers,
let me know if you want the same for a passenger.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        if(GetVehicleModel(vehicleid) == 601)
        SetPlayerArmour(playerid, 100.0);
    }
    return 1;
}
Yes I would love to have it for passengers also.
Reply
#9

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && ((newstate == PLAYER_STATE_DRIVER) || (newstate == PLAYER_STATE_PASSENGER)))
    {
        if(GetVehicleModel(vehicleid) == 601)
        SetPlayerArmour(playerid, 100.0);
    }
    return 1;
}
test this
Reply
#10

I get these 2 errors...

Код:
error 017: undefined symbol "vehicleid"
error 021: symbol already defined: "OnPlayerStateChange"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)