JoZeFSvK Posted October 20, 2013 Posted October 20, 2013 Hey i want create command for VIP and i have problem Server rRoot = getResourceRootElement(getThisResource()) function raketa (player, command) local accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" )) or isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "vip" ) ) then outputChatBox("#1e90ff*#ffffff~TS~ #ffff00VIP#ffffff: You enabled rocket!", player, 255, 255, 255, true ) triggerClientEvent("onRaketa", root) else outputChatBox ( "#1e90ff~TS~*#ffffff You dont have permission for this command", player, 255, 0, 0, true ) return end end addCommandHandler("rocket", raketa) Client local rocketColor = {0, 102, 255, 255} local rootElement = getRootElement() local localPlayer = getLocalPlayer() local markers = {} addEvent( "onRaketa", true ) addEventHandler( "onRaketa", root, function updateMarkers() for i,m in pairs(markers) do if getProjectileType(m[2]) then local rx, ry, rz = getElementPosition(m[2]) setElementPosition(m[1], rx, ry, rz) else markers[i] = nil destroyElement(m[1]) end end end --addEventHandler("onClientRender", rootElement, updateMarkers) function onRocketCreate(creator) if getProjectileType(source) ~= 19 then return end setTimer(function(source) local rx, ry, rz = getElementPosition(source) local marker = createMarker(rx, ry, rz, "corona", 5, rocketColor[1], rocketColor[2], rocketColor[3], rocketColor[4]) table.insert(markers, {marker, source}) end, math.random(50, 100), 1, source) end addEventHandler("onClientProjectileCreation", rootElement, onRocketCreate) i have problem i dont know where add addevent handler I tried different but i have problems thank you
MACIEKW89 Posted October 20, 2013 Posted October 20, 2013 Try it : addEvent( "onRaketa", true ) addEventHandler( "onRaketa", root, function updateMarkers() for i,m in pairs(markers) do if getProjectileType(m[2]) then local rx, ry, rz = getElementPosition(m[2]) setElementPosition(m[1], rx, ry, rz) else markers[i] = nil destroyElement(m[1]) end end end) --I add ")" to close EventHandler addEventHandler("onClientRender", rootElement, updateMarkers)
JoZeFSvK Posted October 20, 2013 Author Posted October 20, 2013 when player will in vip group then can enable colored rocket
TAPL Posted October 20, 2013 Posted October 20, 2013 You mean the VIP member will be able to see all rockets colored or you mean everyone will see the rocket colored if the creator was VIP?
JoZeFSvK Posted October 20, 2013 Author Posted October 20, 2013 you mean everyone will see the rocket colored if the creator was VIP? yes and only vip will have colored rocket and others no
TAPL Posted October 20, 2013 Posted October 20, 2013 -- Server Side -- function raketa(player) local accountName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user."..accountName, aclGetGroup("Admin")) or isObjectInACLGroup("user."..accountName, aclGetGroup("vip")) then if not getElementData(player, "VIPRocket") then setElementData(player, "VIPRocket", true) outputChatBox("#1e90ff*#ffffff~TS~ #ffff00VIP#ffffff: You enabled rocket!", player, 255, 255, 255, true) else setElementData(player, "VIPRocket", false) outputChatBox("#1e90ff*#ffffff~TS~ #ffff00VIP#ffffff: You disable rocket!", player, 255, 255, 255, true) end else outputChatBox("#1e90ff~TS~*#ffffff You dont have permission for this command", player, 255, 0, 0, true) end end addCommandHandler("rocket", raketa) -- Client Side -- local rocketColor = {0, 102, 255, 255} local markers = {} function updateMarkers() for i,m in pairs(markers) do if isElement(m[2]) then local rx, ry, rz = getElementPosition(m[2]) setElementPosition(m[1], rx, ry, rz) else markers[i] = nil destroyElement(m[1]) end end end addEventHandler("onClientRender", root, updateMarkers) function onRocketCreate(creator) if getElementData(creator, "VIPRocket") and getProjectileType(source) == 19 then setTimer(function(source) local rx, ry, rz = getElementPosition(source) local marker = createMarker(rx, ry, rz, "corona", 5, rocketColor[1], rocketColor[2], rocketColor[3], rocketColor[4]) table.insert(markers, {marker, source}) end, math.random(50, 100), 1, source) end end addEventHandler("onClientProjectileCreation", root, onRocketCreate)
TAPL Posted October 20, 2013 Posted October 20, 2013 It's work fine for me. Have you tried to use the command rocket? Are you sure you are in one of the two group "Admin" or "vip"? Are you sure the rocket type was 19 (without heat seeking)?
JoZeFSvK Posted October 20, 2013 Author Posted October 20, 2013 It's work fine for me.Have you tried to use the command rocket? Are you sure you are in one of the two group "Admin" or "vip"? Are you sure the rocket type was 19 (without heat seeking)? Yes Yes WTF? its for hunter rocket ye ?
TAPL Posted October 20, 2013 Posted October 20, 2013 oh i was think you will use it with weapon where the creator will be the player but in you case the creator is the hunter. So you need to get the driver of the hunter because the element data is with the player. Change this: if getElementData(creator, "VIPRocket") and getProjectileType(source) == 19 then To: if getElementData(getVehicleController(creator), "VIPRocket") and getProjectileType(source) == 19 then
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