Jump to content

iwalidza

Members
  • Posts

    155
  • Joined

Everything posted by iwalidza

  1. if i set count like 140 i want first take 100 and take 40 from 128 Example please. @The_GTA
  2. @The_GTA playerInventroy:takeItem(4,140) that just take 100 from items
  3. @The_GTA items = { [1] = {name = "Appel",stack = "10",isDurability = false,isAmmo=false}; [2] = {name = "Building Plan",stack = "1",isDurability = false,isAmmo=false}; [3] = {name = "Assault Rifle",stack = "1",isDurability = true,isAmmo=true}; [4] = {name = "5.56 Rifle ammo",stack = "128",isDurability = false,isAmmo=false}; [5] = {name = "Longsleeve T-Shirt",stack = "1",isDurability = false,isAmmo=false}; [6] = {name = "T-Shirt",stack = "1",isDurability = false,isAmmo=false}; [7] = {name = "Boots",stack = "1",isDurability = false,isAmmo=false}; [8] = {name = "Improvised Balaclava",stack = "1",isDurability = false,isAmmo=false}; [9] = {name = "Heavy Plate Jacket",stack = "1",isDurability = false,isAmmo=false}; [10] = {name = "Pants",stack = "1",isDurability = false,isAmmo=false}; [11] = {name = "Coffee Can Helmet",stack = "1",isDurability = false,isAmmo=false}; [12] = {name = "Revolver",stack = "1",isDurability = true,isAmmo=true}; [13] = {name = "Pistol Bullet",stack = "128",isDurability = false,isAmmo=false}; [14] = {name = "Hammer",stack = "1",isDurability = false,isAmmo=false}; [15] = {name = "Pickaxe",stack = "1",isDurability = true,isAmmo=false}; [16] = {name = "Hatchet",stack = "1",isDurability = true,isAmmo=false}; } function getItemInfos (id) return items[id].name,items[id].stack,items[id].isDurability,items[id].isAmmo end that about getItemInfos and take item firts arg its about item id in items ids i use it to select item waht i need if not count then count = self.infos[2] end and that if i want to take stack just i don't add count
  4. function Inventory:takeItem(itemID,count,slot) if not itemID then return false end self.infos = { getItemInfos (itemID)} if not count then count = self.infos[2] end if not slot then for i = #self.items ,1 ,-1 do if self.items[i][1] == itemID then local canTake = math.min(count,self.items[i][2]) self.items[i][2] = self.items[i][2] - canTake if self.items[i][2] == 0 then table.remove(self.items,i) end break end end end end I want take 140 from the item and I have 3 of this item 124 124 100 I want take 100 from the last item and second item take just 40 how can do it @The_GTA
  5. I want some important tips for making an inventory system like how I want to sort items I want to make items that can stack and what technique I need to use in server-side
  6. but iam create water in other place i think he to can take the same level?
  7. i have some blocks for water i don't no why
  8. i don't now what parameters to insert in processLineOfSight
  9. how i can get ground position in custom island object getGroundPosition() not work with if
  10. how I can make a terrain generator? I see some people make it
  11. iwalidza

    drop item

    how i can make script when i drop item form inventory he will drop like object in world and i can get it back like that
  12. why when I destroy object preview its ped I can see him in screen after destroy? script user object_preview
  13. iwalidza

    Game Crach

    i make object with blender and when i load it in the server game is crached why?
  14. my first time in the blender and when I export dff file is not exported I watch some videos but not work
  15. getGroundPosition return 0 i wiki that mean '0 if the point you tried to test is outside the loaded world map' how i can fix it
  16. local sw, sh = guiGetScreenSize () local isEnable = false local oneTick = false local currentIndex = 1 local levelVar = 0 setDevelopmentMode(true) local loadList = { {9990,"foundation"}, {9991,"door"}, {9992,"floor"}, {9993,"stair"}, {9994,"wall"}, {9995,"walldoor"}, {9996,"wallwindow"}, } function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end function onStart() for i = 1 ,#loadList do col_floors = engineLoadCOL ( "models/"..loadList[i][2]..".col" ) engineReplaceCOL ( col_floors, loadList[i][1] ) txd_floors = engineLoadTXD ( "models/texture.txd" ) engineImportTXD ( txd_floors, loadList[i][1] ) dff_floors = engineLoadDFF ( "models/"..loadList[i][2]..".dff" ) engineReplaceModel ( dff_floors, loadList[i][1] ) end editMode = dxCreateShader('shader.fx', 0, 0, false, 'object') local r, g, b, a = 19, 70, 209,200 dxSetShaderValue ( editMode, "gRedColor", r/255 ) dxSetShaderValue ( editMode, "gGrnColor", g/255 ) dxSetShaderValue ( editMode, "gBluColor", b/255 ) dxSetShaderValue ( editMode, "gAlpha", a/255 ) end addEventHandler("onClientResourceStart", resourceRoot, onStart) function BuildingEditCreate (x,y,z) local player = getLocalPlayer() local matrix = player.matrix editObject = createObject(9990 ,player.matrix.position + player.matrix.forward * 2,0,0,0,true) engineApplyShaderToWorldTexture(editMode,'*',editObject) end function enableEdit () isEnable = not isEnable oneTick = true end bindKey("E","down",enableEdit) function BuildingStartEdit () if not isEnable then if oneTick then destroyElement(editObject) oneTick = false end return end tx, ty, tz = getWorldFromScreenPosition ( (sw / 2) - 3,(sh / 2) - 100, 15 ) px, py, pz = getCameraMatrix() if oneTick then local hit, faceX, faceY, faceZ, elementHit = processLineOfSight ( tx, ty, tz, px, py, pz,true ,true ,true ,true ,true ,false ,false ,false) BuildingEditCreate (faceX, faceY, faceZ) oneTick = false end local overGround = getGroundPosition(getElementPosition(editObject)) hit, faceX, faceY, faceZ, elementHit = processLineOfSight ( tx, ty, tz, px, py, pz,true ,false ,false ,false ,false ,false ,false ,false , editObject) if faceX == nil or faceY == nil then faceX = faceX or tx faceY = faceY or ty end xO,yO,yZ = getElementPosition(editObject) xC,yC = getElementPosition(localPlayer) if yZ < 1.5 then print("lower") setElementPosition(editObject,faceX, faceY, (overGround + 1) + levelVar) end setElementPosition(editObject,faceX, faceY, (overGround + 1) + levelVar) setElementRotation(editObject,0,0,findRotation(xO,yO,xC,yC) + currentIndex) --Debug dxDrawText('Object Position:',10,300) dxDrawText('X: '..xO,100,320) dxDrawText('Y: '..yO,100,340) dxDrawText('Z: '..yZ,100,360) end addEventHandler("onClientRender",root,function() BuildingStartEdit () end); bindKey("pgup","down",function() if levelVar > 1 then return end levelVar = levelVar + 0.10 end) bindKey("pgdn","down",function() if levelVar < 0 then return end levelVar = levelVar - 0.10 end) function increaseIndex() currentIndex = currentIndex + 10 end bindKey("mouse_wheel_up","down",increaseIndex) function decreseIndex() currentIndex = currentIndex - 10 end bindKey("mouse_wheel_down","down",decreseIndex)
  17. I don't know how I can use it I think the area not be of interest
  18. some places getGroundPosition not work well how i can fix it
  19. i get shader from [gameplay]\visualiser i do the shader to my object but shader work fine in some position and else not work good why? position 1 https://prnt.sc/26chls2 position 2 https://prnt.sc/26chmmi
  20. i have bad English language then it's so hard to learn
  21. i want make shader like that .
  22. how I can make this shader I don't have any idea about shaders. https://prnt.sc/26c77mh
×
×
  • Create New...