crazyde21 Posted February 11, 2014 Share Posted February 11, 2014 client bindKey ("m", "down", function() showCursor( not isCursorShowing() ) end) function clickplayers ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if button=="left" then if state =="down" then zhuishap = clickedElement if getElementType ( clickedElement ) =="player" then local x,y,z =getElementPosition (clickedElement) triggerServerEvent ( "shunyi", getLocalPlayer(),x,y,z,clickedElement ) end end end end addEventHandler ( "onClientClick", getRootElement(), clickplayers ) addEvent( "fireplayers", true ) addEventHandler( "fireplayers", getRootElement(), function ( huwei,x,y,z ) if (isElement(huwei)) then setPedAimTarget ( huwei, x,y,z+0.85 ) setPedControlState( huwei, "fire", true ) setTimer ( function (huwei) if ( isElement ( huwei ) ) then setPedControlState ( huwei, "fire", false) end end, 100, 1, huwei ) end end ) function wpplayerss( huwei ) if (isElement(huwei)) then local x,y,z = getElementPosition(zhuishap) setPedControlState( huwei, "fire", true ) setPedControlState( huwei, "aim_weapon", true ) setTimer ( function (huwei) setPedAimTarget ( huwei, x,y,z+0.8 ) end , 100, 1, huwei ) setTimer ( function (huwei) setPedControlState ( huwei, "fire", false) wpplayerss(huwei) end, 100, 1, huwei ) end end addEvent( "wpplayers", true ) addEventHandler( "wpplayers", getRootElement(), wpplayerss) server outputChatBox("10086兄开发简单护卫启动...",player,255,255,0) huwei=createPed ( 114, 0,0,5) addEvent("shunyi",true) addEventHandler("shunyi",getRootElement(),function(x,y,z,clickedElement) local checkwp = getPedWeapon (huwei ) if checkwp == 0 then setPedOnFire (clickedElement,true) setElementFrozen (clickedElement,true) setPedArmor (huwei,100) setTimer ( function()setElementFrozen (clickedElement,false) end ,2000,1) setElementPosition(huwei,x+1,y,z) setPedAnimation ( huwei ) triggerClientEvent ( "fireplayers", getRootElement(), huwei ,x,y,z) end if checkwp > 0 then giveWeapon(huwei,checkwp,1,true) setElementPosition(huwei,x+5,y+5,z) setPedAnimation ( huwei ) triggerClientEvent ( "wpplayers", getRootElement(), huwei) end end ) function resheng() huwei=createPed ( 114, 0,0,5) function died(ammo,killer) outputChatBox("护卫已经死亡,杀手是:"..getPlayerName(killer)..",护卫10秒后复活",player,255,255,0) setTimer ( function() destroyElement (huwei) outputChatBox("护卫死亡已经复活!",player,255,0,0) resheng()end ,10000,1) end addEventHandler("onPedWasted", huwei, died) end function died(ammo,killer) outputChatBox("护卫已经死亡,杀手是:"..getPlayerName(killer)..",护卫10秒后复活",player,255,255,0) setTimer ( function() destroyElement (huwei) outputChatBox("护卫死亡已经复活!",player,255,0,0) resheng()end ,10000,1) end addEventHandler("onPedWasted", huwei, died) addCommandHandler("huweiskin",function(thePlayer,cmd,id) if id then setPedSkin(huwei,id) else outputChatBox("请使用命令/huweiskin 皮肤id ,换护卫的皮肤",thePlayer,255,255,255) end end ) addCommandHandler("huweiwp",function(thePlayer,cmd,id) if id then giveWeapon(huwei,id,1000,true) reloadPedWeapon(huwei) else outputChatBox("请使用命令/huweiwp 武器id ,给护卫武器",thePlayer,255,255,255) end end ) createPed ( 114, -2405.35522 ,-594.86493 ,132.64844) my Q is: I press "M" call Mouse ,then click player ,if getpedweapon == 0 then fire the player, player injuries!! .But weapon > 0 , then i click the player , ped will fire and shot clickElement, but No injuries! why it? Link to comment
Moderators IIYAMA Posted February 11, 2014 Moderators Share Posted February 11, 2014 It is a mta bug. Can be solved with setting the ammo again. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now