How to enable car getting damage without a driver?
#1

First to ask if there is a simple way to make it possible, like with engine and lights case?
Code:
ManualVehicleEngineAndLights();
I assume there isn't such way, as I didn't find it anywhere, so I started making a script, based on old ones, just better. Then I got this idea to achieve it without the long script, but I don't have a clue if it's possible, as I don't know much coding for now.

Basically what I want is this, make a SAMP "think" that there is a driver in vehicle even if that isn't the case. As I understand SAMP is somehow checking if there is a driver in vehicle when player hits the vehicle. So it sounds possible to trick it to send different value then the one that is actually valid or better say true.

I'd use that in this call:
Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
	if(hittype == 2 ) //2 or BULLET_HIT_TYPE_VEHICLE
	{
	    //And then here would go the code that I need
	}
return 1:
}
Now if anyone can tell me if that can be made and even better to tell me how

Thanks in advance!
Reply
#2

pawn Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == BULLET_HIT_TYPE_VEHICLE)
    {
        new Float:vHealth;
        GetVehicleHealth(hitid, vHealth);
        SetVehicleHealth(hitid, vHealth-50); //Each shot to the vehicle will deal 50 damage, you can change this yourself based on the weapon used etc.
    }
    return 1:
}
Reply
#3

Maybe, it will get synced, when you put bot inside vehicle for 1 sec and remove it, i havent tried it, but maybe it works.
Reply
#4

Quote:
Originally Posted by [NWA]Hannes
View Post
pawn Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == BULLET_HIT_TYPE_VEHICLE)
    {
        new Float:vHealth;
        GetVehicleHealth(hitid, vHealth);
        SetVehicleHealth(hitid, vHealth-50); //Each shot to the vehicle will deal 50 damage, you can change this yourself based on the weapon used etc.
    }
    return 1:
}
I've already done that, but more detailed with each weapon and separately for air vehicles, as weapons deal reduced damage on airplanes in comparison to other vehicles. But problem occurs with enabling RPG, HS Rocket, bombs and melee weapons, as explosion and fire don't deal damage to unoccupied vehicles, and melee is dealing different damage, depending on place where you hit it.

But thanks, anyway.


Quote:
Originally Posted by CodeStyle175
View Post
Maybe, it will get synced, when you put bot inside vehicle for 1 sec and remove it, i havent tried it, but maybe it works.
That came to my mind too, but I thought this would be easier, if it's possible of course. With bot should work, in theory, as NPC is still a "player" just not playable. Only not for second, bot should appear every time a player hits some vehicle. Maybe I will try that at the end, if that can work everything will be like if there is an actual someone in on driver seat. Wouldn't have to deal with bunch of codes for each weapon and vehicles, just to make sure there is enough NPCs for every car

Thanks, on advice if nothing more.
Reply
#5

This include may help you: https://sampforum.blast.hk/showthread.php?tid=187259
Reply
#6

Saw that few days ago, that's why I'm making the new script in the first place. I think my version is already better then that, as all bullet weapons work, got problem with bombs and RPGs and cars don't damage through walls, at least I couldn't succeed I'm going to post a Beta version just need to test the Alpha one a little more.
Anyway, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)