Jump to content

[HELP] Destroy vehicle (or exploded veh) with gun shot


SinaAmp

Recommended Posts

  • Scripting Moderators
6 hours ago, SinaAmp said:

thank you @xLive but every thing i tried not worked

can u give me example script?

Oh its my fault sorry!
 

Quote

hitElement: an element which was hit by a shot. Currently this can be only another player.


it doesn't work with vehicles
i don't know if there's another event to use.
 

Edited by xLive
  • Like 1
Link to comment

thank you @Tekken why my script does not destroy vehicles?

-- client

function DesVeh(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )
    if weapon == 22 and getElementType(hitElement)=="vehicle" then
         destroyElement(hitElement)
         outputChatBox ( "Your vehicle has been destroyed!", 0, 255, 0 )
    else
        outputChatBox ( "opssss !", 255, 0, 0 )
    end
end
addEventHandler ( "onClientPlayerWeaponFire", root, DesVeh )

 

Link to comment

@SpecT  whats wrong with my serverside script?

i doesn't receive any error in debugscript 3 

-- client

function DesVeh(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )
    if weapon == 22 and getElementType(hitElement)=="vehicle" then
		triggerServerEvent("onAdminShot" , hitElement)
        outputChatBox ( "Your vehicle has been destroyed!", 0, 255, 0 )
    else
        outputChatBox ( "opssss !", 255, 0, 0 )
    end
end
addEventHandler ( "onClientPlayerWeaponFire", root, DesVeh )


-- server

function DesMyVeh(hitElement) 
	if isElement(hitElement) and getElementType(hitElement) == "vehicle" then
    fixVehicle(hitElement)
	end
 end
 addEvent("onAdminShot",true); 
 addEventHandler("onAdminShot",root,DesMyVeh); 

 

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...