Jump to content

Hero192

Members
  • Posts

    512
  • Joined

  • Last visited

Everything posted by Hero192

  1. Because im already using it in client side, it's just a part of blp not full code and if i created it in server side i'll have to use setElementdata again from server side to client..
  2. Imagine you have a GUI with Buttons, each button you name it with a number, 1.2.3.4....etc And when you click on button with number One, "1" it write a Number in editbox, same for other nums By the way, i tried to use setElement data from client to server for destroy the blip but doesn't works --server side: local BaseLV = {} addEventHandler( "onPlayerWasted", getRootElement( ), function () local blp = getElementData(source, "blp") if not blp then return end destroyElement (blp) local x, y, z = getElementPosition ( source ) BaseLV = createPickup ( x, y, z, 3, 1210, 1, 1 ) end ) --client side: blp = createBlip(826.1767578125, 853.82403564453,10.948932647705, 51) setElementData(localPlayer,"blp",blp)
  3. Thank you i'll try it out EDIT: I have another question i want to know how to make an Captcha, random code i mean like when you hit a marker you get GUI with an random code, you have to write it in the EditBox when you click ok the gate open, if its false then the gate won't open 2nd question,How to let an button write numbers in editbox, like a keyboard
  4. Hey guys, It's a pickup mission, i want if the player wasted the pickup be at his dead location,i tried this way but failed: local locations = { { 1463.80, 2823.78, 10.82}, } local pos = locations[math.random(#locations)] local x,y,z = unpack ( pos ) BaseLV = createPickup(x, y, z-1, 3, 1210, 1, 1) addEventHandler( "onPlayerWasted", getRootElement( ), function() local x, y, z = getElementPosition ( BaseLV [ source ] ) local x, y, z = getElementPosition ( source ) BaseLV [ source ] = createPickup ( x, y, z-1, 3, 1210, 1, 1 ) end )
  5. WARNING: Bad Argument createBlipAttachedTo
  6. Hello guys, my problem is i want to attach "Blip" on Object "burger" like that i already tried it but doesn't works blpmallete = createBlipAttachedTo (burger,37) local deliveryBaseLV = createPickup(1463.8021240234,2823.7890625,10.8203125,3,1210,0,0) blip = createBlip(1463.8021240234,2823.7890625,100, 37, 2, 255, 255, 255, 255, 0, 400) function pickupMallete(player) destroyElement(deliveryBaseLV) destroyElement(blip) blpmallete = createBlipAttachedTo (burger,37) burger = createObject(1230,0,0,0) attachElement(burger,player,12,0,0.1,0.3,0,180,0) triggerClientEvent(player, "delivery:gotJob",player,pickupMallete) end addEventHandler ( "onPickupHit", deliveryBaseLV , pickupMallete )
  7. Hello guys i have a small question about Meta, why should we report the mta version in Meta.xml? is it important to do or no need? "1.3.4-0.00000" client="1.3.4-0.00000" />
  8. Hero192

    I need help

    It's not about errors there's no errors, my problem is i want let these URLs in Table works in GuiGridList like when i put an URL in Editbox. To be more clear, I want let all acess about when i add URl of music in editbox the same working when i selecte random URL in grid list ,it must create object/start musics/stop musics...etc
  9. Hero192

    I need help

    Anyone can give me a hand on it please?
  10. Hero192

    I need help

    I still need help please, anyone?
  11. Hero192

    I need help

    local isSpeaker = false function print ( player, message, r, g, b ) outputChatBox ( message, player, r, g, b ) end speakerBox = { } addCommandHandler ( "speaker", function ( thePlayer ) if ( isElement ( speakerBox [ thePlayer] ) ) then isSpeaker = true end triggerClientEvent ( thePlayer, "onPlayerViewSpeakerManagment", thePlayer, isSpeaker ) end ) addEvent ( "onPlayerPlaceSpeakerBox", true ) addEventHandler ( "onPlayerPlaceSpeakerBox", root, function ( url, isCar,row,col ) if ( url ) then if ( isElement ( speakerBox [ source ] ) ) then local x, y, z = getElementPosition ( speakerBox [ source ] ) -- destroyElement ( speakerBox [ source ] ) removeEventHandler ( "onPlayerQuit", source, destroySpeakersOnPlayerQuit ) end local x, y, z = getElementPosition ( source ) local rx, ry, rz = getElementRotation ( source ) speakerBox [ source ] = createObject ( 2229, x-0.1, y+0.5, z - 1, 0, 0, rx ) print ( source, "SPEAKER: Speaker is succssfully placed.", 0, 255, 0 ) addEventHandler ( "onPlayerQuit", source, destroySpeakersOnPlayerQuit ) triggerClientEvent ( root, "onPlayerStartSpeakerBoxSound", root, source, url, isCar,col,row ) if ( isCar ) then local car = getPedOccupiedVehicle ( source ) attachElements ( speakerBox [ source ], car, 0.25, -1.3, -0.5, -0.5, 0, 0 ) end end end ) addEvent ( "onPlayerDestroySpeakerBox", true ) addEventHandler ( "onPlayerDestroySpeakerBox", root, function ( ) if ( isElement ( speakerBox [ source ] ) ) then destroyElement ( speakerBox [ source ] ) triggerClientEvent ( root, "onPlayerDestroySpeakerBox", root, source ) removeEventHandler ( "onPlayerQuit", source, destroySpeakersOnPlayerQuit ) print ( source, "SPEAKER: Speaker has been removed.", 255, 0, 0 ) else --print end end ) addEvent ( "onPlayerChangeSpeakerBoxVolume", true ) addEventHandler ( "onPlayerChangeSpeakerBoxVolume", root, function ( to ) triggerClientEvent ( root, "onPlayerChangeSpeakerBoxVolumeC", root, source, to ) end )
  12. Hero192

    I need help

    Normally,When you put an Music URL on the editbox it works fine, but what im trying to do, is to do an Table list with music URLs in the guiGridList you will just choose one of these URLs in gridlist to start them, But i failed,it start only the music but all players in my local server hear it and without creating the Object of Speaker i think you understood my situation
  13. Hero192

    I need help

    It's not about errors there's no errors, my problem is i want let these URLs in Table "defaultMusic" works in GuiGridList like when i put an URL in Editbox. To be more clear, I want let all acess for guigridlist like when i put url of music in editbox the same working i wants it to happen for gridlist when i selecte random URL in grid list ,it must create object/start musics/stop musics...etc 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 management.",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) guiCreateLabel(11,271,225,18,"Radio pos:", 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) 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 --server side: local isSpeaker = false function print ( player, message, r, g, b ) outputChatBox ( message, player, r, g, b ) end speakerBox = { } addCommandHandler ( "speaker", function ( thePlayer ) if ( isElement ( speakerBox [ thePlayer] ) ) then isSpeaker = true end triggerClientEvent ( thePlayer, "onPlayerViewSpeakerManagment", thePlayer, isSpeaker ) end ) addEvent ( "onPlayerPlaceSpeakerBox", true ) addEventHandler ( "onPlayerPlaceSpeakerBox", root, function ( url, isCar,row,col ) if ( url ) then if ( isElement ( speakerBox [ source ] ) ) then local x, y, z = getElementPosition ( speakerBox [ source ] ) -- destroyElement ( speakerBox [ source ] ) removeEventHandler ( "onPlayerQuit", source, destroySpeakersOnPlayerQuit ) end local x, y, z = getElementPosition ( source ) local rx, ry, rz = getElementRotation ( source ) speakerBox [ source ] = createObject ( 2229, x-0.1, y+0.5, z - 1, 0, 0, rx ) print ( source, "SPEAKER: Speaker is succssfully placed.", 0, 255, 0 ) addEventHandler ( "onPlayerQuit", source, destroySpeakersOnPlayerQuit ) triggerClientEvent ( root, "onPlayerStartSpeakerBoxSound", root, source, url, isCar,col,row ) if ( isCar ) then local car = getPedOccupiedVehicle ( source ) attachElements ( speakerBox [ source ], car, 0.25, -1.3, -0.5, -0.5, 0, 0 ) end end end ) addEvent ( "onPlayerDestroySpeakerBox", true ) addEventHandler ( "onPlayerDestroySpeakerBox", root, function ( ) if ( isElement ( speakerBox [ source ] ) ) then destroyElement ( speakerBox [ source ] ) triggerClientEvent ( root, "onPlayerDestroySpeakerBox", root, source ) removeEventHandler ( "onPlayerQuit", source, destroySpeakersOnPlayerQuit ) print ( source, "SPEAKER: Speaker has been removed.", 255, 0, 0 ) else --print end end ) addEvent ( "onPlayerChangeSpeakerBoxVolume", true ) addEventHandler ( "onPlayerChangeSpeakerBoxVolume", root, function ( to ) triggerClientEvent ( root, "onPlayerChangeSpeakerBoxVolumeC", root, source, to ) end )
  14. Thanks for everything GTX !! You must be PART OF MTA team
  15. Now,it sends this ERROR and resource failed ERROR:attempt to call global 'isMouseInPosition' (a nil value) EDIT: does this function have an Event Handler?
  16. I tried that but it gives me an Error (IT was giving the error before i add anything on it) ERROR: attempt to perform arithmetic on global 'sx' (a nil value) function isMouseInPosition(a, b, c, d) if not isCursorShowing() then return end local x, y = getCursorPosition() x, y = x*sx, y*sy if x >= a and y >= b and x <= a+c and y <= b+d then return true end return false end if isMouseInPosition(661, 296, 19, 16) then tocolor(150, 0, 0, 200) else tocolor(0, 0, 0, 200) end
  17. Hello guys, i want to let the rectangle and Text color be changed after you the Cursor(Mouse) hit it and when it leave the color back like the first time. NOTE: If this way works for both of them TEXT & Rectangle its okay please give me just one example and i'll understand dxDrawText("BUY",538.0,380.0,611.0,398.0,tocolor(255,255,255,255),1.0,"arial","left","top",false,false,true) dxDrawRectangle(661.0,296.0,19.0,16.0,tocolor(0,0,0,200),false)
  18. Ah,thanks again GTX for your answer
  19. Hey guys,i start learning dx draw stuffs , my question is ,if i remplaced almost all default GUIs with dxDraw GUIs does that going to causes lags?
  20. Thanks i understand your messages,i have one more question, what's the diferrent between pairs and ipairs
  21. Hey guys, i have some questions, i want to knows what does these variables do and when we can use them (i didnt understand the meaning of them from lua.org),i'll like to hear that from some experienced scripters Break while untill
  22. I don't know how to use it, i have no experiences on that
  23. OH thanks alot GTX for your efforts but you understood me by wrong i want to navigate from row to other
×
×
  • Create New...