Jump to content

drk

Members
  • Posts

    1,607
  • Joined

  • Last visited

Everything posted by drk

  1. drk

    Noob problem

    I will try later. Anyway, thanks for trying to help
  2. @@Cadu12 As far as I know, onClientKey don't detect letters like "é", "á" etc
  3. LOL? I posted the link of split function in Wiki.
  4. Maybe split ? https://wiki.multitheftauto.com/wiki/Split
  5. Can you explain better? I don't understand what you want. ( Only what I get is that you want a event for something ).
  6. drk

    all vehicles freeze

    createVehicle setElementFrozen
  7. drk

    Need help.

    Thanks for explain I need to start learning Lua again LOL
  8. drk

    getPlayerName

    I thought that you want to output to the player who clicked in the gui element
  9. drk

    getPlayerName

    Source is the clicked gui element. addEventHandler ( 'onClientGUIClick', root, function () if ( source == GUIEditor_Button[1] ) then local row,col = guiGridListGetSelectedItem ( GUIEditor_Grid[1] ) if ( row and col and row ~= -1 and col ~= -1 ) then local playerName = guiGridListGetItemText ( GUIEditor_Grid[1], row, 1 ) local player = getPlayerFromName ( playerName ) setElementData ( player,'canChat',true ) outputChatBox( 'You Have Give Him Talk Power !',localPlayer, 255,255,0 ) playSound ( 'sounds/talkpower_granted.wav' ) outputChatBox ( getPlayerName(localPlayer) .. 'Has Been given Talk Power By The Admin !', 255, 255, 0 ) end elseif ( source == GUIEditor_Button[2] ) then local row,col = guiGridListGetSelectedItem ( GUIEditor_Grid[1] ) if ( row and col and row ~= -1 and col ~= -1 ) then local playerName = guiGridListGetItemText ( GUIEditor_Grid[1], row, 1 ) local player = getPlayerFromName ( playerName ) setElementData ( player, 'canChat', false ) outputChatBox ( 'You Have Remove His Talk Power !', localPlayer, 255, 255, 0 ) playSound ( 'sounds/talkpower_revoked.wav' ) outputChatBox ( getPlayerName(localPlayer) .. ' Talk Power Has Been Removed Form Him By The Admin !', 0, 255, 255 ) end end end )
  10. drk

    Need help.

    Paper, your code is wrong local current local songID = { [ 1 ] = 'Your sound url / directory', [ 2 ] = 'Your sound url / directory', [ 3 ] = 'Your sound url / directory' } addEventHandler ( 'onClientResourceStart', resourceRoot, function ( ) local sound = songID [ math.random ( #songID ) ] current = playSound ( sound, false ) setRadioChannel ( 0 ) end ) addEventHandler ( 'onClientResourceStop', resourceRoot, function ( ) if isElement ( current ) then destroyElement ( current ) end end ) function radioOff ( ) setRadioChannel ( 0 ) cancelEvent ( ) end addEventHandler ( 'onClientPlayerRadioSwitch', root, radioOff ) addEventHandler ( 'onClientPlayerVehicleEnter', root, radioOff ) addCommandHandler ( 'sound', function ( thePlayer, command, id ) if ( type ( id ) ~= 'number' ) then return end if isElement ( current ) then destroyElement ( current ) end for i, music in ipairs ( songID ) do playSound ( i[id], false ) end end ) Not tested. Command /sound without < >.
  11. didn't work, it shows all the time on resource start and buttons stopped working =/ @Draken, I didn't really catch ya there, what do you mean? When you use like this: addEventHandler ( 'eventName', root, ---- ---- end ) You can't put like function example() You can't put name in functions. Example of correct script: addEventHandler ( 'onResourceStart', root, function() -- Something end )
  12. You can't put function name. It have to be: addEventHandler ( 'eventName', root, function ( ) -- Something here end )
  13. drk

    Problem setTimer

    Copy paste? You lol.
  14. drk

    Some help!

    Client - side: WTF! -- s:shock: --> Server - side: addEvent ( 'change', true ) addEventHandler ( 'change', root, function ( nick ) setPlayerName ( source, nick ) end )
  15. lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red and green and blue ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) setVehicleHeadLightColor ( veh, red, green, blue ) outputChatBox ( 'You have changed your vehicle lights!' ) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) end end )
  16. drk

    Enter Please

    If it's by a player types in a memo or other: memo = guiCreateMemo ( ... ) button = guiCreateButton ( ... ) addEventHandler ( 'onClientGUIClick',root, function ( ) if ( source == button ) then local url = guiGetText ( memo ) playSound ( url, false ) end end ) If it's by your url only use: playSound ( 'http://example.com', false )
  17. drk

    Enter Please

    Yeah?? What? get's music url that you put in a memo or play the music from the url you put?
  18. drk

    Enter Please

    Huumm.. I can't understand. You want a function that get's music url that you put in a memo or play the music from the url you put?
  19. drk

    onMarkerHit

    LOL No problem
  20. drk

    onMarkerHit

    Because source is the marker. local myMarker = createMarker ( 285.62497, 1820.85889, 19.000000, 'arrow', 2.0, 255, 255, 0, 150 ) function markerHit ( element, dimension ) setElementPosition ( element, 287.85568, 1820.85620, 17.64063 ) end addEventHandler ( 'onMarkerHit', myMarker, markerHit )
  21. First and last time I joined to the MTA IRC trying to get scripting help it's really mess. Here we can chat calmly.
×
×
  • Create New...