[Include] OnPlayerVehicleDamage
#1

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

Good job..

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

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

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

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

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

You should add params like "oldhealth, newhealth"
Reply
#8

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

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

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


weird bug anyways lol
Reply
#11

This is fucking amazing :\.
Reply
#12

This Incude are amazing, god bles you!
Reply
#13

Another great include from you!
Reply
#14

OMG! I lost my words, simply amazingg!
Reply
#15

Gonna use it thanks
Reply
#16

Edit: wrong thread
Reply
#17

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

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

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

Not define, include.
Same by a_samp
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)