undefined
Members-
Posts
500 -
Joined
-
Last visited
Everything posted by undefined
-
Im found the mistake. Mistake is in the weap.image. local personality = { label = {}, image = {} } createSkillLevelButton(personality, 162, 53) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() skillWindow = guiCreateWindow(396, 129, 734, 451, "Skill System [F7]", false) guiWindowSetSizable(skillWindow, false) guiSetVisible(skillWindow, false) createSkillLevelButton(personality, 162, 53) end) function createSkillLevelButton(weap, x, y) for i=1, 6 do weap.image[i] = guiCreateStaticImage(x, y, 82, 20, "wep_sel.png", false, skillWindow) guiSetAlpha(weap.image[i], 1.0) weap.label[i] = guiCreateLabel(20, 3, 42, 14, "Level "..i, false, weap.image[i]) guiLabelSetColor(weap.label[i], 255, 255, 255) guiSetFont(weap.label[i], "default-bold-small") guiLabelSetHorizontalAlign(weap.label[i], "center", false) addEventHandler("onClientMouseEnter", weap.image[i], onMouseEnterSkill) addEventHandler("onClientMouseLeave", weap.image[i], onMouseLeaveSkill) addEventHandler("onClientMouseEnter", weap.label[i], onMouseEnterSkill) addEventHandler("onClientMouseLeave", weap.label[i], onMouseLeaveSkill) addEventHandler("onClientGUIClick", weap.image[i], onClickSkill) if i == 6 then return end x = x + 92 end end When the im add the weap.image arguement, it's not work. Here is my create image code. Help!
-
Nope. Help pls
-
It's in the same file.
-
It's here: Removed Give this error when the im removed the other arguements. For example: skillCosts, i, onMouseTable. So the error is not due to skillcosts. ERROR: test\test_s.lua:3: attempt to index local 'skillCosts' (a nil value)
-
Not work! When the im removed the arguements on triggerServerEvent; Like this: local onMouseTable = {{personality, "personality", "Personality"}, {pistol, "pistol", "Pistol"}, {deagle, "deagle", "Deagle"}, {uzi, "uzi", "UZI"}, {shotgun, "shotgun", "Shotgun"}, {ak47, "ak47", "AK-47"}, {m4, "m4", "M4"}} function onClickSkill(btn, state, aX, aY) for k=1,#onMouseTable do local weap = onMouseTable[k][1] for i=1,#weap.image do if source == weap.image[i] or source == weap.label[i] then if lockedSkills(onMouseTable[k][2], onMouseTable[k][3], i) then triggerServerEvent("giveSkill", gMe) outputChatBox("Test 1", 255, 168, 0) end break end end end end Server-Side is give this error: ERROR: test\test_s.lua:3: attempt to index local 'skillCosts' (a nil value) addEvent("giveSkill", true) addEventHandler("giveSkill", getRootElement(), function(player, skillCosts, skillName, skillLevel, image) local amount = skillCosts[skillName][skillLevel][1] -- Line 3 local skillMoney = skillCosts[skillName][skillLevel][2] local skillStat = skillCosts[skillName][skillLevel][3] outputChatBox("Test 2", player, 255, 168, 0) if skillName == "personality" then outputChatBox("Test 3", player, 255, 168, 0) local spawnArmor = skillCosts[skillName][skillLevel][4] takePlayerMoney(player, skillMoney) setElementData(player, skillName, skillLevel) setPedStat(player, 24, skillStat) callClientFunction(player, "boughtSkill", image) end end) So triggerServerEvent is work. But i dont understand this problem. Pff Where is the problem?
-
local gMe = getLocalPlayer() Not work!
-
Hi guys. Im work on the this project. But; When the player click on the weap.image or weap.label, client say's Test 1 but the server is not say Test 2 or Test 3. So triggerServerEvent is not work. It's not give error or warning on debug. Here is my code: ---------------------------------------- -- Client-Side ---------------------------------------- local onMouseTable = {{personality, "personality", "Personality"}, {pistol, "pistol", "Pistol"}, {deagle, "deagle", "Deagle"}, {uzi, "uzi", "UZI"}, {shotgun, "shotgun", "Shotgun"}, {ak47, "ak47", "AK-47"}, {m4, "m4", "M4"}} function onClickSkill(btn, state, aX, aY) for k=1,#onMouseTable do local weap = onMouseTable[k][1] for i=1,#weap.image do if source == weap.image[i] or source == weap.label[i] then if lockedSkills(onMouseTable[k][2], onMouseTable[k][3], i) then triggerServerEvent("giveSkill", gMe, gMe, skillCosts, onMouseTable[k][2], i, weap.image[i]) outputChatBox("Test 1", 255, 168, 0) end break end end end end ---------------------------------------- -- Server-Side ---------------------------------------- addEvent("giveSkill", true) addEventHandler("giveSkill", getRootElement(), function(player, skillCosts, skillName, skillLevel, image) local amount = skillCosts[skillName][skillLevel][1] local skillMoney = skillCosts[skillName][skillLevel][2] local skillStat = skillCosts[skillName][skillLevel][3] outputChatBox("Test 2", player, 255, 168, 0) if skillName == "personality" then outputChatBox("Test 3", player, 255, 168, 0) local spawnArmor = skillCosts[skillName][skillLevel][4] takePlayerMoney(player, skillMoney) setElementData(player, skillName, skillLevel) setPedStat(player, 24, skillStat) callClientFunction(player, "boughtSkill", image) end end) Where is the problem?
-
Only for my resource. So server/deathmatch/resources/...
-
Hey guys. Im try this but i can't. How to create xml for only my resource?
-
Can i use getPlayerAccount with this code?
-
Hey all. How to get all players(online and offline) Thnx
-
false is not work. Im solved it with "false". Thank you IIYAMA...
-
Hey guys. Im working on the faction system but i have a problem. When the "faction" data change, this code work succesfully but when the removed the data, this code not work. onClientElementDataChange code is not get the removed data. How to fix it? addEventHandler("onClientElementDataChange", root, function(dataName) if dataName == "faction" then local row, col = guiGridListGetSelectedItem(factionsList) if row and col and row ~= -1 and col ~= -1 then local listData = guiGridListGetItemData(factionsList, row, 1) setPlayerList(factionsPlayerList, factionsHexCodeChk, true, listData) end setPlayerList(addPlayerPlayerList, addPlayerHexCodeChk, false, false) end end)
-
It's my code: ------------------------------------------------------------ -- Upgrade Vehicle Window/Function ------------------------------------------------------------ addEventHandler("onClientResourceStart", resRoot, function() vehUpgradeWindow = guiCreateWindow(sx/2-303/2, sy/2-380/2, 303, 380, "Araç Yükseltmesi", false) guiSetAlpha(vehUpgradeWindow, 0) guiWindowSetSizable(vehUpgradeWindow, false) guiSetVisible(vehUpgradeWindow, false) vehUpgradeGrid = guiCreateGridList(10, 26, 283, 317, false, vehUpgradeWindow) guiGridListAddColumn(vehUpgradeGrid, "Name", 0.90) vehUpgradeRemove = guiCreateButton(10, 353, 67, 19, "Kaldır", false, vehUpgradeWindow) vehUpgradeClose = guiCreateButton(226, 353, 67, 19, "Kapat", false, vehUpgradeWindow) guiGridListSetSortingEnabled ( vehUpgradeGrid, false ) guiGridListSetSelectionMode ( vehUpgradeGrid, 0 ) local vehicle = getPedOccupiedVehicle(gMe) if vehicle then createUpgradeList(vehicle) end end) addEventHandler("onClientVehicleEnter", gRoot, function(thePlayer, seat) if thePlayer == gMe then createUpgradeList(source) end end) function createUpgradeList(vehicle) local setSelItem local row, col = guiGridListGetSelectedItem(vehUpgradeGrid) local scrollVerPos = guiGridListGetVerticalScrollPosition(vehUpgradeGrid) if row and col and row ~= -1 and col ~= -1 then setSelItem = true else setSelItem = false end guiGridListClear(vehUpgradeGrid) gTable = {} for i,upgrade in ipairs(getVehicleCompatibleUpgrades(vehicle)) do if not gTable[getVehicleUpgradeSlotName(upgrade)] then gTable[getVehicleUpgradeSlotName(upgrade)] = {} end table.insert(gTable[getVehicleUpgradeSlotName(upgrade)], upgrade) end for name, upgrade in pairs(gTable) do if n ~= name and #upgrade > 0 then n = name local row = guiGridListAddRow(vehUpgradeGrid) guiGridListSetItemText(vehUpgradeGrid, row, 1, tostring(name), true, false) end for i, upgrade in ipairs(upgrade) do local row = guiGridListAddRow(vehUpgradeGrid) guiGridListSetItemText(vehUpgradeGrid, row, 1, tostring(upgradeTable[upgrade]), false, false) guiGridListSetItemData(vehUpgradeGrid, row, 1, tostring(upgrade)) end end if setSelItem then guiGridListSetSelectedItem(vehUpgradeGrid, row, col) end for k, test1 in pairs(gTable) do for s, test2 in ipairs(test1) do local test3 = getVehicleUpgrades(vehicle) for upgradeKey, upgradeValue in ipairs(test3) do outputChatBox(tostring(upgradeValue).." - "..tostring(test2)) local test = tostring(s) if tostring(upgradeValue) == tostring(test2) then if guiGridListGetItemData(vehUpgradeGrid, test, 1) == test2 then guiGridListSetItemColor(vehUpgradeGrid, test, 1, 255, 255, 255) outputChatBox(test..": 255,255,255") else guiGridListSetItemColor(vehUpgradeGrid, test, 1, 0, 255, 0) outputChatBox(test..": 0,255,0") end end end end end guiGridListSetVerticalScrollPosition(vehUpgradeGrid, scrollVerPos) end addEventHandler("onClientVehicleStartExit", gRoot, function( player, seat, door ) if player == gMe then guiGridListClear(vehUpgradeGrid) end end) addEventHandler("onClientGUIClick", guiRoot, function() if source == upgradeVehicleButton then local vehicle = getPedOccupiedVehicle(gMe) if guiGetVisible(vehUpgradeWindow) == false then if vehicle then setAlphaGradually(vehUpgradeWindow, 50, number, true, alpha, true) end elseif guiGetVisible(vehUpgradeWindow) == true then setAlphaGradually(vehUpgradeWindow, 50, number, false, alpha, true) triggerServerEvent("vehUpgradeWindowAyar", localPlayer) end elseif source == vehUpgradeClose then setAlphaGradually(vehUpgradeWindow, 50, number, false, alpha, true) triggerServerEvent("vehUpgradeWindowAyar", localPlayer) elseif source == vehUpgradeRemove then local vehicle = getPedOccupiedVehicle(gMe) if not vehicle then return end local row, col = guiGridListGetSelectedItem(vehUpgradeGrid) if row and col and row ~= -1 and col ~= -1 then local vehUpgrade = guiGridListGetItemData(vehUpgradeGrid, row, 1) removeVehicleUpgrade(vehicle, vehUpgrade) end end end) addEventHandler( "onClientGUIDoubleClick", gRoot, function(selUpgrade) if source == vehUpgradeGrid then local vehicle = getPedOccupiedVehicle(gMe) if not vehicle then return end local row, col = guiGridListGetSelectedItem ( vehUpgradeGrid ) if ( row and col and row ~= -1 and col ~= -1 ) then local vehUpgrade = guiGridListGetItemData ( vehUpgradeGrid, row, 1 ) addVehicleUpgrade(vehicle, vehUpgrade) createUpgradeList(vehicle) end end end) When the double clicked on gridlist, createUpgradeList() was active. It's work perfectly first group (for example: Whells). But when the clicked second group, guiGridListSetItemColor function is set Whells group child. Where is the problem? Srry for my bad English!
-
How to find gridlist count with gridlist data?
-
When the clicked on the image, the game is give very lag then it's give this error;
-
Hi guys. Im tryed this but it's not on the skillWindow. Image: Code: data = { background = { {10, 54, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 105, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 156, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 207, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 258, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 309, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 360, 550, 41, ":test/Adsiz.png", false, skillWindow} } } local back = {} addEventHandler("onClientResourceStart", resourceRoot, function() skillWindow = guiCreateWindow(369, 143, 570, 418, "test", false) guiWindowSetSizable(skillWindow, false) guiSetAlpha(skillWindow, 0.85) for k, v in pairs(data.background) do back[k] = guiCreateStaticImage(unpack(v)) end end) Where is the problem?
-
I can't. I can't find defined the wnd.x and wnd.y...
-
When the someone player dead, this function is create the vehicle. But this vehicle only for showing dead player, so only 1 player. Are you understand?
-
Hi guys. Im work on the spawn system. But i have a problem. When the player wasted, the vehicle created for only wasted player. Where is the problem? Server-Side local area69SpawnLocation = { {425, 306, 2020, 32, 20, 90, 306, 2020, 17.6, 285}, {425, 306, 2000, 32, 20, 90, 306, 2000, 17.6, 285}, {425, 306, 1980, 32, 20, 90, 306, 1980, 17.6, 285}, {425, 306, 1960, 32, 20, 90, 306, 1960, 17.6, 285}, {425, 306, 1940, 32, 20, 90, 306, 1940, 17.6, 285}, {425, 306, 1920, 32, 20, 90, 306, 1920, 17.6, 285} } addEventHandler( "onPlayerWasted", root, function(totalAmmo, killer, killerWeapon, bodypart, stealth) local k = math.random(#area69SpawnLocation) setTimer(createSpawnVehicle, 13500, 1, area69SpawnLocation[k][1], area69SpawnLocation[k][2], area69SpawnLocation[k][3], area69SpawnLocation[k][4], area69SpawnLocation[k][5], area69SpawnLocation[k][6], source, area69SpawnLocation[k][7], area69SpawnLocation[k][8], area69SpawnLocation[k][9], area69SpawnLocation[k][10]) end) addEventHandler( "onPlayerLogin", root, function( ) local k = math.random(#area69SpawnLocation) createSpawnVehicle( area69SpawnLocation[k][1], area69SpawnLocation[k][2], area69SpawnLocation[k][3], area69SpawnLocation[k][4], area69SpawnLocation[k][5], area69SpawnLocation[k][6], source, area69SpawnLocation[k][7], area69SpawnLocation[k][8], area69SpawnLocation[k][9], area69SpawnLocation[k][10]) end) function createSpawnVehicle(model, vehX, vehY, vehUpZ, vehDownZ, rotation, player, playerX, playerY, playerZ, skinID) triggerClientEvent(player, "createSpawnVehicle", root, model, vehX, vehY, vehUpZ, vehDownZ, rotation, player, playerX, playerY, playerZ, skinID) end Client-Side function createSpawnVehicle(model, vehX, vehY, vehUpZ, vehDownZ, rotation, player, playerX, playerY, playerZ, skinID) vehicle = createVehicle(model, vehX, vehY, vehUpZ, 0, 0, rotation) end addEvent("createSpawnVehicle", true) addEventHandler("createSpawnVehicle", getRootElement(), createSpawnVehicle)
-
-- [fr_client.lua] onClick function fillInPosition(relX, relY, btn) -- Line 624 if (btn == 'right') then closeWindow (wndSetPos) return end local x = relX*6000 - 3000 local y = 3000 - relY*6000 local hit, hitX, hitY, hitZ hit, hitX, hitY, hitZ = processLineOfSight(x, y, 3000, x, y, -3000) setControlNumbers(wndSetPos, { x = x, y = y, z = hitZ or 0 }) end -- [gui.lua] define the relX and relY function _buildWindow(wnd, baseWnd, parentWnd) -- Line 136 local wndClass = wnd[1] if wndClass == 'br' then return end local relX, relY, relWidth, relHeight if parentWnd then if wnd.x and wnd.y then relX = wnd.x/parentWnd.width relY = wnd.y/parentWnd.height end relWidth = wnd.width / parentWnd.width relHeight = wnd.height / parentWnd.height end local elem if wndClass == 'wnd' then local screenWidth, screenHeight = guiGetScreenSize() if not wnd.x then wnd.x = screenWidth/2 - wnd.width/2 else local i, f = math.modf(wnd.x) if f ~= 0 then wnd.x = screenWidth * wnd.x end if wnd.x < 0 then wnd.x = screenWidth - math.abs(wnd.x) - wnd.width end end if not wnd.y then wnd.y = screenHeight/2 - wnd.height/2 else local i, f = math.modf(wnd.y) if f ~= 0 then wnd.y = screenHeight * wnd.y end if wnd.y < 0 then wnd.y = screenHeight - math.abs(wnd.y) - wnd.height end end -- Bla bla bla bla if wnd.controls then for id, controlwnd in pairs(wnd.controls) do _buildWindow(controlwnd, baseWnd or wnd, wnd) end end if wnd.tabs then for id, tab in pairs(wnd.tabs) do _buildWindow(tab, baseWnd, wnd) end end -- Bla bla bla bla end parentWnd.width = map image x size parentWnd.height = map image y size But i dont understand wnd.x and wnd.y
-
I was searched this but i didn't find it.
