GanJaRuleZ Posted December 30, 2011 Share Posted December 30, 2011 Hey all , i have a problem with a script Can anyone fix it? function createMissionPed() createPed ( 50 ,2467.9096679688, -1647.623046875, 13.469927787781, 184.5916595459 ) end addEventHandler ( "onResourceStart", getResourceRootElement(), createMissionPed ) infoMission1 = guiCreateWindow(239,172,364,326,"Mission 1",false) guiSetVisible ( infoMission1, false ) label1 = guiCreateLabel(13,24,339,18,"Hello , i have a problem. Can you help me?",false,infoMission1) guiLabelSetColor(label1,255,034,022) label2 = guiCreateLabel(10,67,147,36,"The Mission :",false,infoMission1) guiSetFont(label2,"sa-header") label3 = guiCreateLabel(73,112,283,26,"|OBJECTIVE| : Kill a person",false,infoMission1) guiSetFont(label3,"clear-normal") label4 = guiCreateLabel(73,139,272,22,"|REWARD| : 3000$ in CASH",false,infoMission1) buttonAccept = guiCreateButton(14,209,116,39,"I accept the job.",false,infoMission1) buttonReject = guiCreateButton(185,210,120,40,"I reject the job.",false,infoMission1) function guiSetVisibileTrue ( getRootElement() ) guiSetVisible ( infoMission1 , true ) end addEvent( "showMission1", true ) addEventHandler( "showMission1", getRootElement(), guiSetVisibleTrue ) function guiSetVisibleFalse ( getRootElement() ) guiSetVisible ( infoMission1 , false ) end addEvent( "unshowMission1", true ) addEventHandler( "unshowMission1", getRootElement(), guiSetVisibleFalse ) The error is: WARNINGG: Loading script failed: Mission\Mission1.lua:18: ')' expected near '(' So can anyone help me? Thanks in advance Link to comment
TAPL Posted December 30, 2011 Share Posted December 30, 2011 because you put it in server side it's Client Side ! function createMissionPed() createPed ( 50 ,2467.9096679688, -1647.623046875, 13.469927787781, 184.5916595459 ) end addEventHandler ( "onClientResourceStart", resourceRoot, createMissionPed ) infoMission1 = guiCreateWindow(239,172,364,326,"Mission 1",false) guiSetVisible ( infoMission1, false ) label1 = guiCreateLabel(13,24,339,18,"Hello , i have a problem. Can you help me?",false,infoMission1) guiLabelSetColor(label1,255,034,022) label2 = guiCreateLabel(10,67,147,36,"The Mission :",false,infoMission1) guiSetFont(label2,"sa-header") label3 = guiCreateLabel(73,112,283,26,"|OBJECTIVE| : Kill a person",false,infoMission1) guiSetFont(label3,"clear-normal") label4 = guiCreateLabel(73,139,272,22,"|REWARD| : 3000$ in CASH",false,infoMission1) buttonAccept = guiCreateButton(14,209,116,39,"I accept the job.",false,infoMission1) buttonReject = guiCreateButton(185,210,120,40,"I reject the job.",false,infoMission1) function guiSetVisibileTrue () guiSetVisible ( infoMission1 , true ) end addEvent( "showMission1", true ) addEventHandler( "showMission1", getRootElement(), guiSetVisibleTrue ) function guiSetVisibleFalse () guiSetVisible ( infoMission1 , false ) end addEvent( "unshowMission1", true ) addEventHandler( "unshowMission1", getRootElement(), guiSetVisibleFalse ) Link to comment
GanJaRuleZ Posted December 30, 2011 Author Share Posted December 30, 2011 Actually it's client-side : <script src='Mission1.lua' type='client' /> Link to comment
TAPL Posted December 30, 2011 Share Posted December 30, 2011 function createMissionPed() createPed ( 50 ,2467.9096679688, -1647.623046875, 13.469927787781, 184.5916595459 ) end addEventHandler ( "onClientResourceStart", resourceRoot, createMissionPed ) infoMission1 = guiCreateWindow(239,172,364,326,"Mission 1",false) guiSetVisible ( infoMission1, false ) label1 = guiCreateLabel(13,24,339,18,"Hello , i have a problem. Can you help me?",false,infoMission1) guiLabelSetColor(label1,255,034,022) label2 = guiCreateLabel(10,67,147,36,"The Mission :",false,infoMission1) guiSetFont(label2,"sa-header") label3 = guiCreateLabel(73,112,283,26,"|OBJECTIVE| : Kill a person",false,infoMission1) guiSetFont(label3,"clear-normal") label4 = guiCreateLabel(73,139,272,22,"|REWARD| : 3000$ in CASH",false,infoMission1) buttonAccept = guiCreateButton(14,209,116,39,"I accept the job.",false,infoMission1) buttonReject = guiCreateButton(185,210,120,40,"I reject the job.",false,infoMission1) function guiSetVisibleTrue () guiSetVisible ( infoMission1 , true ) end addEvent( "showMission1", true ) addEventHandler( "showMission1", root, guiSetVisibleTrue ) function guiSetVisibleFalse () guiSetVisible ( infoMission1 , false ) end addEvent( "unshowMission1", true ) addEventHandler( "unshowMission1", root, guiSetVisibleFalse ) Link to comment
GanJaRuleZ Posted December 31, 2011 Author Share Posted December 31, 2011 Ok , the ped is created , the marker is there , but , when i hit the marker i don't see the gui... Link to comment
drk Posted December 31, 2011 Share Posted December 31, 2011 LOL, we cant help you if you don't post the updated code here, client and server. Link to comment
Evil-Cod3r Posted December 31, 2011 Share Posted December 31, 2011 the problem is on server side not client side Link to comment
Kenix Posted January 2, 2012 Share Posted January 2, 2012 GanJaRuleZ,You create the window and hide . infoMission1 = guiCreateWindow(239,172,364,326,"Mission 1",false) guiSetVisible ( infoMission1, false ) You understand? Link to comment
denny199 Posted January 2, 2012 Share Posted January 2, 2012 GanJaRuleZ,You create the window and hide . infoMission1 = guiCreateWindow(239,172,364,326,"Mission 1",false) guiSetVisible ( infoMission1, false ) You understand? That's not the problem He want That if a palyer hits a marker that the GUI popout, use server side code: marker1 = createMarker (0, 0,1,"cylinder",1.2,0,0,225,100) --idk where the marker must be so 0, 0, 0 addEventHandler ("onMarkerHit",marker1, function (hitPlayer) triggerClientEvent (hitPlayer,"showMission1",getRootElement(),hitPlayer) end addEventHandler("onMarkerLeave",marker1, function (leavePlayer) triggerClientEvent(leavePlayer,"unshowMission1",leavePlayer) end) works for me Link to comment
HoLsTeN Posted January 2, 2012 Share Posted January 2, 2012 this will be just client side marker_miss = createMarker (224.30000305176,1918.1999511719,17.10000038147,"cylinder",0.80000001,254,0,0,68) function showGUI (HitP) if source == marker_miss then if HitP == getLocalPlayer() then guiSetVisible(infoMission1,true) showCursor(true) end end end addEventHandler ("onClientMarkerHit",root,showGUI) function createMissionPed() createPed ( 50 ,2467.9096679688, -1647.623046875, 13.469927787781, 184.5916595459 ) end addEventHandler ( "onResourceStart", getResourceRootElement(), createMissionPed ) infoMission1 = guiCreateWindow(239,172,364,326,"Mission 1",false) guiSetVisible ( infoMission1, false ) label1 = guiCreateLabel(13,24,339,18,"Hello , i have a problem. Can you help me?",false,infoMission1) guiLabelSetColor(label1,255,034,022) label2 = guiCreateLabel(10,67,147,36,"The Mission :",false,infoMission1) guiSetFont(label2,"sa-header") label3 = guiCreateLabel(73,112,283,26,"|OBJECTIVE| : Kill a person",false,infoMission1) guiSetFont(label3,"clear-normal") label4 = guiCreateLabel(73,139,272,22,"|REWARD| : 3000$ in CASH",false,infoMission1) buttonAccept = guiCreateButton(14,209,116,39,"I accept the job.",false,infoMission1) buttonReject = guiCreateButton(185,210,120,40,"I reject the job.",false,infoMission1) function onClick (button, state, absoluteX, absoluteY) if (source == buttonAccept) then guiSetVisible ( infoMission1, false ) showCursor(false) elseif (source == buttonReject) then guiSetVisible ( infoMission1, false ) showCursor(false) end end addEventHandler ("onClientGUIClick", getRootElement(), onClick) Link to comment
HoLsTeN Posted January 2, 2012 Share Posted January 2, 2012 (edited) this will be just client side marker_miss = createMarker (224.30000305176,1918.1999511719,17.10000038147,"cylinder",0.80000001,254,0,0,68) function showGUI (HitP) if source == marker_miss then if HitP == getLocalPlayer() then guiSetVisible(infoMission1,true) showCursor(true) end end end addEventHandler ("onClientMarkerHit",root,showGUI) function createMissionPed() createPed ( 50 ,2467.9096679688, -1647.623046875, 13.469927787781, 184.5916595459 ) end addEventHandler ( "onResourceStart", getResourceRootElement(), createMissionPed ) infoMission1 = guiCreateWindow(239,172,364,326,"Mission 1",false) guiSetVisible ( infoMission1, false ) label1 = guiCreateLabel(13,24,339,18,"Hello , i have a problem. Can you help me?",false,infoMission1) guiLabelSetColor(label1,255,034,022) label2 = guiCreateLabel(10,67,147,36,"The Mission :",false,infoMission1) guiSetFont(label2,"sa-header") label3 = guiCreateLabel(73,112,283,26,"|OBJECTIVE| : Kill a person",false,infoMission1) guiSetFont(label3,"clear-normal") label4 = guiCreateLabel(73,139,272,22,"|REWARD| : 3000$ in CASH",false,infoMission1) buttonAccept = guiCreateButton(14,209,116,39,"I accept the job.",false,infoMission1) buttonReject = guiCreateButton(185,210,120,40,"I reject the job.",false,infoMission1) function onClick (button, state, absoluteX, absoluteY) if (source == buttonAccept) then guiSetVisible ( infoMission1, false ) showCursor(false) elseif (source == buttonReject) then guiSetVisible ( infoMission1, false ) showCursor(false) end end addEventHandler ("onClientGUIClick", getRootElement(), onClick) EDIT : sorry for duble post >< Edited January 2, 2012 by Guest Link to comment
Kenix Posted January 2, 2012 Share Posted January 2, 2012 GanJaRuleZ,Please show your server side script. Link to comment
GanJaRuleZ Posted January 2, 2012 Author Share Posted January 2, 2012 Ok , i forgot about this topic , This is the server side script. local theMarker = createMarker ( 2467.8647460938, -1648.7094726563, 12.47255897522, "cylinder", 1, 255, 255, 0, 170 ) function mission1Marker(marker,matchingDimension) if (matchingDimension) then triggerClientEvent ( source, "showMission1", source) end end addEventHandler("onPlayerMarkerHit",theMarker,mission1Marker) addEvent("rejectTheMission", true) addEventHandler("rejectTheMission", root, function () triggerClientEvent ( source, "unshowMission1", source ) end ) addEvent("acceptTheMission", true) addEventHandler("acceptTheMission", root, function() triggerClientEvent ( source, "unshowMission1", source ) end ) Link to comment
Kenix Posted January 2, 2012 Share Posted January 2, 2012 Try local theMarker = createMarker ( 2467.8647460938, -1648.7094726563, 12.47255897522, "cylinder", 1, 255, 255, 0, 170 ) function mission1MarkerHit( element,matchingDimension ) if matchingDimension and getElementType( element ) == "player" then triggerClientEvent ( element, "showMission1", element ) end end addEventHandler("onMarkerHit",theMarker,mission1MarkerHit ) -- maybe you this too needed if not remove function mission1MarkerLeave( element,matchingDimension ) if matchingDimension and getElementType( element ) == "player" then triggerClientEvent ( element, "unshowMission1", element ) end end addEventHandler("onMarkerLeave",theMarker,mission1MarkerLeave ) addEvent("rejectTheMission", true) addEventHandler("rejectTheMission", root, function () triggerClientEvent ( source, "unshowMission1", source ) end ) addEvent("acceptTheMission", true) addEventHandler("acceptTheMission", root, function() triggerClientEvent ( source, "unshowMission1", source ) end ) Link to comment
GanJaRuleZ Posted January 3, 2012 Author Share Posted January 3, 2012 Don't works and it doesn't outputs any error Link to comment
Kenix Posted January 3, 2012 Share Posted January 3, 2012 I tested it now you need make higher marker 2 ~ units if marker below you can't hit. Done code server: local theMarker = createMarker ( 2467.8647460938, -1648.7094726563, 12.49255897522, "cylinder", 1, 255, 255, 0, 170 ) function mission1MarkerHit( element,matchingDimension ) if matchingDimension and getElementType( element ) == "player" then triggerClientEvent ( element, "showMission1", element ) end end addEventHandler("onMarkerHit",theMarker,mission1MarkerHit ) -- maybe you this too needed if not remove function mission1MarkerLeave( element,matchingDimension ) if matchingDimension and getElementType( element ) == "player" then triggerClientEvent ( element, "unshowMission1", element ) end end addEventHandler("onMarkerLeave",theMarker,mission1MarkerLeave ) addEvent("rejectTheMission", true) addEventHandler("rejectTheMission", root, function () triggerClientEvent ( source, "unshowMission1", source ) end ) addEvent("acceptTheMission", true) addEventHandler("acceptTheMission", root, function() triggerClientEvent ( source, "unshowMission1", source ) end ) Link to comment
GanJaRuleZ Posted January 3, 2012 Author Share Posted January 3, 2012 Ye it works , thanks EDIT : When i click any of buttons nothing happens.. Link to comment
Kenix Posted January 3, 2012 Share Posted January 3, 2012 No problem You not attack event "onClientGUIClick" for button 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