Chronos Posted July 5, 2013 Share Posted July 5, 2013 hello i need help when i start this resource,i can't use it IG i mean command doean't work. function event(source) if (isElement(theMarker)) then destroyElement(theMarker) local nombre2 = getPlayerName(source) outputChatBox("#FF0000[Event]#00FF00 Event is full", getRootElement(), 255, 255, 255, true) removeCommandHandler("eventwarp") else local x,y,z = getElementPosition(source) theMarker = createMarker ( x, y, z, "checkpoint", 2, 255, 255, 255, 100 ) local nombre = getPlayerName(source) outputChatBox("#FF0000[Event]#00FF00 A event has been created, #00FF00Use #FF0000/eventwarp #00FF00for participe!", getRootElement(), 255, 255, 255, true) addCommandHandler("eventwarp", eventowarp) end end addCommandHandler("ev", evento) function eventowarp(thePlayer) if isElement(theMarker) then local x, y, z = getElementPosition(theMarker) setElementPosition(thePlayer, x, y, z) end end function warpToEvent (thePlayer) if (not getElementData (thePlayer,"inEvent?")) then maxPlayers = maxPlayers + 1 detectP () local capacity = getElementData (root,"capacity") if maxPlayers <= capacity then if (not getElementData (thePlayer,"inEvent?")) then local xm,ym,zm = getElementPosition (markerEvent) setElementPosition ( thePlayer, xm, ym, zm + 2.5 ) setElementDimension ( thePlayer, tonumber(getElementData(root,"dimension"))) setElementData (thePlayer,"inEvent?", "yes") end else outputChatBox ("The event is full", thePlayer, 255, 0, 0) end end end function playersLeft (thePlayer) outputChatBox("Player left to full event "..(tonumber(getElementData (root,"capacity")) - tonumber(maxPlayers)).."", thePlayer, 0, 255, 0) end addCommandHandler ("playersleft", playersLeft) function cancelEvent (thePlayer) if getPlayerTeam (thePlayer) == getTeamFromName ("Staff") then outputChatBox ("Event has been cancelled", getRootElement(), 255, 0, 0) destroyElement(markerEvent) local players = getElementsByType("player") for index,pie in ipairs(players) do if getElementData (pie,"inEvent?") == "yes" then setElementPosition ( pie, 0, 0, 3 ) setElementDimension ( pie, 0 ) removeCommandHandler ("eventwarp", warpToEvent) removeCommandHandler ("leaveevent", leftEvent) end end end end addCommandHandler ("cancelevent", cancelEvent) function cancelEvent (thePlayer) if getPlayerTeam (thePlayer) == getTeamFromName ("Staff") then outputChatBox ("Event has been cancelled", getRootElement(), 255, 0, 0) destroyElement(markerEvent) local players = getElementsByType("player") for index,pie in ipairs(players) do if getElementData (pie,"inEvent?") == "yes" then setElementPosition ( pie, 0, 0, 3 ) setElementDimension ( pie, 0 ) removeElementData (pie,"inEvent?") removeCommandHandler ("eventwarp", warpToEvent) Link to comment
iMr.3a[Z]eF Posted July 5, 2013 Share Posted July 5, 2013 "onResourceStart" removeCommandHandler Link to comment
Chronos Posted July 5, 2013 Author Share Posted July 5, 2013 "onResourceStart" removeCommandHandler u can explain more .. Link to comment
iMr.3a[Z]eF Posted July 5, 2013 Share Posted July 5, 2013 (edited) "onResourceStart" removeCommandHandler u can explain more .. you want it full? addEventHandler( "onResourceStart", function () removeCommandHandler("Warp") end ) edited! Edited July 5, 2013 by Guest Link to comment
#Al-Ha[J]aRii Posted July 5, 2013 Share Posted July 5, 2013 "onResourceStart" removeCommandHandler u can explain more .. you want it full? addEventHandler( "onResourceStart", function () removeEventHandler("Warp") end ) did you read wiki for this function befor you post it's and it's wrong. Link to comment
#Al-Ha[J]aRii Posted July 5, 2013 Share Posted July 5, 2013 EDITED ! this function remove event handler , that you add him with addCommandHandler . so he addCommandHandler with name eventwarp Link to comment
iMr.3a[Z]eF Posted July 5, 2013 Share Posted July 5, 2013 hello i need help when i start this resource,i can't use it IG i mean command doean't work. function event(source) if (isElement(theMarker)) then destroyElement(theMarker) local nombre2 = getPlayerName(source) outputChatBox("#FF0000[Event]#00FF00 Event is full", getRootElement(), 255, 255, 255, true) removeCommandHandler("eventwarp") else local x,y,z = getElementPosition(source) theMarker = createMarker ( x, y, z, "checkpoint", 2, 255, 255, 255, 100 ) local nombre = getPlayerName(source) outputChatBox("#FF0000[Event]#00FF00 A event has been created, #00FF00Use #FF0000/eventwarp #00FF00for participe!", getRootElement(), 255, 255, 255, true) addCommandHandler("eventwarp", eventowarp) end end addCommandHandler("ev", evento) function eventowarp(thePlayer) if isElement(theMarker) then local x, y, z = getElementPosition(theMarker) setElementPosition(thePlayer, x, y, z) end end function warpToEvent (thePlayer) if (not getElementData (thePlayer,"inEvent?")) then maxPlayers = maxPlayers + 1 detectP () local capacity = getElementData (root,"capacity") if maxPlayers <= capacity then if (not getElementData (thePlayer,"inEvent?")) then local xm,ym,zm = getElementPosition (markerEvent) setElementPosition ( thePlayer, xm, ym, zm + 2.5 ) setElementDimension ( thePlayer, tonumber(getElementData(root,"dimension"))) setElementData (thePlayer,"inEvent?", "yes") end else outputChatBox ("The event is full", thePlayer, 255, 0, 0) end end end function playersLeft (thePlayer) outputChatBox("Player left to full event "..(tonumber(getElementData (root,"capacity")) - tonumber(maxPlayers)).."", thePlayer, 0, 255, 0) end addCommandHandler ("playersleft", playersLeft) function cancelEvent (thePlayer) if getPlayerTeam (thePlayer) == getTeamFromName ("Staff") then outputChatBox ("Event has been cancelled", getRootElement(), 255, 0, 0) destroyElement(markerEvent) local players = getElementsByType("player") for index,pie in ipairs(players) do if getElementData (pie,"inEvent?") == "yes" then setElementPosition ( pie, 0, 0, 3 ) setElementDimension ( pie, 0 ) removeCommandHandler ("eventwarp", warpToEvent) removeCommandHandler ("leaveevent", leftEvent) end end end end addCommandHandler ("cancelevent", cancelEvent) function cancelEvent (thePlayer) if getPlayerTeam (thePlayer) == getTeamFromName ("Staff") then outputChatBox ("Event has been cancelled", getRootElement(), 255, 0, 0) destroyElement(markerEvent) local players = getElementsByType("player") for index,pie in ipairs(players) do if getElementData (pie,"inEvent?") == "yes" then setElementPosition ( pie, 0, 0, 3 ) setElementDimension ( pie, 0 ) removeElementData (pie,"inEvent?") removeCommandHandler ("eventwarp", warpToEvent) read carefully Link to comment
#Al-Ha[J]aRii Posted July 5, 2013 Share Posted July 5, 2013 hello i need help when i start this resource,i can't use it IG i mean command doean't work. function event(source) if (isElement(theMarker)) then destroyElement(theMarker) local nombre2 = getPlayerName(source) outputChatBox("#FF0000[Event]#00FF00 Event is full", getRootElement(), 255, 255, 255, true) removeCommandHandler("eventwarp") else local x,y,z = getElementPosition(source) theMarker = createMarker ( x, y, z, "checkpoint", 2, 255, 255, 255, 100 ) local nombre = getPlayerName(source) outputChatBox("#FF0000[Event]#00FF00 A event has been created, #00FF00Use #FF0000/eventwarp #00FF00for participe!", getRootElement(), 255, 255, 255, true) addCommandHandler("eventwarp", eventowarp) end end addCommandHandler("ev", evento) function eventowarp(thePlayer) if isElement(theMarker) then local x, y, z = getElementPosition(theMarker) setElementPosition(thePlayer, x, y, z) end end function warpToEvent (thePlayer) if (not getElementData (thePlayer,"inEvent?")) then maxPlayers = maxPlayers + 1 detectP () local capacity = getElementData (root,"capacity") if maxPlayers <= capacity then if (not getElementData (thePlayer,"inEvent?")) then local xm,ym,zm = getElementPosition (markerEvent) setElementPosition ( thePlayer, xm, ym, zm + 2.5 ) setElementDimension ( thePlayer, tonumber(getElementData(root,"dimension"))) setElementData (thePlayer,"inEvent?", "yes") end else outputChatBox ("The event is full", thePlayer, 255, 0, 0) end end end function playersLeft (thePlayer) outputChatBox("Player left to full event "..(tonumber(getElementData (root,"capacity")) - tonumber(maxPlayers)).."", thePlayer, 0, 255, 0) end addCommandHandler ("playersleft", playersLeft) function cancelEvent (thePlayer) if getPlayerTeam (thePlayer) == getTeamFromName ("Staff") then outputChatBox ("Event has been cancelled", getRootElement(), 255, 0, 0) destroyElement(markerEvent) local players = getElementsByType("player") for index,pie in ipairs(players) do if getElementData (pie,"inEvent?") == "yes" then setElementPosition ( pie, 0, 0, 3 ) setElementDimension ( pie, 0 ) removeCommandHandler ("eventwarp", warpToEvent) removeCommandHandler ("leaveevent", leftEvent) end end end end addCommandHandler ("cancelevent", cancelEvent) function cancelEvent (thePlayer) if getPlayerTeam (thePlayer) == getTeamFromName ("Staff") then outputChatBox ("Event has been cancelled", getRootElement(), 255, 0, 0) destroyElement(markerEvent) local players = getElementsByType("player") for index,pie in ipairs(players) do if getElementData (pie,"inEvent?") == "yes" then setElementPosition ( pie, 0, 0, 3 ) setElementDimension ( pie, 0 ) removeElementData (pie,"inEvent?") removeCommandHandler ("eventwarp", warpToEvent) read carefully read carefully wiki for removeCommandHandler + his command he using with addCommandHandler it's addCommandHandler("eventwarp", ..........) ok ? and in his Code There are no Command Name "Warp" and wiki said : This function removes a command handler, that is one that has been added using addCommandHandler. This function can only remove command handlers that were added by the resource that it is called in. Link to comment
iMr.3a[Z]eF Posted July 5, 2013 Share Posted July 5, 2013 Dude i gived him an Example also he can edit what i gived to him i know he is smart because he made his codes at the beginning of the topic 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