SA-MP Forums Archive
[HELP] How to make swat trucks give armor - 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: [HELP] How to make swat trucks give armor (/showthread.php?tid=334198)



[HELP] How to make swat trucks give armor - Incog_Nito - 14.04.2012

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.


Re: [HELP] How to make swat trucks give armor - Jonny5 - 14.04.2012

this should do it

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



Re: [HELP] How to make swat trucks give armor - Incog_Nito - 14.04.2012

You're awesome thank you very much.

Btw, you should put that in the snippets thread.


Re: [HELP] How to make swat trucks give armor - Jonny5 - 14.04.2012

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.


Re: [HELP] How to make swat trucks give armor - Incog_Nito - 14.04.2012

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.


Re: [HELP] How to make swat trucks give armor - Shetch - 14.04.2012

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.


Re: [HELP] How to make swat trucks give armor - Jonny5 - 14.04.2012

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,


Re: [HELP] How to make swat trucks give armor - Incog_Nito - 14.04.2012

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.


Re: [HELP] How to make swat trucks give armor - Jonny5 - 14.04.2012

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


Re: [HELP] How to make swat trucks give armor - Incog_Nito - 14.04.2012

I get these 2 errors...

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