SA-MP Forums Archive
OnPlayerWeaponShot - by camera - 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: OnPlayerWeaponShot - by camera (/showthread.php?tid=521490)



OnPlayerWeaponShot - by camera - cnoopers - 23.06.2014

So, i trying make something when player shot by camera to car. But its not work, have to use GetPlayerCameraFrontVector or how another way?

Код:
	new hittedvehicleid = GetPlayerVehicleID(playerid);
	new Float:x, Float:y, Float:z;
	if(weaponid == 43)
	{
           if(hittype == hittedvehicle)
           {
               //here code not work
           }
	}



Re: OnPlayerWeaponShot - by camera - RenovanZ - 23.06.2014

GetPlayerVehicleID will return vehicleid which player inside.
How can you shot while you're in the car ?


Re: OnPlayerWeaponShot - by camera - cnoopers - 23.06.2014

Damn, my fault. How I can make it? Loop for all players, but it must be no only for occupied car, so loop for created vehicles?


Re: OnPlayerWeaponShot - by camera - RedFusion - 23.06.2014

https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot

The hitid parameter holds the vehicleid you shot


Re: OnPlayerWeaponShot - by camera - cnoopers - 23.06.2014

Not work, message is not displayed.
Код:
	if(weaponid == 43)
	{
           if(hittype == BULLET_HIT_TYPE_VEHICLE)
           {
               SendClientMessage(playerid, -1, "test");
           }
	}



Re: OnPlayerWeaponShot - by camera - RedFusion - 23.06.2014

I doubt the camera triggers this callback. Debug your code!
pawn Код:
if(weaponid == 43 && hittype == BULLET_HIT_TYPE_VEHICLE)
{
    //vehicleid = hitid. Use hitid as vehicleid!
    printf("vehicleid %i was photographed by playerid %i", hitid, playerid); // Check the console if this message pops up!
}



Re: OnPlayerWeaponShot - by camera - cnoopers - 23.06.2014

Hey, I know whats happend. That callback not response melee weapons such as camera, baseball bat and sth like that.
Anyways for make it, maybe check keys? Check position and getting camera look at car or another point. hm?