 
        Hero192
Members- 
                Posts512
- 
                Joined
- 
                Last visited
Everything posted by Hero192
- 
	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 )
- 
	Hello guys,im still newbie in the MTA Lua scripting i asked myself why ,then i find the answer because i don't know when should we use these things and why Like that: player,[player],(player) localPlayer root source thePlayer [thePlayer] [source] guiRoot slot hitPlayer [client] getRootElement
- 
	Anyone would give me an support on it? thanks in advance
- 
	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 )
- 
	Dosen't wroks because there is no event attached to Location1() function. can you solve the problem please i still newbie on script
- 
	-- 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
- 
	Anyone can give me an support hand on it?
- 
	Doesn't working ,as it must be like the Blip and Marker doesn't exist
- 
	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']
- 
	My main problem is here https://forum.multitheftauto.com/viewtopic.php?f=91&t=89553
- 
	Still not working, anyone please? it will help me in future to understand my faults i wish someone give me a hand
- 
	Change this line on your function location1cash addEventHandler( "onMarkerHit", root, location1cash ) to his addEventHandler( "onMarkerHit", markerlocation1, location1cash ) 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?
- 
	I need help here please ,any one would give me a hand on this?
- 
	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 )
- 
	Hello guys,i have a problem in marker, i did an transporter system with gui and grid list it works fine but the GUI show in other markers different of the TRANSPORT's markers.. anyone can give me a hand Thanks in advance
- 
	this one solver my current problem is here !! https://forum.multitheftauto.com/viewtopic.php?f=91&t=89553
- 
	Hello there i need help please, When i enter URL in Edit it works fine, like: Creating object,Destroying object,Playing music,stopping music... Please im stuck,i want all these thing that works in Edit works also for "guiGridListGetSelectedItem". function print ( message, r, g, b ) outputChatBox ( message, r, g, b ) end ------------------------------ -- The GUI -- ------------------------------ defaultMusic = { { "Hip Hop Radio", "http://mp3uplink.duplexfx.com:8054/listen.pls" }, { "A horse with no name", "http://netanimations.net/A-Horse-With-No-Name.mp3" }, {"Hit Radio", "http://www.181.fm/winamp.pls?station=181-power&style=mp3&description=Power%20181%20(Top%2040)&file=181-power.pls" } } local rx, ry = guiGetScreenSize ( ) button = { } GUIEditor_Grid = {} window = guiCreateWindow(510,288,352,322,"Speaker",false) guiWindowSetSizable(window, false) guiSetVisible ( window, false ) CurrentSpeaker = guiCreateLabel(11,288,232,19,"Radio exist: No",false, window) volume = guiCreateLabel(11,254,237,18,"Radio Vol: 100%", false, window) pos = guiCreateLabel(71,271,232,19," X: 0 , Y: 0 , Z: 0", false, window) guiCreateLabel(139,18,85,19,"Current URL:",false, window) guiCreateLabel(13,56,100,17,"Radio list:",false, window) --GUIEditor_Grid = guiCreateGridList(9,73,334,146,false, window) guiCreateLabel(11,271,225,18,"Radio pos:", false, window) --url = guiCreateEdit(11, 96, 272, 23, "", false, window) url = guiCreateEdit(9,35,328,20, "", false, window) button["place"] = guiCreateButton(9,225,94,24,"Create/Pla", false, window) button["remove"] = guiCreateButton(127,225,94,24,"Destroy", false, window) button["v-"] = guiCreateButton(247,255,94,24,"Vol -", false, window) button["v+"] = guiCreateButton(247,285,94,24,"Vol +", false, window) button["close"] = guiCreateButton(247,225,94,24,"Close", false, window) local List = guiCreateGridList(9,73,334,146,false,window) guiGridListSetSelectionMode(List,0) local col = guiGridListAddColumn(List,"Radio:",0.9,window) for i=1, #defaultMusic do guiGridListSetItemText(List, guiGridListAddRow(List), 1, defaultMusic[i][1], false, false) end addEventHandler( "onClientGUIClick", List, function() local row,col = guiGridListGetSelectedItem(List) if (row ~= -1 and col ~= -1) then playSound(defaultMusic[row][2]) end end) -------------------------- -- My sweet codes -- -------------------------- local isSound = false addEvent ( "onPlayerViewSpeakerManagment", true ) addEventHandler ( "onPlayerViewSpeakerManagment", root, function ( current ) local toState = not guiGetVisible ( window ) guiSetVisible ( window, toState ) showCursor ( toState ) if ( toState == true ) then guiSetInputMode ( "no_binds_when_editing" ) local x, y, z = getElementPosition ( localPlayer ) guiSetText ( pos, "X: "..math.floor ( x ).." , Y: "..math.floor ( y ).." , Z: "..math.floor ( z ) ) if ( current ) then guiSetText ( CurrentSpeaker, "Radio exist: Yes" ) isSound = true else guiSetText ( CurrentSpeaker, "Radio exist: No" ) end end end ) addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == button["close"] ) then guiSetVisible ( window, false ) showCursor ( false ) elseif ( source == button["place"] ) then if ( isURL ( ) ) then triggerServerEvent ( "onPlayerPlaceSpeakerBox", localPlayer, guiGetText ( url,col,row ), isPedInVehicle ( localPlayer ) ) guiSetText ( CurrentSpeaker, "Radio exist: Yes" ) isSound = true guiSetText ( volume, "Radio Vol: 100%" ) else print ( "You need to enter a URL.", 255, 0, 0 ) end elseif ( source == button["remove"] ) then triggerServerEvent ( "onPlayerDestroySpeakerBox", localPlayer ) guiSetText ( CurrentSpeaker, "Radio exist: Yes" ) isSound = false guiSetText ( volume, "Radio Vol: 100%" ) elseif ( source == button["v-"] ) then if ( isSound ) then local toVol = math.round ( getSoundVolume ( speakerSound [ localPlayer ] ) - subTrackOnSoundDown, 2 ) if ( toVol > 0.0 ) then print ( "Volume set to "..math.floor ( toVol * 100 ).."%!", 0, 255, 0 ) triggerServerEvent ( "onPlayerChangeSpeakerBoxVolume", localPlayer, toVol ) guiSetText ( volume, "Radio Vol: "..math.floor ( toVol * 100 ).."%" ) else print ( "The volume cannot go any lower.", 255, 0, 0 ) end end elseif ( source == button["v+"] ) then if ( isSound ) then local toVol = math.round ( getSoundVolume ( speakerSound [ localPlayer ] ) + subTrackOnSoundUp, 2 ) if ( toVol < 1.1 ) then print ( "Volume set to "..math.floor ( toVol * 100 ).."%!", 0, 255, 0 ) triggerServerEvent ( "onPlayerChangeSpeakerBoxVolume", localPlayer, toVol ) guiSetText ( volume, "Radio Vol: "..math.floor ( toVol * 100 ).."%" ) else print ( "The volume cannot go any higher.", 255, 0, 0 ) end end end end ) speakerSound = { } addEvent ( "onPlayerStartSpeakerBoxSound", true ) addEventHandler ( "onPlayerStartSpeakerBoxSound", root, function ( who, url,col,row, isCar,defaultMusic ) if ( isElement ( speakerSound [ who ] ) ) then destroyElement ( speakerSound [ who ] ) end local x, y, z = getElementPosition ( who ) speakerSound [ who ] = playSound3D ( url,col,row, x, y, z, true ) setSoundVolume ( speakerSound [ who ], 1 ) setSoundMinDistance ( speakerSound [ who ], 25 ) setSoundMaxDistance ( speakerSound [ who ], 40 ) if ( isCar ) then local car = getPedOccupiedVehicle ( who ) attachElements ( speakerSound [ who ], car, 0, 5, 1 ) end end ) addEvent ( "onPlayerDestroySpeakerBox", true ) addEventHandler ( "onPlayerDestroySpeakerBox", root, function ( who ) if ( isElement ( speakerSound [ who ] ) ) then destroyElement ( speakerSound [ who ] ) end end ) -------------------------- -- Volume -- -------------------------- addEvent ( "onPlayerChangeSpeakerBoxVolumeC", true ) addEventHandler ( "onPlayerChangeSpeakerBoxVolumeC", root, function ( who, vol ) if ( isElement ( speakerSound [ who ] ) ) then setSoundVolume ( speakerSound [ who ], tonumber ( vol ) ) end end ) function isURL ( ) if ( guiGetText ( url,col,row ) ~= "" ) then return true else return false end end function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end
- 
	About V1.1.5: (I already i reported the turf bug before this post) I will report some known bugs to add them in 1.1.5 as i know ,you just fix bugs if its known,so i will report some bugs and suggest something for the 1.1.5 release it will be great things to NG CnR gamemode 1)Also, there a bug in Group system, if you set someone rank it doesn't show in TAB. and as far as i know it's an CnR game mode, 2)So the turf system should works only for criminals not to all teams and only the type of "Gang" in groups system who can turf,so you need to create type:gang to turf it will be useful not all types. 3)Try to add SWAT Job exported to group system with another type "squad" or something not gang type,(gang=for turf),so you need to create group named SWAT to take SWAT job as founder. 4)House system //Plus your ideas of developent ..// Good luck with your great developent to NG!
