Jump to content

Flaker

Members
  • Posts

    619
  • Joined

  • Last visited

Everything posted by Flaker

  1. Попробуй https://wiki.multitheftauto.com/wiki/AttachElements
  2. Если используешь ресурс Slothman'а, тогда эвент "onZombieWasted", и функция "givePlayerMoney" https://wiki.multitheftauto.com/wiki/GivePlayerMoney
  3. Подскажите, как определить тип Race мода. (DM, DD, FUN) Допустим, как сделать проверку в скрипте, на тип запущенного в данный момент Race мода. Что то типо этого: if racetype = "DM" then
  4. [url=https://wiki.multitheftauto.com/wiki/SetVehicleDoorOpenRatio]https://wiki.multitheftauto.com/wiki/Set ... rOpenRatio[/url] door 0 это капот
  5. Суть: Нужно из ника игрока вырезать тэг который обрамлен таким символом "|". Вот, я написал код, который вырезает тэг, но он вырезает из всего ника, как ограничить, кол-во вырезаний? Ну тоесть, что бы вырезал 1 раз в начале ника, а потом уже не трогал ничего. local thePlayerName = "|TAG|Flaker" local d = thePlayerName:gsub('(|[^|]*|)', "") print(d) Вроде нужно использовать квантификатор, но я к сожалению понять не могу как работать с квантификаторами вобщем.
  6. На вики написано, что в гранатах всего 1 клип. Я думаю, что тебе нужно получить кол-во патронов у оружия. https://wiki.multitheftauto.com/wiki/Weapon В данном случае юзай это getPedTotalAmmo Ахх, вот оно что, я был искренне уверен, что проблема в том, что я не знаю как получить значение ключа таблицы) В очередной раз, Спасибо огромное за помощь)
  7. Не не не, про ElementData я знаю, но в данном случае мне нужно использовать именно таблицу.
  8. Цель: Получить кол-во патрон в определенном оружии (Гранатах), далее записать в таблицу в таком виде: Grenades[source] = int AMMO Затем получить из таблицы значение AMMO, определенного игрока (thePlayer). У меня постоянно получает 1 (хотя было 90), как исправить? Вот мой код: (SERVERSIDE) local Grenades = {} function setGrenadesAmmo (thePlayer) --Запись в таблицу local thePlayerHeAmmo = tonumber(getPedAmmoInClip ( thePlayer, getSlotFromWeapon ( 16 ))) if thePlayerHeAmmo > 0 then Grenades[thePlayer] = tonumber( thePlayerHeAmmo - 1 ) takeWeapon ( thePlayer, 16 ) end end function getGrenadesAmmo (thePlayer) --Получение значения из таблицы local thePlayerHeAmmoGive = tonumber( Grenades[thePlayer] ) giveWeapon ( thePlayer, 16, thePlayerHeAmmoGive, false ) outputChatBox ( "U got "..thePlayerHeAmmoGive.." grenades", thePlayer, 255, 0, 0, true ) end
  9. Можно сделать просто дальность видимости блипов над NPC небольшую. Что то вроде World Of Warcraft. Там на главной мапе тоже блипы не видны, а когда близко проходишь около NPC, у которых задание можно взять, то появляются.
  10. Ахах оно и есть походу! Я неделю назад на экзамене писал ее Вот немного о переводе: http://vestikinc.narod.ru/AB/bin_dec_tr.htm
  11. Yes, it call onUnban https://wiki.multitheftauto.com/wiki/OnUnban
  12. Flaker

    I am new

    https://forum.multitheftauto.com/viewtopic.php?f=148&t=40809 In the wiki a lot of useful information, I advise you to read and memorize as much as possible from the wiki.
  13. No problem) And you are welcome)
  14. Try this: function addTextInFild (Number) local zwText = guiGetText(zwischeneingabe) if (zwText == "") then guiSetText (eingabe1,""..guiGetText ( eingabe1 )..""..Number.."") outputDebugString("eingabe1") else guiSetText (eingabe2,""..guiGetText ( eingabe2 )..""..Number.."") outputDebugString("eingabe2") end end U gave me full code? (There are more buttons on screenshot, than at ur code)
  15. Also, the table can be created without indexes. (In this case, the indexes will be 1,2,3,4 etc...) local table = {"One", "Two"}
  16. Try this: local x,y = guiGetScreenSize() rechner_Window = guiCreateWindow(x/10.0 - 110,y/2.5 - 165,220,330,"",false) c1 = guiCreateButton(0.1636,0.3333,0.1455,0.0939,"1",true,rechner_Window) cPlus = guiCreateButton(0.6909,0.3333,0.1455,0.0939,"+",true,rechner_Window) cMinus = guiCreateButton(0.6909,0.4455,0.1455,0.0939,"-",true,rechner_Window) cMal = guiCreateButton(0.6909,0.5606,0.1455,0.0939,"x",true,rechner_Window) cRefresh = guiCreateButton(0.3364,0.6758,0.1455,0.0939,"C",true,rechner_Window) cDurch = guiCreateButton(0.6909,0.6758,0.1455,0.0939,"/",true,rechner_Window) cGleich = guiCreateButton(0.5136,0.6758,0.1455,0.0939,"=",true,rechner_Window) eingabe1 = guiCreateEdit(0.1636,0.1182,0.2727,0.0758,"",true,rechner_Window) guiEditSetReadOnly(eingabe1,true) guiEditSetMaxLength(eingabe1,10) eingabe2 = guiCreateEdit(0.5682,0.1182,0.2727,0.0758,"",true,rechner_Window) guiEditSetMaxLength(eingabe2,10) guiEditSetReadOnly(eingabe2,true) guiEditSetMaxLength(eingabe2,10) zwischeneingabe = guiCreateEdit(0.4409,0.1182,0.1182,0.0758,"",true,rechner_Window) guiEditSetReadOnly(zwischeneingabe,true) ergebnis = guiCreateEdit(0.1636,0.203,0.6773,0.0758,"",true,rechner_Window) guiEditSetReadOnly(ergebnis,true) function rZeichen (state) if(source == cPlus) then guiSetText(zwischeneingabe,"+") elseif(source == cMinus) then guiSetText(zwischeneingabe,"-") elseif(source == cMal) then guiSetText(zwischeneingabe,"x") elseif(source == cDurch) then guiSetText(zwischeneingabe,"/") end end addEventHandler("onClientGUIClick", getRootElement(), rZeichen) function rechnerKlick (state) if (source == cRefresh) then guiSetText(eingabe1,"") guiSetText(eingabe2,"") guiSetText(zwischeneingabe,"") guiSetText(ergebnis,"") outputDebugString("Refresh") elseif (source == c1) then addTextInFild ("1") end end addEventHandler("onClientGUIClick", getRootElement(), rechnerKlick) function addTextInFild (Number) local zwText = guiGetText(zwischeneingabe) if not(zwText == "") then guiSetText (eingabe1,guiGetText ( eingabe1 )..""..Number) outputDebugString("eingabe1") else guiSetText (eingabe2,guiGetText ( eingabe2 )..""..Number) outputDebugString("eingabe2") end end
  17. Hmm... Give a screenshot of ur Calculator plz... And say me where is eingabe1 where is eingabe2 and where is zwischeneingabe on the Screenshot... (Just i haven't MTA on my computer now >< and can't test ur script )
  18. "zwischeneingabe" change only in "rZeichen" function, but this function isn't executed by pressing the "c1"! So zwischeneingabe dosn't change Try to push C1 then cPlus and then C1 And check Debug
  19. In your code, "zwischeneingabe" always is nil, because in function "number1/number2" we enter text in the "eingabe2", and "zwischeneingabe" does not change!
  20. So, i think problem is in it: local ze = guiGetText(zwischeneingabe) if ze ~= "" or ze ~= nil then What is zwischeneingabe (Edit, Memo, Or what?) It would be nice if you give full code.
  21. Try this, and check DebugString... function rechnerKlick (state) if state == "left" then if (source == cRefresh) then guiSetText(eingabe1,"") guiSetText(eingabe2,"") guiSetText(zwischeneingabe,"") guiSetText(ergebnis,"") outputDebugString("Refresh") elseif (source == c1) then outputDebugString("C1") local ze = guiGetText(zwischeneingabe) if ze ~= "" or ze ~= nil then outputDebugString("Ze nil") number1("1") else number2("1") outputDebugString("Ze not nil") end end end end addEventHandler("onClientGUIClick", getRootElement(), rechnerKlick) function number1 (number1) local text = guiGetText(eingabe1) guiSetText (eingabe1,""..text..""..number1.."") outputDebugString("Function Number1") end function number2 (number2) local text = guiGetText(eingabe2) guiSetText (eingabe2,""..text..""..number2.."") outputDebugString("Function Number2") end
  22. omg, i though problem in same btns
  23. if(source == c1) then number1("1") end else if(source == c1) then number2("1") end The same sources!
  24. So the global variable exists in another files if i create them here? Where else? If i create this one i can use x without setting the value in an other file? Just type x in the other file and it will know that is 1? Yes, but it is better to avoid it! Since global variables clog memory and slow performance! t = {a, b = 1, 4} print(t.a, t.b) It isn't possible!
×
×
  • Create New...