Jump to content

hipolitalakaj

Members
  • Posts

    53
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

hipolitalakaj's Achievements

Snitch

Snitch (10/54)

1

Reputation

  1. Hi! I have an inventory system which have weaponindexByID and weaponModels table. I don't get it how can I reference to the weapon model if the weaponindexByID == 30 and the weaponModels == 1254 ? I get the "ok" in the outputchatbox if I reference to the weaponid like this: if weaponIndexByID[item_id] == 30 then outputChatBox("ok") end but I want to get the "ok" in the chatbox if the weaponIndexByID == 30 and the weaponModels == 1254 --- weaponModels table --- weaponModels = { [14] = {1254, x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0, scale = 1}, [15] = {356, x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0, scale = 1}, [16] = {339, x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0, scale = 1}, [18] = {336, x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0, scale = 1}, [22] = {358, x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0, scale = 1}, [24] = {353, x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0, scale = 1}, [23] = {357, x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0, scale = 1}, [28] = {349, x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0, scale = 1}, [21] = {346, x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0, scale = 1}, } --- weaponIndexByID table --- weaponIndexByID = { [14] = 30, [15] = 31, [16] = 8, [17] = 24, [18] = 5, [19] = 4, [20] = 3, [21] = 22, [22] = 34, [23] = 33, [24] = 29, [25] = 28, [26] = 32, [27] = 23, [28] = 25, }
  2. What do you mean? Something like this? ---- client ---- function receiveItems(data) item_table = {} item_table = data if(itemElement and getElementType(itemElement) == "player" and itemElement == localPlayer or itemElement==nil )then item_table_player = data for index, value in ipairs (item_table) do if value[5] > 0 then item_table_action[tonumber(value[5])] = {item_table[tonumber(index)][6], item_table[tonumber(index)][1], item_table[tonumber(index)][3]} end end end isMove = false movedItem = 0 newCount = 0 movedSlot = -1 movedCount = 0 movedValue = 0 selectedAmount = 0 currentActionSlot = 0 end addEventHandler("onClientResourceStart", getRootElement(), receiveItems)
  3. Um, thanks for your reply. So I need to put a timer? if yes, where I need to put that timer? I still don't get it
  4. Hi! I trying to trigger a clientside event in server.lua which exists in client.lua but the debugscript says "Server triggered clientside event onClientReceiveItems, but event is not added clientside" What's wrong? ---- client ---- function receiveItems(data) item_table = {} item_table = data if(itemElement and getElementType(itemElement) == "player" and itemElement == localPlayer or itemElement==nil )then item_table_player = data for index, value in ipairs (item_table) do if value[5] > 0 then item_table_action[tonumber(value[5])] = {item_table[tonumber(index)][6], item_table[tonumber(index)][1], item_table[tonumber(index)][3]} end end end isMove = false movedItem = 0 newCount = 0 movedSlot = -1 movedCount = 0 movedValue = 0 selectedAmount = 0 currentActionSlot = 0 end addEvent("onClientReceiveItems", true) addEventHandler("onClientReceiveItems", getRootElement(), receiveItems) ---- server ---- function loadPlayerItems(element) local ownerID = tonumber(getElementData(element, "acc:id") or -1) array[0][ownerID] = {} local item = -1 for i = 1, 50 do array[0][ownerID][i] = {-1, -1, -1, -1, -1, -1, -1} end local loadItems = dbPoll(dbQuery(connection, "SELECT * FROM items WHERE owner = ? AND type = 0", ownerID), -1) if #loadItems > 0 then for i, row in ipairs(loadItems) do item = tonumber(row['itemid']) or -1 value = row['value'] or -1 count = tonumber(row['count']) or -1 slot = tonumber(row['slot']) or -1 type = tonumber(row['type']) or -1 slot = tonumber(row['slot']) or -1 id = tonumber(row['id']) or -1 actionslot = tonumber(row['actionslot']) or -1 duty = tonumber(row['dutyitem']) or -1 array[tonumber(getType(element)) or 0][ownerID][slot] = {tonumber(item), value, tonumber(count), tonumber(id), tonumber(actionslot), tonumber(slot), tonumber(duty)} end end triggerClientEvent(element, "onClientReceiveItems", element, array[tonumber(getType(element)) or 0][ownerID]) end addEvent("playerLoadItemsToServer", true) addEventHandler("playerLoadItemsToServer", root, loadPlayerItems)
  5. Umm, now loads the full glock skin, lol it's not invisible https://imgur.com/a/GRuRmBJ
  6. Its works, if I give the ID 30 AK (which is default) then invisible, but if I attach the camo AK to the player's hand with bone_attach then I see the default & the camo AK too... Thanks, but it's not working. Btw it's a glock's txd am I need to get a glock dff too that's why isn't insivible? or what? https://imgur.com/a/u9mnqOj
  7. I can't make to invisible in this way, because I need to provide element for SetElementAlpha function. and the default ak is already in game, not created by me with createweapon function.
  8. I think u meant https://wiki.multitheftauto.com/wiki/SetElementAlpha it is work in this situation? Because I need to make the original (default) AK-47 invisible not a weapon which I created with createweapon function.
  9. Now I'm stuck in the invisible model part... can't make it with txd workshop, I already tried to change the texture to white/black image and untick the alpha in properties but isn't be invisible... anyone have an insivible model please?
  10. Ah okay, I will try it. Thanks for your help.
  11. It's okay but if I give ak to the player (I need to provide the default AK id 30) and the weapon ID 30 model ID is 355.. so if I do the "engineImportTXD" , "engineReplaceModel" I need to provide the 355 Model ID for every custom skin.. or can I give example weapon ID 30 with any usable object ID (2965) instead of 355 model ID?
  12. And how can I do it that replace the weapon only for the localplayer who using the eg.: camo ak? because if I make the original ak inivisble and replace with the custom then changes the skin for everyone not just for localplayer who using the custom ak. isn't it? (eh my english is s.cks but hope u understand what I mean)
  13. Oh, I see. Then which function can I do it? Because currently my character is boxing the air if I click mouse 1...
×
×
  • Create New...