Search the Community
Showing results for tags 'attacker'.
-
-- client function check( attacker, weapon ) local theVehicle = getPedOccupiedVehicle ( getLocalPlayer ) if getElementType ( weapon ) == "Rammed" then triggerServerEvent ( "kill", resourceRoot, attacker ) else end end addEventHandler("onPlayerDamage"", root, check) -- server function kill(attacker) outputChatBox("Collided.", source) killPed(source, attacker) end addEvent( "kill", true ) addEventHandler( "kill", resourceRoot, kill ) -- Bound to this resource only, saves on CPU usage. addCommandHandler("col", kill )-- this is just to test the kill Hi i am trying to make a script that kills player instantly when hit by a car, can anyone pls help me out nevermind my mistake xDDDDD topic close
-
Hello, i was making a blip event system, where the staff give a /eventoblip command, then a blip will be created above him on the MAP (F11), and when anonyone kills him it returns a message, then show the killer name for everyone in the server by outputchatbox, and give the killer items... I'm currently using mta dayz gamemode, the most part of the script is working perfectly fine, my error is: The script identify if the admin killed himself or if anyone killed the admin, but it doesn't identify the killer's name / account... It doesn't give the killer items and doesn't give the killer's name... The script: --function blip has paremeter: theplayer function blip (thePlayer) --variable accountname receive the value of the getaccountname of the player, to see the player login accountname = getAccountName(getPlayerAccount(thePlayer)) --if the player who triggered the blip function is a supermoderator or an admin then if isObjectInACLGroup("user." .. accountname, aclGetGroup("SuperModerator")) or isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then --output the message "special event - kill the adm identified as a $ on the map, the winner will get random items" outputChatBox ('#00BFFF==============================================================',getRootElement(),255,255,255,true) outputChatBox ('#00BFFF【 EVENTO ESPECIAL! 】#FFFFFF Mate o ADM identificado com o #098700cifrão ($) verde no mapa',getRootElement(),255,255,255,true) outputChatBox ('#FFFFFFO vencedor ganhará itens aleátorios!',getRootElement(),255,255,255,true) outputChatBox ('#00BFFF==============================================================',getRootElement(),255,255,255,true) --attach a "$" blip to the admin or supermod who started the event blip = createBlipAttachedTo (thePlayer,52,10) --set the admin data blood to 100 setElementData(thePlayer, "blood",100) --set the admin data blip event to true setElementData(thePlayer, "eventoblip",true) --set the max slots of the admin backpack to 350 setElementData(thePlayer, "MAX_Slots",350) end end --add the command /eventoblip that triggers the function blip addCommandHandler("eventoblip", blip) --table that determine what items the player will be given local itens = { {"Banana"}, {"Kiwi"}, {"Pizza"} } --function that calculates the size of the table itens above function tamanho( tabela ) local count = 0 for a in pairs( tabela ) do count = count + 1 end return count end -- function endevent has parameters: ammo, attacker, weapon, bodypart function fimdoevento(ammo, killer, weapon, bodypart) local getData = getElementData ( source, "eventoblip" ) -- quando o cara morrer , se o cara for o que tiver iniciado o evento, e o evento ainda tiver rolando if getData then -- se tiver um assassino entao if killer then local item = itens[math.random(tamanho(itens))][1] local quantidade = 1 destroyElement(blip) setElementData(source, "eventoblip",false) setElementData(killer, item , quantidade) setElementData(source, item, quantidade) outputChatBox ('#00a5ff==============================================================',getRootElement(),255,255,255,true) outputChatBox ('#00a5ff GETDATA TRUE',getRootElement(),255,255,255,true) outputChatBox ("#00a5ff Parabéns [#FF0000" .. getPlayerName(killer) .. "#00a5ff] matou o Staff e ganhou [#ff0000 "..quantidade.."x "..item.."#00a5ff]!",getRootElement(),255,255,255,true) outputChatBox ('#00a5ff==============================================================',getRootElement(),255,255,255,true) else destroyElement(blip) setElementData(source, "eventoblip",false) outputChatBox ('#00a5ff==============================================================',getRootElement(),255,255,255,true) outputChatBox ('#00a5ff O Staff #FF0000' .. getPlayerName(source) .. ' #00a5ff se matou, o evento irá reiniciar',getRootElement(),255,255,255,true) outputChatBox ('#00a5ff==============================================================',getRootElement(),255,255,255,true) end end end --add an event handler of type onplayerwasted, that triggers the fimdoevento (translating: endevent) function addEventHandler("onPlayerWasted", getRootElement(), fimdoevento) function finalizarevento(thePlayer) local pegaData = getElementData ( thePlayer, "eventoblip" ) accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("SuperModerator")) or isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then if pegaData then destroyElement(blip) setElementData(thePlayer, "eventoblip",false) removeElementData(thePlayer,"eventoblip") outputChatBox ('#00BFFF==============================================================',getRootElement(),255,255,255,true) outputChatBox ('#FF0000【 ATENÇÃO! 】#FFFFFF O Staff finalizou o evento.',getRootElement(),255,255,255,true) outputChatBox ('#FFFFFFO ele explicará o motivo em breve!',getRootElement(),255,255,255,true) outputChatBox ('#00BFFF==============================================================',getRootElement(),255,255,255,true) setElementData(thePlayer, "blood",12000) setElementData(thePlayer, "MAX_Slots",350) else outputChatBox ('#FFFFFFO Evento não está acontecendo !!!',thePlayer,255,255,255,true) end end end addCommandHandler("finalizareventoblip", finalizarevento) The meta.xml: <meta> <info author="Gabriel Bigardi" version="1.0" type="script" name="BLIP event"/> <script src="blip.lua" type="server" /> </meta> Thanks !!!