Atton Posted December 15, 2013 Share Posted December 15, 2013 I have been trying to use get and set element data for this murder command. Can anyone help. setElementData ( player, "Mode.murder", true ) function rapef (player,command,tpName,source) local tp = getPlayerFromName(tpName) if getElementData( player, "Mode.murder" ) then setElementData ( player, "Mode.murder", false ) killPed(tp) setTimer(YCRN,40000,1) outputChatBox("You murdered: ".. tostring(tp)) else outputChatBox("Hold up there mate",player) end end addCommandHandler("murder",murderf) --if tp then function YCRN () setElementData ( player, "Mode.murder", true ) end Link to comment
TAPL Posted December 15, 2013 Share Posted December 15, 2013 addEventHandler("onResourceStart", resourceRoot, function() for i, player in ipairs(getElementsByType("player")) do setElementData(player, "Mode.murder", false, false) end end) function murderf(player, command, tpName) if tpName then local tp = getPlayerFromName(tpName) if tp and not getElementData(player, "Mode.murder") then setElementData(player, "Mode.murder", true, false) killPed(tp) outputChatBox("You murdered: "..tpName) setTimer(function(player) setElementData(player, "Mode.murder", false, false) end, 40000, 1, player) else outputChatBox("Hold up there mate", player) end end end addCommandHandler("murder", murderf) Link to comment
Atton Posted December 17, 2013 Author Share Posted December 17, 2013 Thanks I will try to study the code to get an idea of how I can apply get and set element data thanks for your help. 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