Jump to content

drk

Members
  • Posts

    1,607
  • Joined

  • Last visited

Everything posted by drk

  1. drk

    Need help

    Doesn't show anything? LOL Only remove onColShapeLeave event.
  2. Window with player names: GUIEditor_Window[1] = guiCreateWindow(423,220,477,311,"Level_System v3.0 ",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Grid[1] = guiCreateGridList(9,21,264,281,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) local row = guiGridListAddRow ( playerList ) local col = guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.2) GUIEditor_Label[1] = guiCreateLabel(286,43,144,23,"Level :",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Label[2] = guiCreateLabel(284,95,102,21,"EXP:",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,0,255) guiSetFont(GUIEditor_Label[2],"clear-normal") GUIEditor_Image[1] = guiCreateStaticImage(266,152,182,146,"images/mtalogo.png",false,GUIEditor_Window[1]) for i, players in ipairs(getElementsByType('player')) do guiGridListSetItemText(GUIEditor_Grid[1],row,col,getPlayerName(players),false,false) end addEventHandler('onClientGUIClick',root, function() if source == GUIEditor_Grid[1] then local theRow, theCol = guiGridListGetSelectedItem(source) if theRow and theCol and theRow ~= -1 and theCol ~= -1 then local name = guiGridListGetItemText(source,theRow, theCol) --now use your head and script all, because we don't have the level and exp system then we can't make all for you end end) Headshot system: Client side: local x,y = guiGetScreenSize() function headshot ( killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then local image = guiCreateStaticImage ( x/4, y/5.8, 399,169, "SAMP"..math.random(1,4)..".png", false ) setTimer (guiSetVisible, 4000, 1, image, false ) end end addEventHandler ( "onClientPlayerWasted", getRootElement(), headshot ) Server side: addEventHandler("onPlayerWasted", root, function ( ammo, killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then if (bodypart == 9) then outputChatBox("**OWned->HeadShot !!!+$50**",killer,255,255,0) local owned = guiCreateStaticImage(0.45,0.6722,0.0917,0.0533,"images/owned.png",true) setTimer (guiSetVisible, 4000, 1, owned, false ) triggerClientEvent(killer,"playWastedSound",killer,"sounds/2.ogg") givePlayerMoney ( killer, 50 ) end else outputChatBox("**Woops Your Dead Try Next Time Noob ! - $5**",killer,255,255,0) triggerClientEvent(source,"playWastedSound",killer,"sounds/3.ogg") takePlayerMoney( killer, 5 ) end end)
  3. Ninguém trabalhará de graça.. Muito menos esses brasileiro que não entende nem o básico de Lua
  4. Eu sei que o Lucas já conseguiu resolver, mas mesmo assim vou responder. Primeiro, theVehicle tem valor nil, não existe. Segundo, tabule o código da próxima vez e use as tags
  5. www.lua-users.org/wiki/TutorialDirectory/
  6. Versões MTA SA 1.1 para cima tá tudo lagado... Não tem haver com o pc da pessoa, mas sim do jogo..
  7. Sabe porque o MTA está perdendo jogadores?? Por todo mundo ser noob que nem você... Brasileiro só usa recurso dos outro... Nem tenta usa o cerébro e estudar Lua.
  8. Em resposta à primeira pergunta, para 'tocar' uma música use playSound ( https://wiki.multitheftauto.com/wiki/playSound ). A função playSound é client side, syntax: element playSound ( sound, looped ) Looped significa se playSound será um loop infinito, ou seja, se a musica sera tocada infinitas vezes. Segundo, não é necessário converter 'skins' para o MTA, apenas importe o ficheiro DFF e TXD.
  9. drk

    save time

    exports.BHZ4_scoreboard:addScoreboardColumn('Tiempo Jugado') setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do local totalTime = getElementData( v,"totalTime" ) or 0 setElementData( v,"totalTime",totalTime+1 ) setElementData( v,"Tiempo Jugado",math.floor( tonumber( totalTime )/3600 ).." H : "..math.floor( tonumber( totalTime )/59 ).." M" ) end end, 1000, 0 ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local time = getElementData ( source, "totalTime" ) setAccountData ( playeraccount, "totalTime", time ) end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "totalTime" ) if ( time ) then setElementData ( source, "totalTime", time ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin) ?
  10. drk

    About tables

    table[1] ... table[2] ... For table[1][2] + table[2][2] + ... + table[n][2] = x You can't add tables with tables lol Learn: http://lua-users.org/wiki/TablesTutorial
  11. drk

    {HELP}How can I

    I just post full code. And it code better and shorter My bindKey( 'F1','down', function( ) guiSetVisible( GUIEditor_Window[1],not guiGetVisible( GUIEditor_Window[1] ) ) showCursor( not isCursorShowing( ) ) guiSetInputEnabled( not guiGetInputEnabled( ) ) end ) Your bindKey('F1','down', function() if (guiGetVisible(GUIEditor_Window[1]) == true) then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) guiSetInputEnabled(false) else guiSetVisible(GUIEditor_Window[1],true) showCursor(true) guiSetInputEnabled(true) end end) I know dude..
  12. drk

    Help me

    When you save the script select the encode type UTF-8
  13. drk

    {HELP}How can I

    Then, Kenix post isn't needed too, yes? ^^ Stop...
  14. drk

    {HELP}How can I

    GUIEditor_Window[1] = guiCreateWindow(151,53,522,505,"Welcome. Have Fun ",false) GUIEditor_Memo[1] = guiCreateMemo(12,76,256,155,"Commands:\n\nFor repair...../r\nFor flip...../f\nFor nitro...../n\n\nWARNING: Dont spam commands.",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Memo[2] = guiCreateMemo(10,247,259,116,"Rules:\n\nDont cheat~\nDont camp~\nPlay fair~\nBe good~\nAccept~\n",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Checkbox[1] = guiCreateCheckBox(61,72,36,33,"",false,false,GUIEditor_Memo[2]) GUIEditor_Memo[3] = guiCreateMemo(11,375,258,31,"Try to be the best ))))",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[3],true) GUIEditor_Image[1] = guiCreateStaticImage(249,92,235,289,"images/mtalogo.png",false,GUIEditor_Window[1]) GUIEditor_Progress[1] = guiCreateProgressBar(20,419,478,72,false,GUIEditor_Window[1]) GUIEditor_Progress[2] = guiCreateProgressBar(17,22,484,49,false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(270,165,5,5,"",false) guiSetVisible(GUIEditor_Window[1],false) bindKey('F1','down', function() if (guiGetVisible(GUIEditor_Window[1]) == true) then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) guiSetInputEnabled(false) else guiSetVisible(GUIEditor_Window[1],true) showCursor(true) guiSetInputEnabled(true) end end)
  15. drk

    Help pls!

    \õ/ My bad, i don't remember this function.
  16. drk

    Help pls!

    currentWeaponID is nil.. I think in MTASA you can't see what weapon player are using. What I can do.. alreadyS = 0 bindKey(source,'x','down', function() if alreadyS == 0 then setPedStat(source,79,300) alreadyS = 1 outputChatBox('Works fine!', source, 255, 69, 0) else setPedStat(source,79,999) alreadyS = 0 outputChatBox('It works oO',source,255,69,0) end end)
  17. drk

    Spawn help

    addEventHandler( "onResourceStart", resourceRoot, function() resetMapInfo() for _,player in ipairs( getElementsByType 'player' ) do spawn( player ) end end ) function spawn( player ) if not isElement( player ) then return end showChat( player, true ) local acc = getPlayerAccount( player ) if acc and not isGuestAccount( acc ) then if isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "DanWesson" ) ) then spawnPlayer ( player, -49.161193847656, -225.46385192871, 5.4296875, 90, 287, 0, 0 ) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "SWAT" ) ) then spawnPlayer ( player, -550.86010742188, 2594.9943847656, 53.93478012085, 90, 285, 0, 0 ) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "GBO" ) ) then spawnPlayer ( player, 1058.5606689453, 1279.9813232422, 10.8203125, 90, 120, 0, 0 ) end else spawnPlayer( player, -702.6533203125, 962.88671875, 12.393084526062, 90, 293, 0, 0 ) end fadeCamera( player, true ) setCameraTarget( player, player ) end addEventHandler( "onPlayerJoin", root, function( ) spawn( source ) end) addEventHandler( "onPlayerWasted", root, function( ) setTimer( spawn, 1800, 1, source ) end) addEventHandler('onPlayerLogin', root, function() killPed(source) end) I think it will work...
  18. drk

    onClientClick help.

    lol, you can't replace "something" with the text name. You have to replace with the variable. In this case you have to use an alternative dx text drawing system that you can set a variable to or use gui label ( or other you want ).
  19. drk

    XML question

    Or you can use SQLite.
  20. drk

    Spawn help

    "what currently happens is that when I die I see my dead body, the map, and the camera doing some movements getting away from the body, when i choose a location, I just spawn there.." this is your problem? Try: addEventHandler( "onResourceStart", resourceRoot, function() resetMapInfo() for _,player in ipairs( getElementsByType 'player' ) do spawn( player ) end end ) function spawn( player ) if not isElement( player ) then return end showChat( player, true ) local acc = getPlayerAccount( player ) if acc and not isGuestAccount( acc ) then if isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "DanWesson" ) ) then spawnPlayer ( player, -49.161193847656, -225.46385192871, 5.4296875, 90, 287, 0, 0 ) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "SWAT" ) ) then spawnPlayer ( player, -550.86010742188, 2594.9943847656, 53.93478012085, 90, 285, 0, 0 ) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "GBO" ) ) then spawnPlayer ( player, 1058.5606689453, 1279.9813232422, 10.8203125, 90, 120, 0, 0 ) end else outputChatBox( 'You are not logged in!' ) end fadeCamera( player, true ) setCameraTarget( player, player ) end addEventHandler( "onPlayerJoin", root, function( ) spawn( source ) end) addEventHandler( "onPlayerWasted", root, function( ) setTimer( spawn, 1800, 1, source ) end) It work for me.
  21. drk

    Spawn help

    Type /debugscript 3 in the chat and see if you get any error.
  22. drk

    play random sound

    I think it worked D: Edit: I think, but it don't worked
  23. hey, im creating a random music script. It plays some musics and then stop playing random sounds. Can anyone help ? code: local currentSound = nil local musicURL = { } local musicURL = { [1] = { name='David Guetta - Where Dem Girls At', url='http://199.167.195.178/wdga.mp3' }, [2] = { name='Coldplay - Paradise', url='http://199.167.195.178/pd.mp3' }, [3] = { name='Coldplay - Viva la Vida', url='http://199.167.195.178/vlv.mp3' }, [4] = { name='Ana Malhoa - Danza Kuduro', url='http://199.167.195.178/dk.mp3' }, [5] = { name='Klaas - The Way', url='http://199.167.195.178/tw.mp3' }, [6] = { name='Basshunter - All I ever Wanted', url='http://199.167.195.178/bh-aiew.mp3' }, [7] = { name='Whiz Khalifa - Black and Yellow', url='http://199.167.195.178/wk-bay.mp3' }, [8] = { name='Skrillex - My name is Skrillex', url='http://199.167.195.178/sx-mnis.mp3' }, [9] = { name='Italobrothers - Stamp on the Ground', url='http://199.167.195.178/ib-sotg.mp3' }, [10] = { name='Madcon - Freaky Like Me', url='http://199.167.195.178/mc-flm.mp3' }, [11] = { name='Cut the Music - Greatest Deejay', url='http://199.167.195.178/ctm-gd.mp3' }, --[['http://199.167.195.178/tv.mp3', 'http://199.167.195.178/wttc.mp3', 'http://199.167.195.178/iml.mp3', 'http://199.167.195.178/ctwykm.mp3', 'http://199.167.195.178/e-ksb9rx.mp3', 'http://199.167.195.178/Lights.mp3', 'http://199.167.195.178/nod.mp3', 'http://199.167.195.178/atb-yana.mp3']]-- } addEventHandler('onClientResourceStart',resourceRoot, function() local random = math.random(#musicURL) local name, song = musicURL[random].name, musicURL[random].url currentSound = playSound(song,false); addEventHandler('onClientRender', root, playing) musicName = tostring(name) setTimer( function() removeEventHandler('onClientRender',root,playing) end,10000,1) end) addEventHandler('onClientElementDestroy', root, function() if (isSoundPaused(currentSound) == true) then return end if (source == currentSound) then local random = math.random(#musicURL) local name, song = musicURL[random].name, musicURL[random].url currentSound = playSound(song,false); removeEventHandler('onClientRender',root,playing) addEventHandler('onClientRender', root, playing) musicName = tostring(name) setTimer( function() removeEventHandler('onClientRender',root,playing) end,10000,1) end; end); rand = setTimer( function() if (isSoundPaused(currentSound) == true) then return end if (currentSound == nil) then local random = math.random(#musicURL) local name, song = musicURL[random].name, musicURL[random].url currentSound = playSound(song,false); addEventHandler('onClientRender', root, playing) musicName = tostring(name) setTimer( function() removeEventHandler('onClientRender',root,playing) end,10000,1) end; end,1000,0)
×
×
  • Create New...