SA-MP Forums Archive
[Include] OnPlayerVehicleDamage - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] OnPlayerVehicleDamage (/showthread.php?tid=276059)

Pages: 1 2


OnPlayerVehicleDamage - wups - 12.08.2011

OnPlayerVehicleDamage v1


So, I think there is no normal system like this on the forums.

ChangeLog:
Quote:

Version 1:
-Initial release.

Usage:
Firstly, copy both include files into /pawno/includes
Insert this code on top of your game mode after #include <a_samp>
pawn Код:
#include <OPVD>
And place this function anywhere you like:
pawn Код:
public OnPlayerVehicleDamage(playerid,vehicleid,Float:Damage)
{
    return 1;
}
Attention: If you use SetVehicleHealth or RepairVehicle in Filterscripts, add this code in all of them.
pawn Код:
#include <OPVD_SEC> // after include <a_samp>
An example:
pawn Код:
public OnPlayerVehicleDamage(playerid,vehicleid,Float:Damage)
{
    new msg[128];
    format(msg,sizeof(msg)," * You damaged vehicleid %i with %.2f",vehicleid,Damage);
    SendClientMessage(playerid,COLOR,msg);
    return 1;
}
OR a system, to turn off the engine, after a strong hit.
pawn Код:
public OnPlayerVehicleDamage(playerid,vehicleid,Float:Damage)
{
    if(Damage > 149.0)
    {
        new VehVars[7];
        GetVehicleParamsEx(vehicleid,VehVars[0],VehVars[1],VehVars[2],VehVars[3],VehVars[4],VehVars[5],VehVars[6]);
        if(VehVars[0])
        {
            SetVehicleParamsEx(vehicleid,false,VehVars[1],VehVars[2],VehVars[3],VehVars[4],VehVars[5],VehVars[6]);
            SendClientMessage(playerid,0xFF0000AA," * Your Engine Went down!");
        }
    }
}
Another nice use would be detecting heal hacks: If the Damage is negative, Check if the player is not in a mod shop, and not in a pay& spray.
Installing:
Download and save to pawn/includes folder!

Credits:
Lorenc_ inspired me

Download:
Here you go:
Version 1.0

Feel free to do anything you want with it.

v1 Has been tested.


Re: OnPlayerVehicleDamage - rbN. - 12.08.2011

Good job..

Would be also awesome if works for vehicles without driver :P


Re: OnPlayerVehicleDamage - wups - 12.08.2011

Quote:
Originally Posted by RobinOwnz
Посмотреть сообщение
Good job..

Would be also awesome if works for vehicles without driver :P
Unoccupied vehicle damage is disabled by default, so it's not really needed.


Re: OnPlayerVehicleDamage - CJoao - 12.08.2011

Another exemple:

if damage is -100 of health the vehicle, you lose 20% of your health!

Код:
public OnPlayerVehicleDamage(playerid,vehicleid,Float:Damage)
{
    new Float:health;
        if(IsPlayerConnected(playerid) && IsPlayerInVehicle(playerid,vehicleid)) {
            if(Damage > 100){ GetPlayerHealth(playerid,health); SetPlayerHealth(playerid,health-20);}
        }
    return 1;
}
Sorry For My English



Re: OnPlayerVehicleDamage - Lorenc_ - 12.08.2011

pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    return 1;
}


Pretty mad release :P
Should have some detection modes, (BUMPED CAR, SHOT_CAR)

Good job mate


Re: OnPlayerVehicleDamage - wups - 12.08.2011

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    return 1;
}


Pretty mad release :P
Should have some detection modes, (BUMPED CAR, SHOT_CAR)

Good job mate
Heh, fixed the topic.
For the suggestion, i think it's quite much scripting to do that.


Re: OnPlayerVehicleDamage - Gh0sT_ - 12.08.2011

You should add params like "oldhealth, newhealth"


Re: OnPlayerVehicleDamage - Macluawn - 12.08.2011

Quote:
Originally Posted by wups
Посмотреть сообщение
Unoccupied vehicle damage is disabled by default, so it's not really needed.
Take a parachute and hit the car.


Re: OnPlayerVehicleDamage - wups - 12.08.2011

Quote:
Originally Posted by Macluawn
Посмотреть сообщение
Take a parachute and hit the car.
LOL, I didn't know this!


Re: OnPlayerVehicleDamage - rbN. - 12.08.2011

Quote:
Originally Posted by wups
Посмотреть сообщение
LOL, I didn't know this!


weird bug anyways lol


Re: OnPlayerVehicleDamage - Darnell - 12.08.2011

This is fucking amazing :\.


Re: OnPlayerVehicleDamage - Ninoslav - 12.08.2011

This Incude are amazing, god bles you!


Re: OnPlayerVehicleDamage - Snipa - 12.08.2011

Another great include from you!


Re: OnPlayerVehicleDamage - Markx - 12.08.2011

OMG! I lost my words, simply amazingg!


Re: OnPlayerVehicleDamage - Ehab1911 - 17.08.2011

Gonna use it thanks


Re: OnPlayerVehicleDamage - dowster - 17.08.2011

Edit: wrong thread


Re: OnPlayerVehicleDamage - Darnell - 17.08.2011

Pretty amazing.
What's new on v8.1 on OPSP though ?


Re: OnPlayerVehicleDamage - wouter0100 - 17.08.2011

Quote:
Originally Posted by wups
Посмотреть сообщение
Unoccupied vehicle damage is disabled by default, so it's not really needed.
Is it possible to enable that?


Re: OnPlayerVehicleDamage - knackworst - 19.08.2011

When I save both files down to Pawno/includes and i Put the define of ur script on top of my gm (after a_samp)
and I put your function to stop the engine when there's a big hit on the car in my script. well when I compile then it says that it cannot read file from OPVD...


Re: OnPlayerVehicleDamage - wouter0100 - 19.08.2011

Not define, include.
Same by a_samp