Jump to content

Aibo

Retired Staff
  • Posts

    1,105
  • Joined

  • Last visited

Everything posted by Aibo

  1. Aibo

    PUSH

    message is shown only to the player you push.
  2. nope, because right now id's are values, not keys, like notAllowed[1] = 509. local notAllowed = { [509] = true, [481] = true } -- etc if notAllowed[getElementModel(hitElement)] then outputChatBox ( "That vehicle is not allowed!" ) end
  3. Aibo

    HEX to RGB

    tocolor() does not return hex color value as i recall. it's decimal with alpha.
  4. Aibo

    HEX to RGB

    eh function rgb2hex(r,g,b) return string.format("#%02X%02X%02X", r,g,b) end
  5. Aibo

    HEX to RGB

    function hex2rgb(hex) hex = hex:gsub("#","") return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6)) end EDIT: https://wiki.multitheftauto.com/wiki/GetColorFromString
  6. приаттачить машину к трейлеру, а самому трейлеру setElementAlpha на 0 ой, «простыми тачками».
  7. ну и откуда ты знаешь, что именно нужный блип в этой переменной? с 1 блипом это работает без глюков. больше 1-го — начинается путаница и bad argument. может я тупой, но мне не нравится эта система, когда функция вложена в другую функцию, зависит от ее переменных, а вызывается внешним эвентом. если вынести onStreamOut() отдельно, а блипы сохранять, допустим, в element data машины — все нормально удаляется и никаких ошибок.
  8. remove this, Lua is dynamically typed: string message, int messageType P.S. your function will create these variables local to itself anyway.
  9. у тебя blip — локальная переменная, и указатель на сам блип нигде не сохраняется после завершения работы функции. ну мне так каатса.
  10. add this function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end return t end to your script
  11. well findRotation is not a built-in MTA function, you need to add it to your script to use it.
  12. well that part has nothing to do with peds() function. it cant be the full code, since peds() function is never called in this code, so you cant possibly have those errors shown.
  13. Aibo

    Race mod

    you dont know what you're doing. you need to have quite good understanding of lua and programming in general to edit race resource. you can try replacing the function that is called with playSound and sound id argument with your file, but it will probably work only if playSoundFrontEnd is called clientside.
  14. both your errors are caused by invalid source variable. (and why are you using source AND player variable?) where is the code that calls this function?
  15. Aibo

    Script problem

    if you are so sure that it "should output something different", check the code where "curgang" element data is set.
  16. Aibo

    Race mod

    playSound is a client function.
  17. Aibo

    Race mod

    race resource uses playSoundFrontEnd sounds 44 and 45 for countdown.
  18. offtopic deleted, please use appropriate language section for such conversations.
  19. Aibo

    setobjectrotation

    setElementRotation does not do any animation or anything. use moveObject with rotation parameters.
  20. who said you can't? http://luabinaries.sourceforge.net/download.html — compiles just fine.
  21. Aibo

    bet system

    -- first you create a table to hold your bet info: bets = {} function onPlaceBet (playerSource, cmd, guy, amount) guy = getPlayerFromID(guy) amount = tonumber(amount) if (guy and amount) and amount > 0 then -- check so players wont bet negative amounts local points = tonumber(getElementData(playerSource, "Points")) if points < amount then outputChatBox("#00FF00<#9370DBServer#00FF00>#ff0000: #9ACD32Not enough Points!", playerSource, 255,255,255, true) else --ADD THE BET bets[playerSource] = {guy, amount} setElementData(playerSource, "Points", points - amount) -- accept the bet and take the points outputChatBox("#00FF00<#9370DBServer#00FF00>#ff0000: #9ACD32"..getPlayerName(playerSource).." #9ACD32Placed a bet on "..getPlayerName(guy).."#9ACD32!", getRootElement(), 255,255,255, true) end else outputChatBox("#00FF00<#9370DBServer#00FF00>#ff0000: #9ACD32Syntax: /bet [playerID] [betAmount]", playerSource, 255,255,255, true) end end addEvent("onRaceStateChanging") function removeCmd () outputChatBox("#00FF00<#9370DBServer#00FF00>#ff0000: #9ACD32Bets Closed!", getRootElement(), 255,255,255, true) removeCommandHandler("bet", onPlaceBet) end addEventHandler("onRaceStateChanging", getRootElement(), removeCmd) addEvent("onGamemodeMapStart") function addCmd () outputChatBox("#00FF00<#9370DBServer#00FF00>#ff0000: #9ACD32Place now your bets: /bet [thePlayer] [betAmount] ", getRootElement(), 255,255,255, true) addCommandHandler("bet", onPlaceBet) end addEventHandler("onGamemodeMapStart", getRootElement(), addCmd) function onPlayerEx (theWinner) --THAT FUNCTION IS CALLED BY WIN FUNC --GIVE POINTS TO THE BETTER for player, bet in pairs(bets) do if isElement(player) then -- check if a player still there local points = tonumber(getElementData(player, "Points")) if bet[1] == theWinner then -- check if player won the bet setElementData(player, "Points", points + bet[2]*2) -- give him 2x the points outputChatBox("#00FF00<#9370DBServer#00FF00>#ff0000: #9ACD32Your bet won: "..(bet[2]*2).." point(s) earned!", player, 255,255,255, true) end end end -- clear the bets list bets = {} end
  22. а лучше бы использовал для центровки текста в зависимости от разрешения. :Р
×
×
  • Create New...