Gabriel1375 Posted March 12, 2017 Share Posted March 12, 2017 Hello, basically what i want is this: The administrator give an command: /eventoblip Then it makes an BLIP in the admin, and when the player kill the admin it gives the killer an random item. Everything is working fine but, when someone kills the admin, the admin gets the item, not the killer, i've tried everything but i can't make the killer get the item... Also when someone kills the admin the name that shows in the chat is the admin name, but i wan't the killer name Here is my script: Quote function blip (thePlayer) accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("SuperModerator")) or isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then outputChatBox ('#00BFFF==============================================================',getRootElement(),255,255,255,true) outputChatBox ('#00BFFF【 SPECIAL EVENT! 】#FFFFFF Kill the ADMIN with the #098700green ($) marker on the map',getRootElement(),255,255,255,true) outputChatBox ('#FFFFFFThe winner will get an random VIP item!',getRootElement(),255,255,255,true) outputChatBox ('#00BFFF==============================================================',getRootElement(),255,255,255,true) blip = createBlipAttachedTo (thePlayer,52,10) setElementData(thePlayer, "blood",100) setElementData(thePlayer, "eventoblip",true) setElementData(thePlayer, "MAX_Slots",350) end end addCommandHandler("eventoblip", blip) local itens = { {"Banana"}, {"Kiwi"}, {"Pizza"} } function tamanho( tabela ) local count = 0 for a in pairs( tabela ) do count = count + 1 end return count end function fimdoevento(killed, ammo) if killed and getElementData(source,"eventoblip") == true then local item = itens[math.random(tamanho(itens))][1] local quantity = 1 --setElementData(killed, item, quantidade) destroyElement(blip) setElementData(source, "eventoblip",false) setElementData(killed, "Sniper Rifle Ammo", 150) setElementData(source, item, quantity) outputChatBox ('#00a5ff==============================================================',getRootElement(),255,255,255,true) outputChatBox ("#00a5ff Congratulations [#FF0000" ..getPlayerName(source).."#00a5ff] win a [#ff0000 "..quantity.."x "..item.."#00a5ff]!",getRootElement(),255,255,255,true) outputChatBox ('#00a5ff==============================================================',getRootElement(),255,255,255,true) end end addEventHandler("onPlayerWasted", getRootElement(), fimdoevento) Also, i'm using the gamemode DayZ. Thanks Link to comment
Mr.Loki Posted March 12, 2017 Share Posted March 12, 2017 Use the code button for code <> near the smiley face. local items = { {"Banana"}, {"Kiwi"}, {"Pizza"} } function fimdoevento(killer) if getElementType(killer) == "player" and getElementData(source,"eventoblip") == true then -- checks if the killer is a player we dont want cars to get the item ._. and if the player killed has the event blip. local item = items[math.random(#items)][1]-- get random table entry. local quantity = math.random(5) -- generate random quantity between 1-5 destroyElement(blip)-- destroy the blip setElementData(source, "eventoblip",false)-- remove the event data from the admin setElementData(killer, "Sniper Rifle Ammo", 150)-- give the killer(player who killed the admin) Sniper ammo outputChatBox ('#00a5ff==============================================================',root,255,255,255,true) outputChatBox ("#00a5ff Congratulations [#FF0000" ..getPlayerName(killer).."#00a5ff] win a [#ff0000 "..quantity.."x "..item.."#00a5ff]!",root,255,255,255,true)-- output messaage with the killer's name outputChatBox ('#00a5ff==============================================================',root,255,255,255,true) end end addEventHandler("onPlayerWasted", root, fimdoevento) Link to comment
Gabriel1375 Posted March 12, 2017 Author Share Posted March 12, 2017 Still not working It gives me a warning saying that getElementType was expecting an element, but got number '1' Link to comment
Ayush Rathore Posted March 12, 2017 Share Posted March 12, 2017 14 hours ago, Mr.Loki said: Use the code button for code <> near the smiley face. local items = { {"Banana"}, {"Kiwi"}, {"Pizza"} } function fimdoevento(killer) if getElementType(killer) == "player" and getElementData(source,"eventoblip") == true then -- checks if the killer is a player we dont want cars to get the item ._. and if the player killed has the event blip. local item = items[math.random(#items)][1]-- get random table entry. local quantity = math.random(5) -- generate random quantity between 1-5 destroyElement(blip)-- destroy the blip setElementData(source, "eventoblip",false)-- remove the event data from the admin setElementData(killer, "Sniper Rifle Ammo", 150)-- give the killer(player who killed the admin) Sniper ammo outputChatBox ('#00a5ff==============================================================',root,255,255,255,true) outputChatBox ("#00a5ff Congratulations [#FF0000" ..getPlayerName(killer).."#00a5ff] win a [#ff0000 "..quantity.."x "..item.."#00a5ff]!",root,255,255,255,true)-- output messaage with the killer's name outputChatBox ('#00a5ff==============================================================',root,255,255,255,true) end end addEventHandler("onPlayerWasted", root, fimdoevento) Loki look in wiki well it happens to everyone it will be this local items = { {"Banana"}, {"Kiwi"}, {"Pizza"} } function fimdoevento(_,killer) if getElementType(killer) == "player" and getElementData(source,"eventoblip") == true then -- checks if the killer is a player we dont want cars to get the item ._. and if the player killed has the event blip. local item = items[math.random(#items)][1]-- get random table entry. local quantity = math.random(5) -- generate random quantity between 1-5 destroyElement(blip)-- destroy the blip setElementData(source, "eventoblip",false)-- remove the event data from the admin setElementData(killer, "Sniper Rifle Ammo", 150)-- give the killer(player who killed the admin) Sniper ammo outputChatBox ('#00a5ff==============================================================',root,255,255,255,true) outputChatBox ("#00a5ff Congratulations [#FF0000" ..getPlayerName(killer).."#00a5ff] win a [#ff0000 "..quantity.."x "..item.."#00a5ff]!",root,255,255,255,true)-- output messaage with the killer's name outputChatBox ('#00a5ff==============================================================',root,255,255,255,true) end end addEventHandler("onPlayerWasted", root, fimdoevento) use this 20 minutes ago, Gabriel1375 said: Still not working It gives me a warning saying that getElementType was expecting an element, but got number '1' 1 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