OnPlayerWeaponShot - by camera
#1

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

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

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

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

The hitid parameter holds the vehicleid you shot
Reply
#5

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

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!
}
Reply
#7

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?
Reply


Forum Jump:


Users browsing this thread: