Hero192 Posted July 2, 2015 Share Posted July 2, 2015 (edited) function Location1() deliverycarlocation1 = createVehicle (482,1605.42, -1472.97, 13.58,0,0,0) warpPedIntoVehicle (source,deliverycarlocation1) markerlocation1 = createMarker (1602.38, -1448.85, 12.55, "cylinder", 2, 255, 0, 0, 255) blipLS = createBlipAttachedTo (markerlocation1, 51) setElementVisibleTo ( "blipLS", root, false) setElementVisibleTo ( "blipLS", source, true) end addEvent ("setLocation1", true) addEventHandler ("setLocation1", root, Location1) function location1cash (player) if (player) and (player ~= source) then givePlayerMoney(player, 2000) setPlayerWantedLevel(player, getPlayerWantedLevel(player)+1) destroyElement(markerlocation1) destroyElement(blipLS) destroyElement(deliverycarlocation1) end end addEventHandler( "onMarkerHit", markerlocation1, location1cash ) Edited July 14, 2015 by Guest Link to comment
Hero192 Posted July 2, 2015 Author Share Posted July 2, 2015 I need help here please ,any one would give me a hand on this? Link to comment
bosslorenz Posted July 2, 2015 Share Posted July 2, 2015 1)When i hit another marker i get money/stars even if its not the delivery mission marker also if i hitted another marker with delivery mission's car i get money ..etc Change this line on your function location1cash addEventHandler( "onMarkerHit", root, location1cash ) to his addEventHandler( "onMarkerHit", markerlocation1, location1cash ) 2) blips show to other players setElementVisibleTo ( "the blip name", root, false) setElementVisibleTo ( "the blip name", player, true) This sets the blip invisible to everyone but visible to the player. Link to comment
Hero192 Posted July 2, 2015 Author Share Posted July 2, 2015 1)When i hit another marker i get money/stars even if its not the delivery mission marker also if i hitted another marker with delivery mission's car i get money ..etc Change this line on your function location1cash addEventHandler( "onMarkerHit", root, location1cash ) to his addEventHandler( "onMarkerHit", markerlocation1, location1cash ) 2) blips show to other players setElementVisibleTo ( "the blip name", root, false) setElementVisibleTo ( "the blip name", player, true) This sets the blip invisible to everyone but visible to the player. Doesn't works,when i hit the marker nothing happen... Anyone? Link to comment
bosslorenz Posted July 2, 2015 Share Posted July 2, 2015 Do this on your client side scripts with the GUI addEventHandler ( "onClientMarkerHit", marker, function ) marker = createMarker (x,y,z,type,r,g,b,a) <<-----the marker you want only the GUI will show. function = the function that will show upon the addEventHandler ( "onClientMarkerHit", marker, function ) is triggered. Get some infos here https://wiki.multitheftauto.com/wiki/Main_Page Im also learning in scripts so you should do the same. I already gave you the the eventHandler on your Criminal mission addEventHandler( "onMarkerHit", markerlocation1, location1cash ) so you should just take a look on the similarities of it with your openGui onClientMarkerHit Link to comment
Hero192 Posted July 2, 2015 Author Share Posted July 2, 2015 Check your private message (pm) Link to comment
Hero192 Posted July 2, 2015 Author Share Posted July 2, 2015 Still not working, anyone please? it will help me in future to understand my faults i wish someone give me a hand Link to comment
bosslorenz Posted July 2, 2015 Share Posted July 2, 2015 Try this on server side. And tell what is still the problem............. function Location1() deliverycarlocation1 = createVehicle (482,1605.42, -1472.97, 13.58,0,0,0) warpPedIntoVehicle (source,deliverycarlocation1) markerlocation1 = createMarker (1602.38, -1448.85, 12.55, "cylinder", 2, 255, 0, 0, 255) blipLS = createBlipAttachedTo (markerlocation1, 51) setElementVisibleTo ( "blipLS", root, false) setElementVisibleTo ( "blipLS", source, true) end addEvent ("setLocation1", true) addEventHandler ("setLocation1", root, Location1) function location1cash (player) if (player) and (player ~= source) then givePlayerMoney(player, 2000) setPlayerWantedLevel(player, getPlayerWantedLevel(player)+1) destroyElement(markerlocation1) destroyElement(blipLS) destroyElement(deliverycarlocation1) end end addEventHandler( "onMarkerHit", markerlocation1, location1cash ) Link to comment
Hero192 Posted July 2, 2015 Author Share Posted July 2, 2015 Try this on server side. And tell what is still the problem............. function Location1() deliverycarlocation1 = createVehicle (482,1605.42, -1472.97, 13.58,0,0,0) warpPedIntoVehicle (source,deliverycarlocation1) markerlocation1 = createMarker (1602.38, -1448.85, 12.55, "cylinder", 2, 255, 0, 0, 255) blipLS = createBlipAttachedTo (markerlocation1, 51) setElementVisibleTo ( "blipLS", root, false) setElementVisibleTo ( "blipLS", source, true) end addEvent ("setLocation1", true) addEventHandler ("setLocation1", root, Location1) function location1cash (player) if (player) and (player ~= source) then givePlayerMoney(player, 2000) setPlayerWantedLevel(player, getPlayerWantedLevel(player)+1) destroyElement(markerlocation1) destroyElement(blipLS) destroyElement(deliverycarlocation1) end end addEventHandler( "onMarkerHit", markerlocation1, location1cash ) Doesn't works it gave me some warnings WARNING: Criminalmission/server.lua:22:Bad argument @ 'addEventHandler' [Expected element at argument 2,got nil] WARNING: Criminalmission/server.lua:7: Bad argument @ 'setElementVisibleTo' [Expected element at argument 1,got string 'blipLS'] WARNING: Criminalmission/server.lua:8: Bad argument @ 'setElementVisibleTo' [Expected element at argument 1,got string 'blipLS'] Link to comment
DNL291 Posted July 2, 2015 Share Posted July 2, 2015 Client local markerlocation1, blipLS = nil local ped = createPed(0, 1616.44, -1506.98, 14.21,90) function onPedClick(button, state, absX, absY, wx, wy, wz, element) if (element and getElementType(element) == "ped" and state=="down") then local x, y, z = getElementPosition(localPlayer) if (element == ped) then if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then guiSetVisible(Window, true) showCursor (true) end end end end addEventHandler("onClientClick", root, onPedClick) function Location1() triggerServerEvent("givePVehicle", localPlayer) markerlocation1 = createMarker (1602.38, -1448.85, 12.55, "cylinder", 2, 255, 0, 0, 255) blipLS = createBlipAttachedTo (markerlocation1, 51) addEventHandler( "onClientMarkerHit", markerlocation1, function ( hitPlayer, d ) if hitPlayer == localPlayer and d then destroyElement(markerlocation1) destroyElement(blipLS) triggerServerEvent("doPayClient", localPlayer) end end ) end -- function onButtonClick() if (source == reject) then setCameraTarget(localPlayer) guiSetVisible(Window, false) showCursor(false) elseif (source == accept) then if (guiRadioButtonGetSelected(location1)) then triggerServerEvent ("setLocation1",getLocalPlayer()) guiSetVisible (Window,false) showCursor (false) end end end addEventHandler("onClientGUIClick", guiRoot, onButtonClick) Server local vehicles = {} addEvent("doPayClient", true) addEventHandler( "doPayClient", root, function() givePlayerMoney(client, 2000) setPlayerWantedLevel(client, getPlayerWantedLevel(client)+1) destroyElement(vehicles[client]) end ) addEvent("givePVehicle", true) addEventHandler( "givePVehicle", root, function() vehicles[client] = createVehicle (482,1605.42, -1472.97, 13.58,0,0,0) warpPedIntoVehicle(client,vehicles[client]) end ) Try it. Link to comment
Hero192 Posted July 2, 2015 Author Share Posted July 2, 2015 Client local markerlocation1, blipLS = nil local ped = createPed(0, 1616.44, -1506.98, 14.21,90) function onPedClick(button, state, absX, absY, wx, wy, wz, element) if (element and getElementType(element) == "ped" and state=="down") then local x, y, z = getElementPosition(localPlayer) if (element == ped) then if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then guiSetVisible(Window, true) showCursor (true) end end end end addEventHandler("onClientClick", root, onPedClick) function Location1() triggerServerEvent("givePVehicle", localPlayer) markerlocation1 = createMarker (1602.38, -1448.85, 12.55, "cylinder", 2, 255, 0, 0, 255) blipLS = createBlipAttachedTo (markerlocation1, 51) addEventHandler( "onClientMarkerHit", markerlocation1, function ( hitPlayer, d ) if hitPlayer == localPlayer and d then destroyElement(markerlocation1) destroyElement(blipLS) triggerServerEvent("doPayClient", localPlayer) end end ) end -- function onButtonClick() if (source == reject) then setCameraTarget(localPlayer) guiSetVisible(Window, false) showCursor(false) elseif (source == accept) then if (guiRadioButtonGetSelected(location1)) then triggerServerEvent ("givePVehicle",getLocalPlayer()) guiSetVisible (Window,false) showCursor (false) end end end addEventHandler("onClientGUIClick", guiRoot, onButtonClick) Server local vehicles = {} addEvent("doPayClient", true) addEventHandler( "doPayClient", root, function() givePlayerMoney(client, 2000) setPlayerWantedLevel(client, getPlayerWantedLevel(client)+1) destroyElement(vehicles[client]) end ) addEvent("givePVehicle", true) addEventHandler( "givePVehicle", root, function() vehicles[client] = createVehicle (482,1605.42, -1472.97, 13.58,0,0,0) warpPedIntoVehicle(client,vehicles[client]) end ) Try it. Doesn't working ,as it must be like the Blip and Marker doesn't exist Link to comment
Hero192 Posted July 2, 2015 Author Share Posted July 2, 2015 Anyone can give me an support hand on it? Link to comment
Walid Posted July 2, 2015 Share Posted July 2, 2015 Anyone can give me an support hand on it? -- Client side local ped = createPed(0, 1616.44, -1506.98, 14.21,90) function onPedClick(button, state, absX, absY, wx, wy, wz, element) if (element and getElementType(element) == "ped" and state=="down") then local x, y, z = getElementPosition(localPlayer) if (element == ped) then if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then guiSetVisible(Window, true) showCursor (true) end end end end addEventHandler("onClientClick", root, onPedClick) function Location1() markerlocation1 = createMarker (1602.38, -1448.85, 12.55, "cylinder", 2, 255, 0, 0, 255) blipLS = createBlipAttachedTo (markerlocation1, 51) triggerServerEvent("givePVehicle", localPlayer) addEventHandler( "onClientMarkerHit", markerlocation1, function ( hitPlayer, d ) if isElement(markerlocation1) then destroyElement(markerlocation1) destroyElement(blipLS) end triggerServerEvent("doPayClient", hitPlayer) end ) end function onButtonClick() if (source == reject) then setCameraTarget(localPlayer) guiSetVisible(Window, false) showCursor(false) elseif (source == accept) then if (guiRadioButtonGetSelected(location1)) then triggerServerEvent ("givePVehicle",getLocalPlayer()) guiSetVisible (Window,false) showCursor (false) end end end addEventHandler("onClientGUIClick", guiRoot, onButtonClick) -- Server side local vehicles = {} addEvent("doPayClient", true) addEventHandler( "doPayClient", root, function() givePlayerMoney(source, 2000) setPlayerWantedLevel(source, getPlayerWantedLevel(source)+1) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end end ) addEvent("givePVehicle", true) addEventHandler( "givePVehicle", root, function() local vehicle = createVehicle (482,1605.42, -1472.97, 13.58,0,0,0) vehicles[source] = vehicle warpPedIntoVehicle(source,vehicles[source]) end ) Link to comment
Hero192 Posted July 2, 2015 Author Share Posted July 2, 2015 Anyone can give me an support hand on it? -- Client side local ped = createPed(0, 1616.44, -1506.98, 14.21,90) function onPedClick(button, state, absX, absY, wx, wy, wz, element) if (element and getElementType(element) == "ped" and state=="down") then local x, y, z = getElementPosition(localPlayer) if (element == ped) then if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then guiSetVisible(Window, true) showCursor (true) end end end end addEventHandler("onClientClick", root, onPedClick) function Location1() markerlocation1 = createMarker (1602.38, -1448.85, 12.55, "cylinder", 2, 255, 0, 0, 255) blipLS = createBlipAttachedTo (markerlocation1, 51) triggerServerEvent("givePVehicle", localPlayer) addEventHandler( "onClientMarkerHit", markerlocation1, function ( hitPlayer, d ) if isElement(markerlocation1) then destroyElement(markerlocation1) destroyElement(blipLS) end triggerServerEvent("doPayClient", hitPlayer) end ) end function onButtonClick() if (source == reject) then setCameraTarget(localPlayer) guiSetVisible(Window, false) showCursor(false) elseif (source == accept) then if (guiRadioButtonGetSelected(location1)) then triggerServerEvent ("givePVehicle",getLocalPlayer()) guiSetVisible (Window,false) showCursor (false) end end end addEventHandler("onClientGUIClick", guiRoot, onButtonClick) -- Server side local vehicles = {} addEvent("doPayClient", true) addEventHandler( "doPayClient", root, function() givePlayerMoney(source, 2000) setPlayerWantedLevel(source, getPlayerWantedLevel(source)+1) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end end ) addEvent("givePVehicle", true) addEventHandler( "givePVehicle", root, function() local vehicle = createVehicle (482,1605.42, -1472.97, 13.58,0,0,0) vehicles[source] = vehicle warpPedIntoVehicle(source,vehicles[source]) end ) Doesn't works.. the marker still doesn't exist without errors in debugscript ... help me please Link to comment
Walid Posted July 2, 2015 Share Posted July 2, 2015 Doesn't works.. the marker still doesn't exist without errors in debugscript ... help me please Dosen't wroks because there is no event attached to Location1() function. Link to comment
Hero192 Posted July 2, 2015 Author Share Posted July 2, 2015 Doesn't works.. the marker still doesn't exist without errors in debugscript ... help me please Dosen't wroks because there is no event attached to Location1() function. can you solve the problem please i still newbie on script Link to comment
Walid Posted July 2, 2015 Share Posted July 2, 2015 can you solve the problem please i still newbie on script Try this -- Client side local ped = createPed(0, 1616.44, -1506.98, 14.21,90) function onPedClick(button, state, absX, absY, wx, wy, wz, element) if (element and getElementType(element) == "ped" and state=="down") then local x, y, z = getElementPosition(localPlayer) if (element == ped) then if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then guiSetVisible(Window, true) showCursor (true) end end end end addEventHandler("onClientClick", root, onPedClick) function Location1() markerlocation1 = createMarker (1602.38, -1448.85, 12.55, "cylinder", 2, 255, 0, 0, 255) blipLS = createBlipAttachedTo (markerlocation1, 51) addEventHandler( "onClientMarkerHit", markerlocation1, function ( hitPlayer, d ) if isElement(markerlocation1) then destroyElement(markerlocation1) destroyElement(blipLS) end triggerServerEvent("doPayClient", hitPlayer) end ) end function onButtonClick() if (source == reject) then setCameraTarget(localPlayer) guiSetVisible(Window, false) showCursor(false) elseif (source == accept) then if (guiRadioButtonGetSelected(location1)) then triggerServerEvent ("givePVehicle",getLocalPlayer()) Location1() guiSetVisible (Window,false) showCursor (false) end end end addEventHandler("onClientGUIClick", guiRoot, onButtonClick) -- server side local vehicles = {} addEvent("doPayClient", true) addEventHandler( "doPayClient", root, function() givePlayerMoney(source, 2000) setPlayerWantedLevel(source, getPlayerWantedLevel(source)+1) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end end ) addEvent("givePVehicle", true) addEventHandler( "givePVehicle", root, function() local vehicle = createVehicle (482,1605.42, -1472.97, 13.58,0,0,0) vehicles[source] = vehicle warpPedIntoVehicle(source,vehicles[source]) end ) Link to comment
Hero192 Posted July 3, 2015 Author Share Posted July 3, 2015 I still have one more problem about how to add the second location here's my code, i tried but i failed ,the marker shows when i choose the 2nd location but when i hit it nothing happen... Client-- local ped = createPed(0, 1616.44, -1506.98, 14.21,90) function onPedClick(button, state, absX, absY, wx, wy, wz, element) if (element and getElementType(element) == "ped" and state=="down") then local x, y, z = getElementPosition(localPlayer) if (element == ped) then if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then guiSetVisible(Window, true) showCursor (true) end end end end addEventHandler("onClientClick", root, onPedClick) function Location1() markerlocation1 = createMarker (1602.38, -1448.85, 12.55, "cylinder", 2, 255, 0, 0, 255) blipLS = createBlipAttachedTo (markerlocation1, 51) addEventHandler( "onClientMarkerHit", markerlocation1, function ( hitPlayer, d ) if isElement(markerlocation1) then destroyElement(markerlocation1) destroyElement(blipLS) end triggerServerEvent("doPayClient", hitPlayer) end ) end function Location2() markerlocation2 = createMarker (1589.78, -1401.73, 12.98,"cylinder",2,255,0,0,255) blipLV = createBlipAttackedTo (markerlocation2, 51) addEventHandler("onClientMarkerHit",markerlocation2, function( hitPlayer,dd ) if isElement (markerlocation2) then destroyElement (markerlocation2) destroyElement (blipLV) end triggerServerEvent ("doPayClient2",hitPlayer) end ) end function onRejectClick() if (source == reject) then setCameraTarget(localPlayer) guiSetVisible(Window, false) showCursor(false) end end addEventHandler("onClientGUIClick", guiRoot, onRejectClick) function onAcceptClick () if (source == accept) then if (guiRadioButtonGetSelected(location1)) then triggerServerEvent ("givePVehicle",getLocalPlayer()) Location1() guiSetVisible (Window,false) showCursor (false) end end end addEventHandler("onClientGUIClick", guiRoot, onAcceptClick) function onAcceptClick2() if (source == accept) then if (guiRadioButtonGetSelected(location2)) then triggerServerEvent ("givePVehicle2",getLocalPlayer()) Location2() guiSetVisible (Window,false) showCursor (false) end end end addEventHandler("onClientGUIClick", guiRoot, onAcceptClick2) Server-- local vehicles = {} addEvent("doPayClient", true) addEventHandler( "doPayClient", root, function() givePlayerMoney(source, 2000) setPlayerWantedLevel(source, getPlayerWantedLevel(source)+1) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end end ) addEvent("doPayClient2", true) addEventHandler( "doPayClient2", root, function() givePlayerMoney(source, 4000) setPlayerWantedLevel(source, getPlayerWantedLevel(source)+2) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end end ) addEvent("givePVehicle", true) addEventHandler( "givePVehicle", root, function() local vehicle = createVehicle (482,1605.42, -1472.97, 13.58,0,0,0) vehicles[source] = vehicle warpPedIntoVehicle(source,vehicles[source]) end ) addEvent("givePVehicle2", true) addEventHandler( "givePVehicle2", root, function() local vehicle2 = createVehicle (482,1605.42, -1472.97, 13.58,0,0,0) vehicles[source] = vehicle2 warpPedIntoVehicle(source,vehicles[source]) end ) Link to comment
Hero192 Posted July 3, 2015 Author Share Posted July 3, 2015 Anyone would give me an support on it? thanks in advance Link to comment
Hero192 Posted July 4, 2015 Author Share Posted July 4, 2015 can you solve the problem please i still newbie on script Try this -- Client side local ped = createPed(0, 1616.44, -1506.98, 14.21,90) function onPedClick(button, state, absX, absY, wx, wy, wz, element) if (element and getElementType(element) == "ped" and state=="down") then local x, y, z = getElementPosition(localPlayer) if (element == ped) then if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then guiSetVisible(Window, true) showCursor (true) end end end end addEventHandler("onClientClick", root, onPedClick) function Location1() markerlocation1 = createMarker (1602.38, -1448.85, 12.55, "cylinder", 2, 255, 0, 0, 255) blipLS = createBlipAttachedTo (markerlocation1, 51) addEventHandler( "onClientMarkerHit", markerlocation1, function ( hitPlayer, d ) if isElement(markerlocation1) then destroyElement(markerlocation1) destroyElement(blipLS) end triggerServerEvent("doPayClient", hitPlayer) end ) end function onButtonClick() if (source == reject) then setCameraTarget(localPlayer) guiSetVisible(Window, false) showCursor(false) elseif (source == accept) then if (guiRadioButtonGetSelected(location1)) then triggerServerEvent ("givePVehicle",getLocalPlayer()) Location1() guiSetVisible (Window,false) showCursor (false) end end end addEventHandler("onClientGUIClick", guiRoot, onButtonClick) -- server side local vehicles = {} addEvent("doPayClient", true) addEventHandler( "doPayClient", root, function() givePlayerMoney(source, 2000) setPlayerWantedLevel(source, getPlayerWantedLevel(source)+1) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end end ) addEvent("givePVehicle", true) addEventHandler( "givePVehicle", root, function() local vehicle = createVehicle (482,1605.42, -1472.97, 13.58,0,0,0) vehicles[source] = vehicle warpPedIntoVehicle(source,vehicles[source]) end ) 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