Jump to content

Aibo

Retired Staff
  • Posts

    1,105
  • Joined

  • Last visited

Everything posted by Aibo

  1. not working how? any errors in debug?
  2. post your query, maybe?
  3. if you mean that the car and name get different color and you want the same for both — you need to assign the same color: addEvent("carCol",true) addEventHandler("carCol",root, function(pVehicleSG) local r,g,b = math.random(0,255), math.random(0,255), math.random(0,255) setTimer(setVehicleColor, 1000, 1000, pVehicleSG, r,g,b) setTimer(setPlayerNametagColor, 1000, 1000, getVehicleController(pVehicleSG), r,g,b) end )
  4. excuse me, even you haev ads on your site (and what exactly is it you do for people?), i think MTA team is allowed to finally cover some expenses for the servers and time spent on MTA. PS: sorting is in:
  5. that syntax is wrong: { color = 0, 0, 255 } that way color is 0, and other values are just other values. so when you do setPlayerNametagColor there are not enough arguments. try using "color = {0, 0, 255}" and then "setPlayerNametagColor ( hitElement, unpack(pickup.color))"
  6. 1. imo, it's better to have just the 2 lists: server/client. this 4-part-shared idea is overcomplicated. 2. what about "self" in methods? also, i believe there should be some indication, which vars belong to Lua and which introduced by MTA.
  7. Aibo

    Coding guidelines

    1. i believe this should go into tutorials subforum, now that we have one. 2. translation is horrible. i dont know, who stickied it, so i'm not gonna unstick, but... get someone with proper english knowledge to proof read this, since this is a general (english) section.
  8. Aibo

    Force GUIs

    you can call bindKey function from a timer, so it will be bound to window closing after some time, for example.
  9. Aibo

    Problem setTimer

    lines 1 and 2 are useless. also read about setTimer parameters, you have 1 timer repetition set.
  10. Aibo

    Force GUIs

    gui window pops up the moment you create/show it. and it cannot be closed with a key, unless this functionality is scripted. so i dont get the problem.
  11. после 50 штук stopSound подряд сил моих больше нет :3 сервер: local djmarker = createMarker( 781.4, -1360.2, 13.2, 'cylinder', 3, 0, 0, 255, 100 ) function DJMarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == 'player' then local uTeam = getPlayerTeam( hitElement ) if uTeam then if getTeamName( uTeam ) == 'DJ' then triggerClientEvent ( hitElement, "showWindow", hitElement ) else outputChatBox ( "You are #FF0000NOT #FFFFFFa #0000FFDJ#FFFFFF!", hitElement, 255, 255, 255, true ) end else outputChatBox ( "You are #FF0000NOT #FFFFFFa #0000FFDJ#FFFFFF!", hitElement, 255, 255, 255, true ) end end end addEventHandler( "onMarkerHit", djmarker, DJMarkerHit ) function musicChange(musicID) triggerClientEvent(root, "onClientMusicChange", root, musicID) end addEvent( "onMusicChange", true ) addEventHandler( "onMusicChange", root, musicChange ) клиент: local musicFiles = { "music1.mp3", "music2.mp3", "music3.mp3", "music4.mp3", "music5.mp3", "music6.mp3", "music7.mp3", } local soundData = { --{ x, y, z, distance, volume} { 780, -1362.3, 13.9, 15, 10 }, { 780, -1357.65, 13.9, 15, 10 }, { 767.5, -1352.9, 13.1, 15, 10 }, { 767.4, -1366, 13.1, 15, 10 }, { 785.9, -1350.7, 12.6, 15, 10 }, { 774.2, -1344, 12.6, 15, 10 }, { 773.9, -1373.4, 12.6, 15, 10 }, { 786.2, -1369.6, 12.5, 15, 10 }, } local nowPlaying = {} local gui = {} addEventHandler("onClientResourceStart", resourceRoot, function() gui.window = guiCreateWindow(15,300,200,250,"DJ Panel",false) gui.close = guiCreateButton(175,225,20,20,"X",false,gui.window) gui.noobster = guiCreateLabel(10,225,150,50,"Created by Noobster",false,gui.window) gui.musicButtons = { guiCreateButton(25,100,50,20,"Play 1",false,gui.window), guiCreateButton(125,100,50,20,"Play 2",false,gui.window), guiCreateButton(25,125,50,20,"Play 3",false,gui.window), guiCreateButton(125,125,50,20,"Play 4",false,gui.window), guiCreateButton(25,150,50,20,"Play 5",false,gui.window), guiCreateButton(125,150,50,20,"Play 6",false,gui.window), guiCreateButton(25,175,50,20,"Play 7",false,gui.window), } for id, element in ipairs(gui.musicButtons) do addEventHandler("onClientGUIClick", element, guiMusicChange, false ) end addEventHandler ( "onClientGUIClick", gui.close, closeDJWindow, false ) guiWindowSetSizable(gui.window,false) guiSetVisible(gui.window, false) end ) function showDJWindow( ) guiSetVisible ( gui.window, true ) showCursor ( true ) end addEvent( "showWindow", true ) addEventHandler( "showWindow", root, showDJWindow ) function closeDJWindow() guiSetVisible ( gui.window, false) showCursor(false) end function guiMusicChange(button, state) if state == "up" then for id, element in ipairs(gui.musicButtons) do if source == element then triggerServerEvent("onMusicChange", localPlayer, guiGetText(source) == "STOP" and 0 or id) guiSetText(source, guiGetText(source) == "STOP" and "Play "..id or "STOP") elseif guiGetText(element) == "STOP" then guiSetText(element, "Play "..id) end end end end function musicChange(id) stopMusic() if musicFiles[id] then for i, data in ipairs(soundData) do local x, y, z, distance, volume = unpack(data) local sound = playSound3D(musicFiles[id], x, y, z, false) setSoundMaxDistance(sound, distance) setSoundVolume(sound, volume) table.insert(nowPlaying, sound) end end end addEvent( "onClientMusicChange", true ) addEventHandler( "onClientMusicChange", root, musicChange ) function stopMusic() for i, sound in ipairs(nowPlaying) do if isElement(sound) then destroyElement(sound) end end nowPlaying = {} end
  12. getCursorPosition() highlight is still broken: getCursorPosition" class="kw4">getCursorPosition()
  13. Aibo

    Help

    whatever the rendering mode is, dx stuff is "click-through".
  14. Aibo

    Help

    simplest way to provide click (and other) events for dx stuff is to create underlying gui-element with the same size/position and 0 opacity, and catch the events from it. other (proper?) way is screen click detection, but you'll have to script everything yourself. basically in onClick event you check if the coordinates of the click are within the bounding box of your dxDraw. which is what you're doing here (as it seems, though i dont know what endY is).
  15. you need to place a vehicle pointer to vehicle variable function sendMessage2( messageclean, messageType) local message = string.lower(messageclean) local x, y, z = getElementPosition ( source ) if (string.find(message, "a ") and string.find(message, "infernus")) then outputChatBox("Your car has spawned, enjoy!", source, 0, 255, 0) local vehicle = createVehicle ( 411, x, y+5, z + 10 ) warpPedIntoVehicle ( source, vehicle ) end end addEventHandler("onPlayerChat",root,sendMessage2)
  16. Aibo

    GUI Table

    your syntax is wrong. you already placing your elements into a table called gui. in table syntax its: { key = value } and gui['blabla'] is not a valid table key. and Solidsnake14 forgot to edit parent element that is still gui['panel']
  17. Aibo

    GUI Table

    for key, element in pairs(gui) do guiSetVisible(element, true) end
  18. Aibo

    Website designing

    what do you mean by "those comments"? or you're one of those guys that think they should always get only positive response? your own site looks like a template, nothing works on it, with anchors instead of links, bad english and nonexisting "works". i wouldn't even care or say anything, if you weren't trying to sell your services here in almost every comment you post.
  19. 1. proper indentation helps (see line 38): addEventHandler("onPlayerShowWindow", getRootElement() , function ( source ) local country = call(getResourceFromName("admin"), "getPlayerCountry", source) local account = getPlayerAccount( source ) local askdname = getPlayerName( source ) local ip = getPlayerIP ( source ) or NAN local serial = getPlayerSerial ( source ) or NAN if isGuestAccount( account ) then outputChatBox( "#FFA824*You aren't logged in!", thePlayer, 255, 12, 15, true) setElementData ( source, "Ratio" , NAN ) setElementData ( source, "Race Wins" , NAN ) setElementData ( source, "Race Loses" , NAN ) setElementData ( source, "Country" , country ) setElementData ( source, "Points" , NAN ) setElementData ( source, "Money" , NAN ) setElementData ( source, "IP" , ip ) setElementData ( source, "Serial" , serial ) triggerClientEvent("setText", getLocalPlayer() , source ) else local wins = getAccountData( account, "Race Wins" ) or 0 local money = getAccountData( account, "Money" ) or 0 local points = getAccountData( account, "Points" ) or 0 local loses = getAccountData( account, "Race Loses" ) or 0 local ratio = math.max( 0, math.min( 100, math.floor( wins / ( loses + wins ) * 100 ) ) ) if tostring( ratio ):find '-nan' then ratio = 0 elseif tostring( ratio ):find 'inf' then ratio = 0 end setElementData ( source, "Ratio" , ratio ) setElementData ( source, "Race Wins" , wins ) setElementData ( source, "Race Loses" , loses ) setElementData ( source, "Country" , country ) setElementData ( source, "Points" , points ) setElementData ( source, "Money" , money ) triggerServerEvent("setText", getLocalPlayer() , source ) end -- missing end ) addEvent("onPlayerShowWindow", true) also, getLocalPlayer() serverside? really? 2. variable names cannot start with a number.
  20. и зачем тогда x,y,z которые передавались в эту функцию через эвент "rob_set_location"? и да, http://pgl.yoyo.org/luai/i/unpack но многоуважаемый автор, опять же, посчитал это тоже непонятным бредом. короче пошел я из этого топика.
  21. там и был исправленный код с описанием. просто тебе тупо насрать, это же "ерунда через --". пример: как минимум 2 РАЗА было сказано, что "tostring(z)-1" — бред, tostring() там не нужен. что изменилось? НИЧЕГО. или тебе непонятно, что tostring — это конвертирование в строку? и что вычитание числа из строки работать не будет?
  22. я уже всё объяснил. если для вас, мсье, это "ерунда через --" — я умываю руки. с таким отношением вам мануал по луа на шею, вики в зубы, и вперёд.
  23. server createTeam( 'DJ',0,0,255 ) local djmarker = createMarker( 781.4, -1360.2, 13.2, 'cylinder', 3, 0, 0, 255, 100 ) function DJMarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == 'player' then local uTeam = getPlayerTeam( hitElement ) if uTeam then if getTeamName( uTeam ) == 'DJ' then triggerClientEvent ( source, "showWindow", root ) else outputChatBox ( "You are #FF0000NOT a #0000FFDJ#FFFFFF!", hitElement, 255, 255, 255, true ) end else outputChatBox ( "You are not in a team!", hitElement, 255, 255, 255, true ) end end end addEventHandler( "onMarkerHit", djmarker, DJMarkerHit ) client function showDJWindow() guiSetVisible (window,true) showCursor (true) end addEvent( "showWindow", true ) addEventHandler( "showWindow", root, showDJWindow)
×
×
  • Create New...