Jump to content

iwalidza

Members
  • Posts

    155
  • Joined

1 Follower

About iwalidza

  • Birthday 12/12/1997

Details

  • Gang
    Bad Boys
  • Location
    A

Recent Profile Visitors

2,923 profile views

iwalidza's Achievements

Busta

Busta (15/54)

20

Reputation

  1. addEventHandler("onClientResourceStart", resourceRoot, function() setDiscordState("Loading...") end) Wiki example
  2. Hello about your resource you use this functions and events onClientGUIClick -- use to check what gui click getElementType -- check if the source clicked is check box that is check box type "gui-checkbox" guiCheckBoxGetSelected -- to check if the check box is on or off fileExists -- to check if file save infos that is exists or no fileCreate -- to create file that will have the client user name and password fileWrite -- write the infos in the file toJSON -- to make the infos write with json fileClose -- don't forge to close the file -- now you need to check when login panel start if client is have remember me then turn it on again and use next function fileExists -- to check if file save infos that is exists or no fileOpen -- to open the file fileGetSize -- to get the file read size fileRead -- read the file fileClose -- don't forge to close the file fromJSON -- that to get json data guiSetText -- now you can set the username and password edit box text
  3. fuelConsumption = 0.004 fuelTable = {} function vehMove() for i,v in ipairs(getElementsByType("vehicle")) do x,y,z = getElementPosition(v) if fuelTable[v] then distance = getDistanceBetweenPoints3D(x,y,z,fuelTable[v][2],fuelTable[v][3],fuelTable[v][4]) enginePlus = 0 if getVehicleEngineState(v) then enginePlus = 0.08 end newFuel = fuelTable[v][1] - (fuelConsumption*(distance+enginePlus)) fuelTable[v] = {newFuel,x,y,z} setElementData(v, "fuel", fuelTable[v][1]) else if getElementData(v, "fuel") then fuelTable[v] = {getElementData(v, "fuel"), x, y, z} else fuelTable[v] = {100, x, y, z} end end if getElementData(v, "fuel") <= 0 then setVehicleEngineState(v, false) end end end setTimer(vehMove, 1000, 0)
  4. Yeah i use it and its perfect, thank for help all.
  5. I found these great tutorials that may clarify the idea of oop for many programmers and I want to share them with you, good luck.
  6. Unable to load mods\deathmatch\modules\bcrypt.dll (126) why is that. i just have that error any one can help me?
  7. I have an inventory system it has stack system like one slot can get just 10 apples like if i write command to give player item and i want give player like 36 apples and he have 4 apples in him inventory then him inventory he be like that 10 10 10 10 10 how i can do it
  8. how i can do it to add items
  9. iwalidza

    share data

    i want make farm server and its based in server side to show same object to all players now i want to make for every object in this farm system health bar. what best idea to share date from server to client ElementsPositions = { {156 ,-57}, {287 ,-57}, {256 ,-7}, {139, -86}, } types = { [1] = { [1] = { {3929,1}, {3930,1}, {3931,1}, {2936,1}, }, [2] = { {747,- 0.3}, {758,- 0.3}, {746,- 0.3}, {745,- 0.3}, }, [3] = { {1303,0.4}, {1304,0.4}, {1305,0.4}, } }, [2] = { [1] = { {655,0.3}, {660,0.3}, {708,0.3}, {657,0.3}, {673,-1}, }, }, [3] = { [1] = { {811,-0.1}, {818,0}, {809,0}, }, }, } main = exports.main local Resources = {} local Elements = {} Resources = inherit(Class) addEvent('reserveGroundPos', true) function Resources:constructor(type,x,y) self.type = math.random(1,#types) self.selectedType = math.random(1,#types[self.type]) self.x = x self.y = y self.health = 1000 self.Fcreate = bind(self.createResources, self) self:registerEvent("onPlayerResourceStart", root, self.Fcreate) end function Resources:createResources(loadedResource) if loadedResource ~= getThisResource() then return end if types[self.type] then if not getGroundPos(source,self.x,self.y) then return end addEventHandler('reserveGroundPos',root,function(z) self.z = z if self.object then return end self.randomeSelectType = math.random(1,#types[self.type][self.selectedType]) self.TypeSelected = types[self.type][self.selectedType][self.randomeSelectType] self.object = createObject(self.TypeSelected[1],self.x,self.y,self.z + self.TypeSelected[2]) setElementFrozen(self.object,true) setElementData(source,"object:x",self.x,"local") end) end end function randomSpawn () for i,v in ipairs(ElementsPositions) do Elements = Resources:new(1,v[1] ,v[2]) end end randomSpawn () function getGroundPos(player,x,y) return triggerClientEvent(player,"onGetGroundPos",player,x,y) end
  10. how i can get ground position with this in server side
  11. -- client side function getGroundPos (x,y) local is_hit, hitX, hitY, hitZ = processLineOfSight( x,y, 5000, x,y, -30, true, false, false, true, true, false, false, false, nil, false, false ) if not hitZ then return 0 end return hitZ end function serverGroundPos(x,y) z = getGroundPos (x,y) end addEvent('getGroundPos',true) addEventHandler('getGroundPos',root,serverGroundPos) -- server side function getGroundPos (player,x,y) triggerClientEvent(player,'getGroundPos',player,x,y) end function returnGroundPos (z) return z end addEvent('returnGroundPos',true) addEventHandler('returnGroundPos',root,returnGroundPos) and in exported script self.z = main:getGroundPos(source,self.x,self.y) self.z return nil
  12. i make new getGroundPosition() its in client side how i can return the value in server side and make export function for it
  13. slot not change if (self.getSlotInfo[4]) then print('move') invMoveSlots(draginv, dragslot, self, self.getSlotInfo[4]) end nothing out
  14. bad usage @ addEventHandler onClientRender with this function is already handled
  15. function Inventory:constructor(type, slots, startX, startY, iconSize, padding, isOpen, color) self.type = type or 'player' self.items = {} self.slots = slots or DEFAULT_Slots self.startX = startX or 0 self.startY = startY or 0 self.iconSize = iconSize or DEFAULT_iconSize self.padding = padding or DEFAULT_padding self.isOpen = isOpen self.color = color or DEFAULT_Color self.fDraw = bind(self.draw, self) self.fDrag = bind(self.drag, self) self.fSlot = bind(self.drawSlot, self) if self.isOpen then self:registerEvent("onClientRender", root, self.fDraw) self:registerEvent("onClientClick", root, self.fDrag) end end function Inventory:drawSlot (slot,count) local mousePosition = Vector2(getCursorPosition()) self.mouseX = (mousePosition.x * screen.x) - (self.iconSize / 2) self.mouseY = (mousePosition.y * screen.y) - (self.iconSize / 2) if not self.getSlotInfo[4] then return end dxDrawImage(self.mouseX,self.mouseY,self.iconSize,self.iconSize,"image/items/"..tonumber(self.items[self.getSlotInfo[4]][1])..".png") local countWidht = dxGetTextWidth(self.items[self.getSlotInfo[4]][2],1,"default-bold") dxDrawText(self.items[self.getSlotInfo[4]][2] ,(self.mouseX + (self.iconSize)) - countWidht,(self.mouseY + (self.iconSize - 20) ),0,0,tocolor(255,255,255),1,"default-bold",'left','top',false,false,true) dxDrawRectangle(self.mouseX,self.mouseY,self.iconSize,self.iconSize,tocolor(10,10,10,50)) end
×
×
  • Create New...