Hi,
I made a gui for a event, if you press the button "Start!" 2 markers will be created.
But it shows a error about "Need a element at argument 2, got nill ( line 13 and 27 ) "
So I don't know how to fix this.
THis is my client:
local EvMarker = createMarker ( 1547.88953, -1681.53955, 12.5, 'arrow', 2, 255, 0, 0, 255 )
function createEvGui ()
GUIEditor_Window = {}
GUIEditor_TabPanel = {}
GUIEditor_Tab = {}
GUIEditor_Button = {}
GUIEditor_Memo = {}
EvGui = guiCreateWindow(333,326,185,220,"SARG Event panel 0.1",false)
EvTabPan = guiCreateTabPanel(10,20,166,191,false,GUIEditor_Window[1])
EvTab = guiCreateTab("Rules",EvTabPan)
EvMemo = guiCreateMemo(6,4,155,182,"The rules of the event: There are 2 teams, armed with spray, the goal is to eliminate the enemy team with the spray, admins can stop the event by typing: /stop ()Events",false,GUIEditor_Tab[1])
guiMemoSetReadOnly(EvMemo,true)
EvTab2 = guiCreateTab("START!",EvTabPanel)
Start = guiCreateButton(23,33,129,64,"START EVENT",false,EvTab2)
end
addEventHandler("onClientMarkerHit", dutyMarker,
function(hitElement)
if hitElement == localPlayer then
createEvGui ( hitElement )
if (EvGui ~= nil) then
guiSetVisible(EvGui, true)
showCursor(true)
guiSetInputEnabled(true)
else
outputChatBox ("The event is not ready yet.")
end
end
end
)
function Event(button,state)
if (source == Start) then
triggerServerEvent (StartKnop, true)
end
end
addEventHandler("onClientGuiClick", root, Event)
and server:
function MarkerRed ()
evmarkerred = createMarker ( 1547.88953, -1683, 12.5, 'cylinder', 2, 255, 0, 0, 255 )
end
addEvent("Event", true)
addEventHandler("Event", root, MarkerRed)
function setPosRed ( hitElement )
if getElementType ( hitElement ) == "player" and not isPedInVehicle ( hitElement ) then
setElementPosition ( 2838.6000976563, -2527.6999511719, 19 )
giveWeapon ( source, 41, 100000 )
end
end
addEventHandler("onMarkerHit", evmarkerred, setPosRed)
function MarkerBlue ()
evmarkerblue = createMarker ( 1547.88953, -1686, 12.5, 'cylinder', 2, 0, 0, 255, 255 )
end
addEvent("Event", true)
addEventHandler("Event", root, MarkerBlue)
function setPosBlue ( hitElement )
if getElementType ( hitElement ) == "player" and not isPedInVehicle ( hitElement ) then
setElementPosition ( 2837.6999511719, -2333, 12 )
giveWeapon ( source, 41, 100000 )
end
end
addEventHandler("onMarkerHit", evmarkerblue, setPosBlue)
thanks.