Jump to content

Mission script problem


GanJaRuleZ

Recommended Posts

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

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
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,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

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

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 by Guest
Link to comment

Ok , i forgot about this topic , xD:)

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...