Jump to content

Flaker

Members
  • Posts

    619
  • Joined

  • Last visited

Everything posted by Flaker

  1. Доброго времени суток всем. Как сделать проверку числа написанного в guiCreateEdit с числом которое задается через math.random (1,100)? Все мои попытки ни к чему, не привели. Основная идея: Открытие ворот по коду, который нужно угадать из 100 чисел. Вот мой код: 1)Код на показ окна с вводом пароля, а также при открытие окна, задается переменная pass (Client) function createExeWed_Windows() GUIEditor_Window[1] = guiCreateWindow(0.292,0.3359,0.4199,0.1588,"ExeWed v0.97 | Protective system",true) password = guiCreateEdit(0.314,0.3607,0.5093,0.2869,"",true,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(0.1047,0.459,0.4488,0.2957,"Password:",true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0, 255, 100) guiSetFont(GUIEditor_Label[1],"default-bold-small") btnExit = guiCreateButton(0.8581,0.7213,0.0977,0.1639,"Exit",true,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"default-bold-small") btnOK = guiCreateButton(0.8558,0.377,0.1047,0.2541,"OK",true,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[2],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(0.4581,0.7377,0.3605,0.1475,"Access Denied",true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,0,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") showCursor(true) guiSetInputEnabled(true) pass = math.random(1,100) end 2) При нажатии на кнопку OK, сравнение числа в Edit поле, с заданым числом pass, если совпадает то написать в чате Access Accepted, если не совпадает, то ничего не делать. function use_ExeWed() password = guiGetText(password) if source == btnExit then DestroyExeWedGUI() end if (source == btnOK) then outputChatBox("Введи: ".. tostring(pass) .."",thePlayer,255,120,0) if (password == pass) then outputChatBox("Access Accepted") end end end addEventHandler("onClientGUIClick",getRootElement(),use_ExeWed)
  2. Спасибо большое,Kenix) Все ошибки рассмотрел. Там правда проблемы теперь с положением картинки над игроком, но это сам попробую исправить. Главное картинку показывает! MacTrekkie, вобще только для админа, причем что бы ты свою картинку не видел (если играешь за админа), а только других админов. Но для того что бы для админа сделать, мне хотя бы основа нужна была.
  3. Вот так вот верно? addEventHandler("onClientRender",getRootElement(), function() local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix() for k, v in ipairs(getElementsByType("player")) do tx, ty, tz = getElementPosition(v) dist = math.sqrt((px - tx) ^ 2 + (py - ty) ^ 2 + (pz - tz) ^ 2) if dist < 30.0 then if isLineOfSightClear(px, py, pz, tx, ty, tz, true, false, false, true, false, false, getLocalPlayer()) then local sx, sy, sz = getPedBonePosition(v, 5) local x,y = getScreenFromWorldPosition(sx, sy, sz + 0.3) if x then -- getScreenFromWorldPosition returns false if the point isn't on screen dxDrawImage ( x, y, x, y, 'admintag.png', angle, 0, -120 ) end end end end end ) P.S. Не могу проверить, так как все друзья спят, и некому посмотреть, есть ли иконка или нет(
  4. Вот вобщем-то: GUIEditor_Progress = {} GUIEditor_Progress[1] = guiCreateProgressBar(0.0127,0.4193,0.1719,0.0417,true) guiSetAlpha(GUIEditor_Progress[1],1) percent1 = 1 function move_progressbar () function chech_move () percent1 = percent1 + 1 guiProgressBarSetProgress(GUIEditor_Progress[1],percent1) end setTimer(chech_move,200,100) end addCommandHandler ( "12", move_progressbar )
  5. Если не сложно, выложи примерчик какой нибудь. Просто пытался уже, не совсем получаеться(
  6. Подскажите как сделать что-бы над игроком, если ты рядом с ним, отображалась иконка?
  7. Доброго времени суток. Подскажите пожалуста как сделать проверку прогресса, прогресс-бара? То есть если guiProgressBarSetProgress = 1 то увеличивать прогресс, но как только становиться равным 100, переходить к другому действию?
  8. Основная идея скрипта: Окно выбора команды, при клике на кнопку Admin проверка на ACLgroup, и если игрок в группе Admin то респавнить его в команду админ. При клик на кнопку не происходит вобще ничего(. В чем ошибка подскажите. Скрипт кнопки (Client): function chooseSpecGroup(thePlayer) if source == btnAdmins then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then outputChatBox ("You spawned as Admin",225,225,0) triggerServerEvent("SpawnAdmins", getRootElement()) else outputChatBox ("You cant spawn as Admin",225,225,0) end end end addEventHandler("onClientGUIClick",getRootElement(),chooseSpecGroup) Скрипт тригерра SpawnAdmins (Server): function SpawnAsAdmin() Admins = createTeam ("Admins", 255, 255, 255) spawnPlayer(client, 221, 1827, 7, 0, 241, 0, 0, Admins ) fadeCamera(client, true) setCameraTarget(client, client) outputChatBox("Welcome to My Server.", client) end addEvent("SpawnAdmins",true) addEventHandler("SpawnAdmins",root,SpawnAsAdmin)
  9. Собственно, весь вопрос в названии топика. Идея поточнее: Допустим я вхожу в какой-то маркер, и при входе в него у меня включаеться новый ресурс (Который до этого был выключен). Вот как это реализовать?
  10. У меня никак не получаеться сделать что-бы GUI окно открывалось при заходе игрока на сервер (Открывалось только для зашедшего) Вот примерно что я попытался написать: Первый вариант(через Client скрипт): function openWDW() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Window[1] = guiCreateWindow(0.0313,0.5352,0.2314,0.4362,"Special groups spawn Menu",true) btnAdmins = guiCreateButton(0.2025,0.0836,0.5738,0.0836,"Admins",true,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"default-bold-small") btnRangers = guiCreateButton(0.2025,0.2179,0.5738,0.0836,"Rangers",true,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[2],"default-bold-small") guiSetVisible(GUIEditor_Window[1], true) wdwWarning = guiCreateWindow(0.376,0.2474,0.3379,0.3476,"WARNING",true) memoWarning = guiCreateMemo(0.0289,0.0864,0.9393,0.8642,"You cant spawn as this group!",true,wdwWarning) guiMemoSetReadOnly(memoWarning,true) btnOK = guiCreateButton(0.4133,0.8764,0.1532,0.0899,"OK",true,wdwWarning) guiSetVisible(wdwWarning, false) end addEventHandler("onClientPlayerJoin", getRootElement(), openWDW) Второй вариант (через Server script): function openstupidWindow() triggerServerEvent ("openWDW",getRootElement())) end addEventHandler("onPlayerJoin",getRootElement(),openstupidWindow)
  11. А можешь написать пример скрипта, где будет условие если допустим выбран Colum 1 и Row 1 то написать в чат что-то... Просто я не смог разобраться как условие сделать с guiGridListGetSelectedItem, и проверку что выбрано.
  12. У меня есть система save'a денег и оружия, которая сохраняет все по аккаунту. Я сделал на сервере режим игры без регистрации (Guest). При таком режиме все кто заходят за Guests получают деньги и оружия сохраненные предшественниками. Как сделать проверку залогинился ли игрок или нет. Если залогинился то сохранять данные. Скрипт save системы: function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local x,y,z = getElementPosition (source) setAccountData ( playeraccount, "s.HandMoney", getPlayerMoney ( source ) ) setAccountData (playeraccount, "s.weap0", getPedWeapon ( source, 0 )) setAccountData (playeraccount, "s.weap1", getPedWeapon ( source, 1 )) setAccountData (playeraccount, "s.weap2", getPedWeapon ( source, 2 )) setAccountData (playeraccount, "s.ammo2", getPedTotalAmmo ( source, 2 )) setAccountData (playeraccount, "s.weap3", getPedWeapon ( source, 3 )) setAccountData (playeraccount, "s.ammo3", getPedTotalAmmo ( source, 3 )) setAccountData (playeraccount, "s.weap4", getPedWeapon ( source, 4 )) setAccountData (playeraccount, "s.ammo4", getPedTotalAmmo ( source, 4 )) setAccountData (playeraccount, "s.weap5", getPedWeapon ( source, 5 )) setAccountData (playeraccount, "s.ammo5", getPedTotalAmmo ( source, 5 )) setAccountData (playeraccount, "s.weap6", getPedWeapon ( source, 6 )) setAccountData (playeraccount, "s.ammo6", getPedTotalAmmo ( source, 6 )) setAccountData (playeraccount, "s.weap7", getPedWeapon ( source, 7 )) setAccountData (playeraccount, "s.ammo7", getPedTotalAmmo ( source, 7 )) setAccountData (playeraccount, "s.weap8", getPedWeapon ( source, 8 )) setAccountData (playeraccount, "s.ammo8", getPedTotalAmmo ( source, 8 )) setAccountData (playeraccount, "s.weap9", getPedWeapon ( source, 9 )) setAccountData (playeraccount, "s.ammo9", getPedTotalAmmo ( source, 9 )) setAccountData (playeraccount, "s.weap10", getPedWeapon ( source, 10 )) setAccountData (playeraccount, "s.weap11", getPedWeapon ( source, 11 )) setAccountData (playeraccount, "s.weap12", getPedWeapon ( source, 12 )) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) function onPlayerWasted ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local x,y,z = getElementPosition (source) setAccountData ( playeraccount, "s.HandMoney", getPlayerMoney ( source ) ) setAccountData (playeraccount, "s.weap0", getPedWeapon ( source, 0 )) setAccountData (playeraccount, "s.weap1", getPedWeapon ( source, 1 )) setAccountData (playeraccount, "s.weap2", getPedWeapon ( source, 2 )) setAccountData (playeraccount, "s.ammo2", getPedTotalAmmo ( source, 2 )) setAccountData (playeraccount, "s.weap3", getPedWeapon ( source, 3 )) setAccountData (playeraccount, "s.ammo3", getPedTotalAmmo ( source, 3 )) setAccountData (playeraccount, "s.weap4", getPedWeapon ( source, 4 )) setAccountData (playeraccount, "s.ammo4", getPedTotalAmmo ( source, 4 )) setAccountData (playeraccount, "s.weap5", getPedWeapon ( source, 5 )) setAccountData (playeraccount, "s.ammo5", getPedTotalAmmo ( source, 5 )) setAccountData (playeraccount, "s.weap6", getPedWeapon ( source, 6 )) setAccountData (playeraccount, "s.ammo6", getPedTotalAmmo ( source, 6 )) setAccountData (playeraccount, "s.weap7", getPedWeapon ( source, 7 )) setAccountData (playeraccount, "s.ammo7", getPedTotalAmmo ( source, 7 )) setAccountData (playeraccount, "s.weap8", getPedWeapon ( source, 8 )) setAccountData (playeraccount, "s.ammo8", getPedTotalAmmo ( source, 8 )) setAccountData (playeraccount, "s.weap9", getPedWeapon ( source, 9 )) setAccountData (playeraccount, "s.ammo9", getPedTotalAmmo ( source, 9 )) setAccountData (playeraccount, "s.weap10", getPedWeapon ( source, 10 )) setAccountData (playeraccount, "s.weap11", getPedWeapon ( source, 11 )) setAccountData (playeraccount, "s.weap12", getPedWeapon ( source, 12 )) end end addEventHandler ( "onPlayerWasted", getRootElement ( ), onPlayerWasted ) local root = getRootElement() addEventHandler("onPlayerSpawn", root, function() local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playermoney = getAccountData ( playeraccount, "s.HandMoney" ) if ( playermoney ) then setPlayerMoney ( source, playermoney ) end local weap0 = getAccountData(playeraccount, "s.weap0") local weap1 = getAccountData(playeraccount, "s.weap1") local weap2 = getAccountData(playeraccount, "s.weap2") local ammo2 = getAccountData(playeraccount, "s.ammo2") local weap3 = getAccountData(playeraccount, "s.weap3") local ammo3 = getAccountData(playeraccount, "s.ammo3") local weap4 = getAccountData(playeraccount, "s.weap4") local ammo4 = getAccountData(playeraccount, "s.ammo4") local weap5 = getAccountData(playeraccount, "s.weap5") local ammo5 = getAccountData(playeraccount, "s.ammo5") local weap6 = getAccountData(playeraccount, "s.weap6") local ammo6 = getAccountData(playeraccount, "s.ammo6") local weap7 = getAccountData(playeraccount, "s.weap7") local ammo7 = getAccountData(playeraccount, "s.ammo7") local weap8 = getAccountData(playeraccount, "s.weap8") local ammo8 = getAccountData(playeraccount, "s.ammo8") local weap9 = getAccountData(playeraccount, "s.weap9") local ammo9 = getAccountData(playeraccount, "s.ammo9") local weap10 = getAccountData(playeraccount, "s.weap10") local weap11 = getAccountData(playeraccount, "s.weap11") local weap12 = getAccountData(playeraccount, "s.weap12") giveWeapon ( source, weap0, 1 ) giveWeapon ( source, weap1, 1 ) giveWeapon ( source, weap2, ammo2 ) giveWeapon ( source, weap3, ammo3 ) giveWeapon ( source, weap4, ammo4 ) giveWeapon ( source, weap5, ammo5 ) giveWeapon ( source, weap6, ammo6 ) giveWeapon ( source, weap7, ammo7 ) giveWeapon ( source, weap8, ammo8 ) giveWeapon ( source, weap9, ammo9 ) giveWeapon ( source, weap10, 1 ) giveWeapon ( source, weap11, 1 ) giveWeapon ( source, weap12, 1 ) end end ) P.S. По идеи "if ( playeraccount ) then" должна проверять наличие аккаунта, но както не очень работает(( Скрипт нажатия кнопки играть за Guest (На всякий случай): -- Guest mode function onClickGuest(button,state) if(button == "left" and state == "up") then if (source == btnPlayAsGuest) then guiSetVisible(GUIEditor_Window[1], false) guiSetInputEnabled(false) showCursor(false) outputChatBox("#0000FF* #FFFFFFYou've chosen to play as a #ABCDEFGUEST#FFFFFF!",255,255,255,true) triggerServerEvent("onRequestGuest",getLocalPlayer(), "Guest mode") if blackLoginScreen == true then fadeCamera(true,removeBlackScreenTime) end end end end
  13. Как сделать что-бы информация выводилась на экран не через outputChatBox. Например вот так: Причем, через секунд 10 этот текст задвигаеться в верх экрана)
  14. Знающие люди, обращаюсь к вам с просьбой, объясните мне как работать с Gridlist'ом. Вот допустим, как сделать что-бы при выборе определенного пункта в gridlist'e у вас изменялось memo. Вот примерно так. Если есть какое-то описание в wiki, скиньте пожалуста.
  15. Как сделать телепорт в другой интерьер и Demension setElementInterior ( thePlayer, 0, 227, 1932, 18 ) setElementPosition ( thePlayer, 227, 1932, 18 ) Про интерьер знаю... А как при этом чтобы изменился demension?
  16. Спасибо большое) Поставил, все заработало как надо)
  17. Еще одна заминочка( Я попробовал перенести takePlayerMoney примерно вот так: function giveDgl (thePlayer) giveWeapon ( source, 24, 100 ) takePlayerMoney ( thePlayer, 300) end addEvent ("giveDgl",true) addEventHandler ("giveDgl",getRootElement(),giveDgl) Но натолкнулся на такую проблемму: При нажатии кнопки "покупка" деньги не снимаються, а в консоли выдает такую ошибку: Поправимо?
  18. Я выложил скрипты магазина... Незнаю что еще можно выложить.
  19. На сервере!Могу код магазина выложить или еще что то. Я просто даже не представляю как это справить((
  20. Доброго времени суток. У меня возникла проблемма с созданием объекта на карте через скрипт. Вобщем, я создаю на карте объект(ворота) с условием onResourceStart, они создаються. Но при запуске другого ресурса они содаються опять, и не открываються(( Скрипт ворот: function mapLoad ( name ) -- create an object at a specified position with a specified rotation vorota1 = createObject ( 2927, 215.878, 1875.722, 13.93899, 0, 0, 0 ) vorota1_2 = createObject ( 2927, 211.7866, 1875.726, 13.93899, 0, 0, 0 ) vorotaCLO = createObject ( 980, 1067.722, 1358.1202, 12.456, 0, 0, 0 ) end addEventHandler ( "onResourceStart", getRootElement(), mapLoad ) Как сделать что-бы они создавались только 1 раз.
  21. Довольно сложная проблемма (imho). (Zombie server) Суть: 1.Убил зомби > 2.получил 15$ > 3.Накопил 200$ > 4.Пошел в магаз, купил пушку потратил 200$ > 5.Убил зомби > 6.Получил 15$ Проблемма: В 6 пункте, вместо 15 баксов я получаю "кол-во накопленных денег до покупки оружия в магазине" + 15$. Тоесть было у меня 200$, я пошел купил оружие за 200$, затем убил 1 зомби, у меня стало 215$ Скрипты: Скрипт получения денег за убйство 1 зомби: addEvent("onZombieWasted",true) addEventHandler("onZombieWasted",getRootElement(), function (killer) givePlayerMoney(killer,15) end) ______________________ UPDATED*: Серверный скрипт магазина: function shop() weapons_shop1 = createMarker(242,1862,13.1,"cylinder",1.2, 125, 200, 211, 150 ) createBlipAttachedTo ( weapons_shop1, 6 ) weapons_shop2 = createMarker(1059,1269,9.8,"cylinder",1.2, 125, 200, 211, 150 ) createBlipAttachedTo ( weapons_shop2, 6 ) end addEventHandler ("onResourceStart",root,shop) function open_weps_menu(hitElement) if (source == weapons_shop1) or (source == weapons_shop2) then triggerClientEvent (hitElement,"open_weps_shop",getRootElement()) end end addEventHandler ("onMarkerHit",getRootElement(),open_weps_menu) function giveAK () giveWeapon ( source, 30, 80 ) end addEvent ("giveAK",true) addEventHandler ("giveAK",getRootElement(),giveAK) function giveM4 () giveWeapon ( source, 31, 80 ) end addEvent ("giveM4",true) addEventHandler ("giveM4",getRootElement(),giveM4) function giveDgl () giveWeapon ( source, 24, 100 ) end addEvent ("giveDgl",true) addEventHandler ("giveDgl",getRootElement(),giveDgl) function givePistol () giveWeapon ( source, 22, 120 ) end addEvent ("givePistol",true) addEventHandler ("givePistol",getRootElement(),givePistol) function giveSclienced () giveWeapon ( source, 23, 90 ) end addEvent ("giveSclienced",true) addEventHandler ("giveSclienced",getRootElement(),giveSclienced) function giveUzi () giveWeapon ( source, 28, 90 ) end addEvent ("giveUzi",true) addEventHandler ("giveUzi",getRootElement(),giveUzi) Клиентский скрипт магазина: function open_weps_shop() wdwWeaponsShop = guiCreateWindow(0.3106,0.2787,0.376,0.4506,"Weapon Shop",true) btnM4 = guiCreateButton(0.0286,0.3121,0.2494,0.104,"M4 $500",true,wdwWeaponsShop) btnAK = guiCreateButton(0.3636,0.3121,0.2494,0.104,"AK47 $500",true,wdwWeaponsShop) btnDgl = guiCreateButton(0.7117,0.3121,0.2494,0.104,"Deagle $300",true,wdwWeaponsShop) guiCreateStaticImage(0.0649,0.4711,0.161,0.1879,"images/pistol.png",true,wdwWeaponsShop) btnPistol = guiCreateButton(0.0286,0.6792,0.2494,0.104,"Pistol $150",true,wdwWeaponsShop) guiCreateStaticImage(0.4052,0.4769,0.1532,0.185,"images/silenced.png",true,wdwWeaponsShop) btnSclienced = guiCreateButton(0.361,0.6792,0.2494,0.104,"Sclienced $200",true,wdwWeaponsShop) guiCreateStaticImage(0.7636,0.4769,0.1532,0.185,"images/uzi.png",true,wdwWeaponsShop) btnUzi = guiCreateButton(0.7091,0.6792,0.2494,0.104,"UZI $350",true,wdwWeaponsShop) btnExit = guiCreateButton(0.3844,0.8382,0.2052,0.1098,"Exit",true,wdwWeaponsShop) guiSetFont(btnExit,"default-bold-small") guiCreateStaticImage(0.0675,0.1069,0.161,0.185,"images/M4.png",true,wdwWeaponsShop) guiCreateStaticImage(0.413,0.1069,0.1481,0.185,"images/AK-47.png",true,wdwWeaponsShop) guiCreateStaticImage(0.761,0.1012,0.1481,0.1792,"images/deagle.png",true,wdwWeaponsShop) showCursor (true) end addEvent ("open_weps_shop",true) addEventHandler ("open_weps_shop",getResourceRootElement(getThisResource()),open_weps_shop) function planeDestroyPlaneGUI() destroyElement(wdwWeaponsShop) wdwWeaponsShop = false showCursor (false) end function buy() money = getPlayerMoney (source) if source == btnAK and (money >= 500) then triggerServerEvent ("giveAK",getLocalPlayer()) takePlayerMoney(500) outputChatBox ("You bought a AKA $500",225,225,0) elseif source == btnAK and (money < 500) then outputChatBox ("You haven't money",225,225,0) end if source == btnM4 and (money >= 500) then triggerServerEvent ("giveM4",getLocalPlayer()) takePlayerMoney(500) outputChatBox ("You bought a M4 $500",225,225,0) elseif source == btnM4 and (money < 500) then outputChatBox ("You haven't money",225,225,0) end if source == btnDgl and (money >= 300) then triggerServerEvent ("giveDgl",getLocalPlayer()) takePlayerMoney(300) outputChatBox ("You bought a Deagle $300",225,225,0) elseif source == btnDgl and (money < 300) then outputChatBox ("You haven't money",225,225,0) end if source == btnPistol and (money >= 150) then triggerServerEvent ("givePistol",getLocalPlayer()) takePlayerMoney(150) outputChatBox ("You bought a Pistol $150",225,225,0) elseif source == btnPistol and (money < 150) then outputChatBox ("You haven't money",225,225,0) end if source == btnSclienced and (money >= 200) then triggerServerEvent ("giveSclienced",getLocalPlayer()) takePlayerMoney(200) outputChatBox ("You bought a Sclienced $200",225,225,0) elseif source == btnSclienced and (money < 200) then outputChatBox ("You haven't money",225,225,0) end if source == btnUzi and (money >= 350) then triggerServerEvent ("giveUzi",getLocalPlayer()) takePlayerMoney(350) outputChatBox ("You bought a Uzi $350",225,225,0) elseif source == btnUzi and (money < 350) then outputChatBox ("You haven't money",225,225,0) end if source == btnExit then destroyElement(wdwWeaponsShop) wdwWeaponsShop = false showCursor (false) end end addEventHandler("onClientGUIClick",getRootElement(),buy)
  22. Спасибо) Все получилось. Я не дочитал WIKI на Английском, а на русском вобще про это не было(
  23. Я менял потом: Как у меня щас: Meta.xml: <file src="tex/287.txd" /> <file src="tex/287.dff" /> cl.lua: function clientsetup() local txd = engineLoadTXD ( "tex/287.txd") engineImportTXD ( txd, 287 ) local dff = engineLoadDFF ( "tex/287.dff", 0 ) engineReplaceModel ( dff, 287 ) end addEventHandler("onClientResourceStart", resourceRoot, clientsetup)
  24. Эхх... Вощем не получется ниче(
×
×
  • Create New...