-
Posts
186 -
Joined
-
Last visited
-
Days Won
4
Everything posted by AngelAlpha
-
marker1 = createMarker(2094.8940429688,-838.72570800781,52.3, "corona", 1.5, 230, 251, 3, 153) function event(el) if getElementType(el) ~= "player" then return end triggerClientEvent (el,"openWindow",getRootElement(),el) end addEventHandler("onMarkerHit", resourceRoot, event)
-
addEventHandler("onClientClick", root, function(button,state) if isCardShop == true then if ( button == "left" and state == "down" ) then if isMouseInPosition(sx*.450, sy*.50, sx*.10, sy*.07) then local yourMoney = getPlayerMoney() if ( yourMoney >= 100) then --takePlayerMoney(100) triggerServerEvent ("takeMoney", resourceRoot, 100) else outputChatBox("Nincs elég pénzed",255,0,0,true) --outputChatBox("Menj be a Markerbe a vizsga elkezdéséhez") end end end end end) Change this code
-
-
maybe dxCreateScreenSource + dxDrawText
-
local connection = exports.db:getConnection() addEventHandler ("onPlayerQuit", root, function () local accName = getAccountName(getPlayerAccount(source)) local result = dbPoll(dbQuery(connection, "SELECT * FROM players WHERE account = ?", accName), -1) if #result > 0 then dbExec (connection, "INSERT INTO players (account, money) VALUES(?, ?)", accName, getPlayerMoney(source)) else dbExec (connection, "UPDATE players SET money = ? WHERE account = ?", getPlayerMoney(source), accName) end end) addEventHandler("onPlayerLogin", root, function(_, account) local accName = getAccountName(account) local result = dbPoll(dbQuery(connection, "SELECT * FROM players WHERE account = ?", accName), -1) if #result > 0 then setPlayerMoney (source, result[1]["money"] end end)
-
local sx,sy = guiGetScreenSize();--1920,1080 local relx,rely = sx/1920,sy/1080; local isCardShop = false local money = getPlayerMoney(localPlayer) local Cardlist = { [1] = {411, "Cég1", 100}, }; color = tocolor(41, 173, 21, 255) addEventHandler("onClientRender", root, function() if (isCardShop) then if isMouseInPosition(sx*.450, sy*.50, sx*.10, sy*.07) then color1 = tocolor(88, 0, 0, 50) else color1 = color end ---Rajz dxDrawRectangle(sx*.25, sy*.20, sx*.50, sy*.05, tocolor(0, 0, 0, 200))--Fejléc dxDrawRectangle(sx*.250, sy*.25, sx*.50, sy*.7, tocolor(30, 40, 50, 200))--Menű dxDrawRectangle(sx*.450, sy*.50, sx*.10, sy*.07, color1 or color)--Gomb ---Feliratok dxDrawText("Cég menű", sx*.50, sy*.090, sx*.50, sy*.36, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("Cégek:", sx*.50, sy*.20, sx*.50, sy*.36, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("Kamionos cég", sx*.50, sy*.25, sx*.50, sy*.36, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("Kamionos cég", sx*.50, sy*.70, sx*.50, sy*.36, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("50000$", sx*.50, sy*.75, sx*.50, sy*.36, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat end end ); bindKey("F5","down",function() if isCardShop == true then isCardShop = false else isCardShop = true end end) function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) ) end ----------- function OpenWindow() isCardShop = not isCardShop if removeEventHandler("onClientRender", root, Panel) then removeEventHandler("onClientRender", root, Panel) showCursor(false) else addEventHandler("onClientRender", root, Panel) showCursor(true) end end bindKey("F3", "down", OpenWindow) ---------- addEventHandler("onClientClick", root, function(button,state) if isCardShop == true then if ( button == "left" and state == "down" ) then if isMouseInPosition(sx*.450, sy*.50, sx*.10, sy*.07) then local yourMoney = getPlayerMoney() if ( yourMoney <= 100) then --takePlayerMoney(100) triggerServerEvent ("takeMoney", resourceRoot, 100) else outputChatBox("Nincs elég pénzed",255,0,0,true) --outputChatBox("Menj be a Markerbe a vizsga elkezdéséhez") end end end end end) Server-side addEvent ("takeMoney", true) addEventHandler("takeMoney", resourceRoot, function(money) takePlayerMoney(client, money) end)
-
Use vertex color in 3Ds max or Blender
-
function AttachDxToGuiElement( GUIElement , img ) if ( guiGetVisible ( GUIElement ) ) then local x, y = guiGetPosition ( GUIElement , false ) local width , Height = guiGetSize ( GUIElement , false ) dxDrawImage(x, y, width , Height ,img, 0, 0, 0,SetImagecolor or tocolor(255, 0, 0, 255), true) dxDrawText(guiGetText ( GUIElement ) or tostring '',x, y, width + x , Height + y,SetTextcolor or tocolor(55,55,55,255),1,"default-bold","center","center",false,false,true) guiBringToFront ( GUIElement ) guiSetAlpha ( GUIElement , 0) end end ------------------ event = guiCreateButton(16, 20, 250, 40, "Take", false) guiSetVisible (event, false) addEventHandler ("onClientRender", root, function () AttachDxToGuiElement( event ,'img/event.png' ) end) bindKey( "k", "down",function( ) guiSetVisible( event , not guiGetVisible( event )) showCursor( guiGetVisible( event )) end )
-
Сохраняй в аккаунт дату function startJob (pl) setAccountData (getPlayerAccount(pl), "prev:skin", getElementModel(pl)) setElementModel (pl, 0) end function stopJob (pl) local prevSkin = getAccountData(getPlayerAccount(pl), "prev:skin") if prevSkin then setElementModel (pl, prevSkin) removeAccountData(getPlayerAccount(pl), "prev:skin") end end
-
Тебе по команде надо или через Ф1 сделать админ скин и админ авто?
-
Ну открой все файлы и найди эту команду, она по идеи будет закоментирована
-
1. But how to change the camera position to view every weapon by pressing left and right arrow? setCameraMatrix + render + interpolateBetween 2. And how to make the player able to buy the selected weapon? When click left or right, save cur num weapon local curWeapon = 1 function onKey(key) if key == "arrow_left" then curWeapon = curWeapon - 1 moveCamera () elseif key == "arrow_right" then curWeapon = curWeapon + 1 moveCamera () elseif key == "enter" then buyWeapon () end end addEventHandler ("onClientKey", root, onKey) function moveCamera () --[[ setCameraMatrix() ]] end function buyWeapon () --[[ curWeapon ]] end 3. Also how to cancel the player from buying weapons, for example press 'Enter'. onClientKey + check, if window error showing then when press 'Enter' - window close, else buyWeapon
-
function Start_Id ( _, acc ) if eventName == "onPlayerLogin" then local my_id = getAccountID(acc) setElementData(source, "ID", my_id or "N/A" ) outputChatBox ( "#838B83➲ #ff0000LOGIN #838B83➲ Nick: #ff0000 ( ".. getPlayerName(source) .." #ff0000) ID: ( "..(my_id or "N/A") .." )", root, 255,255,255,true) elseif eventName == "onResourceStart" then for _, player in pairs(getElementsByType("player")) do local acc = getPlayerAccount(player) if not isGuestAccount(acc) then local my_id = getAccountID(acc) setElementData(player, "ID", my_id or "N/A" ) end end end end addEventHandler("onResourceStart", resourceRoot, Start_Id) addEventHandler("onPlayerLogin", root, Start_Id) function getPlayerID(id) for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") and tonumber(getElementData(player, "ID")) == tonumber(id) then return player end end end function getnick(player, command, id, ...) if id then local playerID = tonumber(id) if(playerID) then local Player2 = getPlayerID(playerID) if(Player2) then outputChatBox ( "#838B83➲ #ff0000INFO #ff0000 ➲ #ff0000 Player name #ff0000" .. getPlayerName(Player2) .."", player, 255,255,255,true) else outputChatBox ( "#838B83➲ #ff0000ERRO #ff0000 ➲ #ff0000 The Player of ID: #ff0000( " .. id .. " ) #ff0000Was not found!", player, 255,255,255,true) end else outputChatBox ( "#838B83➲ #ff0000ERRO #ff0000 ➲ #ff0000 ID: #ff0000( " .. id .. " ) #ff0000Invalid!", player, 255,255,255,true) end else outputChatBox ( "#838B83➲ #ff0000 Use /id #ff0000[#ffffffID#00ff00]", player, 255,255,255,true) end end addCommandHandler("id", getnick) Account already have ID (getAccountID)
-
local marker = createMarker (0, 0, 3, "cylinder", 2, 255, 200, 0) local sx, sy = guiGetScreenSize() local window = guiCreateWindow (sx/2 - 200, sy/200, 400, 400, "Окно", false) guiSetVisible(window, false) addEventHandler ("onClientMarkerHit", marker, function(el) guiSetVisible(window, true) showCursor(true) end)
-
В элемент дате которая на серверной стороне, вроде. Ну сравни твою версию и мою, и поймешь где косяк
-
if its a gui element use onClientMouseEnter and onClientMouseLeave if its a dx use isMouseInPosition
-
Пробуй, я не тестил
-
local myWindow = guiCreateWindow ( 0, 0, 0.5, 0.4, "Information", true ) -- create a window which has "Information" in the title bar. local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) -- create a tab panel which fills the whole window local tabMap = guiCreateTab( "Map Information", tabPanel ) -- create a tab named "Map Information" on 'tabPanel' local tabHelp = guiCreateTab( "Help", tabPanel ) -- create another tab named "Help" on 'tabPanel' -- adds a label (text) to each tab guiCreateLabel(0.02, 0.04, 0.94, 0.2, "This is information about the current map", true, tabMap) guiCreateLabel(0.02, 0.04, 0.94, 0.92, "This is help text.", true, tabHelp) guiSetVisible(myWindow, false) bindKey("f2", "down", function() guiSetVisible (myWindow, not guiGetVisible(myWindow)) showCursor(guiGetVisible(myWindow)) end)
-
-- SERVER -- addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if bodypart == 9 then local result = triggerEvent("", source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) end end end ) addEventHandler ("onResourceStart", resourceRoot, function() for _, v in ipairs ( { "pro", "std", "poor" } ) do setWeaponProperty ( "sniper", v, "damage", 225 ) setWeaponProperty ( "m4", v, "damage", 80 ) setWeaponProperty ( "ak47", v, "damage", 60 ) setWeaponProperty ( "mp5", v, "damage", 30 ) setWeaponProperty ( "deagle", v, "damage", 45 ) setWeaponProperty ( "colt45", v, "damage", 20 ) setWeaponProperty ( "combatshotgun", v, "damage", 120 ) setWeaponProperty ( "uzi", v, "damage", 25 ) setWeaponProperty ( "tec-9", v, "damage", 35 ) end end) -- CLIENT -- local weapons = {20, 40, 31, 30, 29, 24, 22, 27} local function isWeaponInTable (id) for i, v in ipairs (weapons) do if v == id then return true end end return false end function onClientPedDamage(_, weapon) if(getElementType(source) == "player") then if isWeaponInTable(weapon) then return killPed(source) end end end addEventHandler("onClientPedDamage", getRootElement(), onClientPedDamage)
-
Table 'areny' in database is exist?
-
function getOneBlipByID (id) for i, v in ipairs (getElementsByType("blips")) do if getBlipIcon(v) == id then return v end end return false end createBlip (0, 0, 0, 10) createBlip (1, 1, 1, 10) createBlip (2, 2, 2, 10) getOneBlipByID (10)
-
guiCreateLabel wiki Parent is GUI element to which attached other GUI element (buttons, edits, labels, gridlists and other)
-
No parent for guiLabel
-
server getRealTime() 12h format, need 24h format..
AngelAlpha replied to dqlepy's topic in Scripting
function updateDX( ) local health = getElementHealth(localPlayer) local armour = getPedArmor(localPlayer) local hunger = getElementData(localPlayer, configs['Elements']['Fome']) or 0 local thirst = getElementData(localPlayer, configs['Elements']['Sede']) or 0 local stress = getElementData(localPlayer, configs['Elements']['Stress']) or 100 local radio = getElementData(localPlayer, "ae.frequencia") or 0 local x,y,z = getElementPosition(localPlayer) local street = getZoneName ( x, y, z, true ) local direction = getZoneName ( x, y, z, false ) local time = getRealTime() local hours = string.format("%02d:%02d", time.hour, time.minute) local minutes = time.minute if getPedOccupiedVehicle(localPlayer) then fuel = getElementData(getPedOccupiedVehicle(getLocalPlayer()), configs['Elements']['fuel']) or 0 speed = ( function( x, y, z ) return math.floor( math.sqrt( x*x + y*y + z*z ) * 155 ) end )( getElementVelocity( getPedOccupiedVehicle(localPlayer) ) ) end SendNUIMessage(browser, { vehicle = vehicle, talking = talking, health = health, armour = armour, thirst = thirst, hunger = hunger, street = street, radio = radio, time = hours, minutes = minutes, direction = direction, voice = voice, speed = speed, fuel = fuel }) end -
server getRealTime() 12h format, need 24h format..
AngelAlpha replied to dqlepy's topic in Scripting
local time = getRealTime() local timeString = string.format("%02d:%02d", time.hour, time.minute) -- OR local timeString = os.date ("%H:%M") os.date function