-
Posts
1,273 -
Joined
-
Last visited
-
Days Won
1
Everything posted by GTX
-
Wrong. addEventHandler("onClientGUIClick",root, function () if (source == reject) then guiSetVisible(window, false) showCursor(false) unbindKey("arrow_d", "down",arr ) elseif (source == buy) then if (guiGridListGetSelectedItem (sevenShopList)) then local weapID = guiGridListGetItemText ( sevenShopList, guiGridListGetSelectedItem (sevenShopList) , 1 ) local weapName = guiGridListGetItemText ( sevenShopList, guiGridListGetSelectedItem (sevenShopList) , 2 ) local weapPrice = Weapons[guiGridListGetSelectedItem (sevenShopList)+1][3] local row = guiGridListAddRow ( sevenShopList ) guiGridListSetItemText ( sevenShopList, row, column, message, false, false ) local rowCount = guiGridListGetRowCount ( sevenShopList ) setTimer ( guiGridListSetVerticalScrollPosition, 50, 1, sevenShopList, 100 ) guiSetVisible(window, false) showCursor(false) triggerServerEvent("weapon_Name",getLocalPlayer(),weapID,weapName,weapPrice) end end end) function arr() local scrollPos = guiGridListGetVerticalScrollPosition(sevenShopList) guiGridListSetVerticalScrollPosition(sevenShopList, scrollPos+1) end
-
It should work, I don't see why not. Remove setTimer ( guiGridListSetVerticalScrollPosition, 50, 1, sevenShopList, 100 )
-
bindKey("arrow_d", "down", function() local scrollPos = guiGridListGetVerticalScrollPosition(sevenShopList) guiGridListSetVerticalScrollPosition(sevenShopList, scrollPos+1) end )
-
You are ALWAYS bringing up solved problems. I don't know what's wrong with you? viewtopic.php?f=91&t=90522#p813443
-
sx,sy = guiGetScreenSize() x,y = (sx/1280),(sy/768) local r, g, b = 255, 255, 255 function speedometer() if isPedInVehicle(localPlayer) then local veh = getPedOccupiedVehicle (localPlayer) local sx, sy, sz = getElementVelocity ( veh ) local kphSpeed = math.ceil( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) local health = getElementHealth ( veh ) local currenthealth = math.floor( health/10 ) dxDrawRectangle(x*91, y*495, x*181, y*18, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*91, y*473, x*181, y*18, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*91, y*495, x*(181/161/0.5/2/1.5*kphSpeed), y*18, tocolor(0, 0, 255, 100), false) dxDrawRectangle(x*91, y*473, x*(currenthealth*181), y*18, tocolor(r, g, b, 100), false) if (currenthealth >= 80) then r, g, b = 0, 255, 0 elseif (currenthealth < 80 and currenthealth >= 60) then r, g, b = 150, 255, 0 elseif (currenthealth < 60 and currenthealth >= 50) then r, g, b = 255, 215, 0 elseif (currenthealth < 50 and currenthealth >= 40) then r, g, b = 255, 69, 0 elseif (currenthealth <40 and currenthealth >= 30) then r, g, b = 178, 34, 34 elseif (currenthealth < 30) then r, g, b = 50, 0, 0 end end end addEventHandler ( "onClientRender", root, speedometer )
-
What specifically doesn't work? Any errors in debug script? function ban(p,_,player) local player = getPlayerWildcard(player)[1] local accName = getAccountName(getPlayerAccount(player)) if not isObjectInACLGroup("user."..accName,aclGetGroup'Admin') then return outputChatBox("Error: You are not an Admin.",p,255,0,0) end if not player then return outputChatBox("Error: usage /ban ",p,255,0,0) end local table = getPlayerWildcard(player) if #table == 0 then return outputChatBox ( "Error: '"..player.."' matches no players.",p,255,0,0) end if #table == 1 then return outputChatBox ( removeColor( getPlayerName( table[1] ) ).." has been banned by "..removeColor(getPlayerName(p)),root,255,0,0) banPlayer(player,false,false,true,p) end outputChatBox("Error: '"..player.."' matches "..#table.." players.",p,255,0,0) end addCommandHandler("ban",ban) function removeColor(string) return string.gsub(string,"#%x%x%x%x%x%x","") end function getPlayerWildcard ( string ) local player = getPlayerFromName ( string ) if ( player ) then return player end local matches = {} for id, player in ipairs ( getElementsByType ( "player" ) ) do if ( string.find ( string.upper ( getPlayerName ( player ) ), string.upper ( string ), 1, true ) ) then table.insert(matches,player) end end return #matches end
-
local textures = {}; local function render_crosshair () local screenw, screenh = guiGetScreenSize (); local s = screenw * 0.5; local u,v = (screenw - s)*0.5, (screenh - s)*0.5; local black = tocolor (0, 0, 0, 255); dxDrawRectangle (0, 0, screenw, v, black); dxDrawRectangle (0, 0, u, screenh, black); dxDrawRectangle (0, screenh, screenw, -v, black); dxDrawRectangle (screenw, screenh, -u, -screenh, black); dxDrawImage (u, v, screenw-2*u, screenh-2*v, textures ["crosshair_background"]); dxDrawImage (u, v, screenw-2*u, screenh-2*v, textures ["crosshair"]); end; local function on_weapon_aimed (key, state) if isPedInVehicle(source) then if (getElementModel(source) == 432) then if state == "down" then showPlayerHudComponent ("crosshair", false); addEventHandler ("onClientHUDRender", getRootElement (), render_crosshair); else removeEventHandler ("onClientHUDRender", getRootElement (), render_crosshair); end; end; end end; addEventHandler ("onClientResourceStart", getResourceRootElement (getThisResource ()), function () -- load textures. textures ["crosshair"] = dxCreateTexture ("images/PKS-07_crosshair.png", "argb", true, "wrap"); if not textures ["crosshair"] then outputDebugString ("failed to load \"images/PKS-07_crosshair.png\" texture", 1); return; end; textures ["crosshair_background"] = dxCreateTexture ("images/PKS-07_crosshair_background.png", "argb", true, "wrap"); if not textures ["crosshair_background"] then outputDebugString ("failed to load \"images/PKS-07_crosshair_background.png\" texture", 1); return; end; bindKey ("aim_weapon", "both", on_weapon_aimed); addEventHandler ("onClientPlayerWeaponSwitch", getRootElement (), function (previousWeaponSlot) local weaponslot_type_sniper = 6; if previousWeaponSlot == weaponslot_type_sniper then if not isPlayerHudComponentVisible ("crosshair") then showPlayerHudComponent ("crosshair", true); end; end; end); end); addEventHandler ("onClientResourceStop", getResourceRootElement (getThisResource ()), function () unbindKey ("aim_weapon", "both", on_weapon_aimed); if not isPlayerHudComponentVisible ("crosshair") then showPlayerHudComponent ("crosshair", true); end; end);
-
Because you set edits to use relative position but you're actually using absolute positions.
-
You can make it rotate with setElementRotation
-
Of course. Never put GUI elements into onClientRender event. --Edits boxes and checkbox userBox = guiCreateEdit(476, 361, 334, 29, "", true) passBox = guiCreateEdit(476, 479, 334, 29, "", true) guiEditSetMasked(passBox, true) guiSetEnabled(userBox,true) guiSetEnabled(passBox,true) function drawLoginConcept() --Camera setCameraMatrix(358.822265625, -2066.345703125, 28.744483947754, 1500, 500, -850) --Dx --Variables: anim = 0 animacion = anim + 150 --Panel dxDrawRectangle(sX * 0.3570, sY * 0.2676, sX * 0.2867, sY * 0.4961, tocolor(0, 0, 0, login_alpha), false) dxDrawLine(sX * 0.3563, sY * 0.2617, sX * 0.3563, sY * 0.7627, tocolor(255, 60, 50, login_alpha), 2, false) dxDrawLine(sX * 0.3563, sY * 0.7637, sX * 0.6459, sY * 0.7637, tocolor(255, 60, 50, login_alpha), 2, false) dxDrawLine(sX * 0.6445, sY * 0.2607, sX * 0.6445, sY * 0.7630, tocolor(255, 60, 50, login_alpha), 2, false) dxDrawLine(sX * 0.3563, sY * 0.2617, sX * 0.6453, sY * 0.261, tocolor(255, 60, 50, login_alpha), 2, false) --Botones dxDrawRectangle (sX*0.375, sY*0.665, 150, 40,rectanglecchanger1, true) dxDrawRectangle (sX*0.51, sY*0.665, 150, 40, rectanglecchanger2, true) dxDrawRectangle (sX*0.375, sY*0.71, 323, 40, rectanglecchanger3, true) dxDrawRectangle (sX*0.356, sY*0.26, 370, 30, tocolor (255, 60, 50, 255), true) dxDrawRectangle(sX * 0.3575, sY * 0.6426, sX * 0.2859, sY * 0.0117, tocolor(255, 60, 50, 255), false) --Textos dxDrawText ("Register", sX*0.52, sY*0.60, sX/2-300/2+160+140, sY*0.73+40, tocolor (0, 0, 0, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) dxDrawText ("Login", sX*0.25, sY*0.60, sX/2-300/2+160+140, sY*0.73+40, tocolor (0, 0, 0, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) dxDrawText ("Play as guest", sX*0.385, sY*0.69, sX/2-300/2+160+140, sY*0.73+40, tocolor (0, 0, 0, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) dxDrawText ("Login Panel", sX*0.385, sY*(-0.22), sX/2-300/2+160+140, sY*0.73+40, tocolor (0, 0, 0, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) dxDrawText ("Username", sX*0.385, sY*(-0.11), sX/2-300/2+160+140, sY*0.73+40, tocolor (255, 60, 50, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) dxDrawText ("Password", sX*0.385, sY*(0.111), sX/2-300/2+160+140, sY*0.73+40, tocolor (255, 60, 50, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) --Varios showChat(true) showCursor(true) end addEventHandler("onClientRender", root, drawLoginConcept)
-
Any errors in debugscript?
-
From what I understood: https://wiki.multitheftauto.com/wiki/OnTrailerAttach https://wiki.multitheftauto.com/wiki/On ... ilerAttach Then set a variable (i.e trailerAttached = true) and then after you complete the run, check that variable, if trailer is attached. (I think there's no isTrailerAttached or getVehicleTrailer function yet?) If it's been detached set variable to false. (https://wiki.multitheftauto.com/wiki/OnTrailerAttach https://wiki.multitheftauto.com/wiki/On ... ilerAttach)
-
An example: bindKey("arrow_down", "down", function() local scrollPos = guiGridListGetVerticalScrollPosition(grid) guiGridListSetVerticalScrollPosition(grid, scrollPos+1) end )
-
Oh my god. Stop making new topics about the same problem! local allLocation = {"Las Venturas", "San Fierro", "Whetstone", "Flint County", "Red County", "Los Santos"} function theLocator() for i, v in ipairs(getElementsByType"player") do local theLocation = getElementZoneName(v, true) for theKey, allLocation in pairs(allLocation) do if (theLocation == theKey) then killPed(v) end end end end setTimer(theLocator, 50, 0)
-
Yes; createObject attachElements processLineOfSight createExplosion bindKey getCameraMatrix
-
DX functions can't trigger GUI events.
-
Obviously. Use onClientRender.
-
What do you actually mean by playing videos? If you didn't inject the mouse clicks yet; addEventHandler("onClientClick", root, function(button, state) if state == "down" then injectBrowserMouseDown(theBrowser, button) else injectBrowserMouseUp(theBrowser, button) end end end
-
bindKey -- "arrow_up", "arrow_down" https://wiki.multitheftauto.com/wiki/Gu ... llPosition https://wiki.multitheftauto.com/wiki/Gu ... llPosition
-
How much topics did you make? 5? God... viewtopic.php?f=91&t=90459#p813030
-
You're welcome Although, some people might say "We do not give support for leaked scripts" but Valhalla is past already... Developers of original Valhalla do not care anymore (or do they?)
-
btnbuy = guiCreateButton(773, 596, 127, 41, "buyWep", false) gridlist = guiCreateGridList(412, 179, 488, 412, false) guiGridListAddColumn(gridlist, "#", 0.2) guiGridListAddColumn(gridlist, "Name", 0.2) guiGridListAddColumn(gridlist, "Price", 0.2) guiGridListAddColumn(gridlist, "AMMO", 0.2) for k,v in ipairs ( Weapons ) do local row = guiGridListAddRow (gridlist) guiGridListSetItemText (gridlist, row, 1,v [1] , false, false) guiGridListSetItemText (gridlist, row, 2, v [2], false, false) guiGridListSetItemText (gridlist, row, 3, v [3].."$" , false, false) guiGridListSetItemText (gridlist, row, 4, v [4] , false, false) end function buygun() if (source == btnbuy) then if (guiGridListGetSelectedItem (gridlist)) then local weapID = guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 1) local weapName = guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 2) local weapPrice = Weapons[guiGridListGetSelectedItem (gridlist)][3] local weapAMMO = guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 4) triggerServerEvent ("buyweapon", getLocalPlayer(), weapID, weapName, weapPrice, weapAMMO) end end end addEventHandler ("onClientGUIClick", getRootElement(), buygun)