Jump to content

darhal

Members
  • Posts

    582
  • Joined

  • Last visited

Everything posted by darhal

  1. darhal

    Help me!

    addEventHandler("onClientResourceStart", resourceRoot, function() helpmemo = guiCreateMemo(407, 209, 585, 475, "", false) end ) function drawDx() dxDrawRectangle(63, 143, 967, 577, tocolor(9, 9, 9, 216), false) dxDrawRectangle(85, 494, 250, 63, tocolor(9, 9, 9, 242), false) dxDrawText("Darhal Pro <3", 85, 493, 335, 557, tocolor(255, 255, 255, 255), 3.00, "default", "left", "top", false, false, false, false, false) end function onClick(x, y, absX, absY) if isCursorWithin(85, 493, 335, 557) then -- width , height are width height of dx draw (text / rectangle) function rules () rulestxt = fileOpen("Rules.txt", true) rulestxt1 = fileRead(rulestxt, 50000) guiSetText(helpmemo, rulestxt1) end addEventHandler("onClientGUIClick", Rules, rules) end end addEventHandler("onClientClick", root, onClick) function isCursorWithin(x, y, width, height) if(not isCursorShowing()) then return false; end local sx, sy = guiGetScreenSize(); local cx, cy = getCursorPosition(); local cx, cy = (cx*sx), (cy*sy); if(cx >= x and cx <= x + width) and (cy >= y and cy <= y + height) then return true; else return false; end end function open() if (guiGetVisible (helpmemo) == false) then guiSetVisible(helpmemo, true) showCursor(true) --guiSetPosition(helpmemo,x,y,false) centerWindow(helpmemo) addEventHandler("onClientRender", root,drawDx) elseif (guiGetVisible (helpmemo) == true) then guiSetVisible(helpmemo, false) showCursor(false) removeEventHandler("onClientRender", root,drawDx) end end bindKey ("F1", "down", open)
  2. I create it from 0 please stop spamming this PS: you are not scripter
  3. Your object table i delete it it s sucks and i also kicked you from your duty so leave in peace
  4. the walls textures sometimes appear like this : http://imgur.com/tcw9nYi local myshader = dxCreateShader("material/effect.fx") local mytexture = dxCreateTexture(texPath, "dxt3") dxSetShaderValue( myshader,"gTexture", mytexture) engineApplyShaderToWorldTexture( myshader, getObjectTextureName(objectInEdit), createdObject ) this my code nothing special the problem is in dxSetShaderValue the 3 argument is bad argument P.S: this work sometimes and break othertimes
  5. function onClick(x, y, absX, absY) if isCursorWithin(absX, absY, width, height) then -- width , height are width height of dx draw (text / rectangle) -- do some codde end end addEventHandler("onClientClick", root, onClick) function isCursorWithin(x, y, width, height) if(not isCursorShowing()) then return false; end local sx, sy = guiGetScreenSize(); local cx, cy = getCursorPosition(); local cx, cy = (cx*sx), (cy*sy); if(cx >= x and cx <= x + width) and (cy >= y and cy <= y + height) then return true; else return false; end end
  6. viewtopic.php?f=108&t=89443
  7. Hello all ! Introduction This script allows server players to buy building area that they can use to make their own house/base/town or evean city ! this script is easy to use and it also use textures for walls or for other objects also ! NOTE : this script is made 100% by me Script Features 1# You can make zones ingame without adding any line or any scripting and it can be easy done (only managers can do it) 2# Full object control (all movement + all rotations) (only managers or area owner or area editors can do it) 3# GUI for deleteing/selling/edtting/copying object (only managers or area owner or area editors can do it) 4# GUI for objects shop (also support textures) /shop to access shop 5# GUI for buying/selling/editing area /zone to access it 6# Moving doors/gates (also support rotation) 7# GUI for doors/gates management (only managers / zone owner / zone editors can access it) (also you can link it with your own group system) 8# Areas limits are drawn with blue lines so players will not let objects get out 9# /obsave that will save all your area objetcs 10# command /areacreator for managers to enter area creation mod 11# You can simply add new objects with new class or with already exsiting class 12# SQL saving so players area data will never been lost Screenshot All script screenshot can be found here : http://imgur.com/a/uwSSb Viedos Comming soon Special thanks Special thanks to : IIYAMA : helping little bit in object control This script if for sell pm me for more info ! Thanks for reading
  8. OMG ! WOW ! thanks IIYAMA! you are amzaing everytime I stuck in something you help me thx bro <3
  9. darhal

    Question!!??

    Or you can simply save the password using setAccountData on player register abd everytime the player login then you will have the player pass
  10. Well I m making something like map editor it mean u can control objects via keys wich are arrow up arrow left arrow rightt etc... the pictures show how controles work fine for same camera sides and for some camera postion/rotation the element move to the wrong direction I want to fix this
  11. Hello all, This problem is hard to explain by the way I will post images it will explain better then words : here is my code : http://imgur.com/2p7DggD,L4yKIok,SH8KZ3f#0 -- work fine here http://imgur.com/2p7DggD,L4yKIok,SH8KZ3f#1 --this how I want it when the camera change poistion or rotation http://imgur.com/2p7DggD,L4yKIok,SH8KZ3f#2 -- this how it work in real --------------------------------- -- Utility functions --------------------------------- function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end ------------------------------------ -- End of Utility functions ------------------------------------ function controlObject() if not objectInEditor then return end if pressedButton == "num_8" then x,y,z = getMatrixForward(objectInEditor,0,moveSpeed,0) setElementPosition(objectInEditor, x, y, z) elseif pressedButton == "num_2" then x,y,z = getPositionFromElementOffset(objectInEditor,0,0-moveSpeed,0) setElementPosition(objectInEditor, x, y, z) elseif pressedButton == "num_4" then x,y,z = getPositionFromElementOffset(objectInEditor,moveSpeed,0,0) setElementPosition(objectInEditor, x, y, z) elseif pressedButton == "num_6" then x,y,z = getPositionFromElementOffset(objectInEditor,0-moveSpeed,0,0) setElementPosition(objectInEditor, x, y, z) elseif pressedButton == "pgup" then x,y,z = getPositionFromElementOffset(objectInEditor,0,0, moveSpeed) setElementPosition(objectInEditor, x, y, z) elseif pressedButton == "pgdn" then x,y,z = getPositionFromElementOffset(objectInEditor,0,0, 0-moveSpeed) setElementPosition(objectInEditor, x, y, z) end end addEventHandler("onClientRender", root, controlObject) in map editor this problem is already solved but I can t find the function that find the position Please help me guys this made me confused I already checked the forum evean the old posts and I cant find solution thx
  12. actually, I remove the timer and the functions the lag has been reduced thx a lot mate
  13. Thanks All of you help me a lot specially IIYAMA and walid , but if I had a code like bleow how to calculate timeSlice and so on this code is lagging ingame everytime I switch the mouse : function switchItemsUsingMouseWheel(btn, bool) normalSizeX = correctResolutinX(128/5) normalSizeY = correctResolutinY(114/5) startTime = getTickCount() if isCursorShowing ( ) then return end if btn == "mouse_wheel_up" then lastWheelI = lastWheelI + 1 for k, val in pairs(currentFastUseItems) do if lastWheelI == val.boxidfu and lastWheelI <= 6 then if lastKCursorWheel then local sx, sy = unpack(split(currentFastUseItems[lastKCursorWheel].size, ",")) local x, y = unpack(split(currentFastUseItems[lastKCursorWheel].pos1fu, ",")) currentFastUseItems[lastKCursorWheel].size=tostring(tonumber(sx/1.5)..", "..tonumber(sy/1.5)) currentFastUseItems[lastKCursorWheel].pos1fu=tostring(tonumber(x+8.3)..", "..tonumber(y+8.3)) end if putInUseTimer and isTimer(putInUseTimer) then killTimer(putInUseTimer) end local sx, sy = unpack(split(val.size, ",")) local x, y = unpack(split(val.pos1fu, ",")) currentFastUseItems[k].size=tostring(tonumber(sx*1.5)..", "..tonumber(sy*1.5)) currentFastUseItems[k].pos1fu=tostring(tonumber(x-8.3)..", "..tonumber(y-8.3)) lastKCursorWheel = k numberOfReapeats = numberOfReapeats + 1 putInUseTimer = setTimer(function (id, k, wheelI) for i, v in pairs(currentUseItems) do if v.item == id then table.remove(currentUseItems, i) local sx, sy = unpack(split(currentFastUseItems[lastKCursorWheel].size, ",")) local x, y = unpack(split(currentFastUseItems[lastKCursorWheel].pos1fu, ",")) currentFastUseItems[lastKCursorWheel].size=tostring(tonumber(sx/1.5)..", "..tonumber(sy/1.5)) currentFastUseItems[lastKCursorWheel].pos1fu=tostring(tonumber(x+8.3)..", "..tonumber(y+8.3)) lastKCursorWheel = nil triggerServerEvent( "onClientPlayerUseItem", localPlayer, id, 1) triggerEvent( "onClientPlayerUseItem", localPlayer, id, 1 ) return end end lastWheelI = wheelI local sx, sy = unpack(split(currentFastUseItems[lastKCursorWheel].size, ",")) local x, y = unpack(split(currentFastUseItems[lastKCursorWheel].pos1fu, ",")) table.insert(currentUseItems, {item=id, boxId=wheelI}) triggerServerEvent( "onClientPlayerUseItem", localPlayer, id, 1) triggerEvent( "onClientPlayerUseItem", localPlayer, id, 1 ) currentFastUseItems[k].size=tostring(tonumber(sx/1.5)..", "..tonumber(sy/1.5)) currentFastUseItems[k].pos1fu=tostring(tonumber(x+8.3)..", "..tonumber(y+8.3)) lastKCursorWheel = nil end, switchTime, 1, val.idfu, lastKCursorWheel, lastWheelI) break end if (lastWheelI >= 7) or (numberOfReapeats > #currentFastUseItems) then lastWheelI = 0 numberOfReapeats = 0 --[[for i, v in pairs(currentUseItems) do table.remove(currentUseItems, i) local sx, sy = unpack(split(currentFastUseItems[lastKCursorWheel].size, ",")) local x, y = unpack(split(currentFastUseItems[lastKCursorWheel].pos1fu, ",")) currentFastUseItems[lastKCursorWheel].size=tostring(tonumber(sx/1.5)..", "..tonumber(sy/1.5)) currentFastUseItems[lastKCursorWheel].pos1fu=tostring(tonumber(x+8.3)..", "..tonumber(y+8.3)) lastKCursorWheel = nil triggerServerEvent( "onClientPlayerUseItem", localPlayer, v.item, 1) triggerEvent( "onClientPlayerUseItem", localPlayer, v.item, 1 ) end--]] if putInUseTimer and isTimer(putInUseTimer) then killTimer(putInUseTimer) end if lastKCursorWheel then local sx, sy = unpack(split(currentFastUseItems[lastKCursorWheel].size, ",")) local x, y = unpack(split(currentFastUseItems[lastKCursorWheel].pos1fu, ",")) currentFastUseItems[lastKCursorWheel].size=tostring(tonumber(sx/1.5)..", "..tonumber(sy/1.5)) currentFastUseItems[lastKCursorWheel].pos1fu=tostring(tonumber(x+8.3)..", "..tonumber(y+8.3)) lastKCursorWheel = nil end end end elseif btn == "mouse_wheel_down" then lastWheelI = lastWheelI - 1 for k, val in pairs(currentFastUseItems) do if lastWheelI == val.boxidfu and lastWheelI >= 1 then if lastKCursorWheel then local sx, sy = unpack(split(currentFastUseItems[lastKCursorWheel].size, ",")) local x, y = unpack(split(currentFastUseItems[lastKCursorWheel].pos1fu, ",")) currentFastUseItems[lastKCursorWheel].size=tostring(tonumber(sx/1.5)..", "..tonumber(sy/1.5)) currentFastUseItems[lastKCursorWheel].pos1fu=tostring(tonumber(x+8.3)..", "..tonumber(y+8.3)) end if putInUseTimer and isTimer(putInUseTimer) then killTimer(putInUseTimer) end local sx, sy = unpack(split(val.size, ",")) local x, y = unpack(split(val.pos1fu, ",")) currentFastUseItems[k].size=tostring(tonumber(sx*1.5)..", "..tonumber(sy*1.5)) currentFastUseItems[k].pos1fu=tostring(tonumber(x-8.3)..", "..tonumber(y-8.3)) lastKCursorWheel = k numberOfReapeats = numberOfReapeats + 1 putInUseTimer = setTimer(function (id, k, wheelI) for i, v in pairs(currentUseItems) do if v.item == id then table.remove(currentUseItems, i) local sx, sy = unpack(split(currentFastUseItems[lastKCursorWheel].size, ",")) local x, y = unpack(split(currentFastUseItems[lastKCursorWheel].pos1fu, ",")) currentFastUseItems[lastKCursorWheel].size=tostring(tonumber(sx/1.5)..", "..tonumber(sy/1.5)) currentFastUseItems[lastKCursorWheel].pos1fu=tostring(tonumber(x+8.3)..", "..tonumber(y+8.3)) lastKCursorWheel = nil triggerServerEvent( "onClientPlayerUseItem", localPlayer, v.id, 1) triggerEvent( "onClientPlayerUseItem", localPlayer, v.id, 1 ) return end end lastWheelI = wheelI local sx, sy = unpack(split(currentFastUseItems[lastKCursorWheel].size, ",")) local x, y = unpack(split(currentFastUseItems[lastKCursorWheel].pos1fu, ",")) table.insert(currentUseItems, {item=id, boxId=wheelI}) triggerServerEvent( "onClientPlayerUseItem", localPlayer, id, 1) triggerEvent( "onClientPlayerUseItem", localPlayer, id, 1 ) currentFastUseItems[k].size=tostring(tonumber(sx/1.5)..", "..tonumber(sy/1.5)) currentFastUseItems[k].pos1fu=tostring(tonumber(x+8.3)..", "..tonumber(y+8.3)) lastKCursorWheel = nil end, switchTime, 1, val.idfu, lastKCursorWheel, lastWheelI) break end if (lastWheelI <= 0) or (numberOfReapeats > #currentFastUseItems) then lastWheelI = 7 numberOfReapeats = 0 --[[for i, v in pairs(currentUseItems) do table.remove(currentUseItems, i) local sx, sy = unpack(split(currentFastUseItems[lastKCursorWheel].size, ",")) local x, y = unpack(split(currentFastUseItems[lastKCursorWheel].pos1fu, ",")) currentFastUseItems[lastKCursorWheel].size=tostring(tonumber(sx/1.5)..", "..tonumber(sy/1.5)) currentFastUseItems[lastKCursorWheel].pos1fu=tostring(tonumber(x+8.3)..", "..tonumber(y+8.3)) lastKCursorWheel = nil triggerServerEvent( "onClientPlayerUseItem", localPlayer, v.item, 1) triggerEvent( "onClientPlayerUseItem", localPlayer, v.item, 1 ) end--]] if putInUseTimer and isTimer(putInUseTimer) then killTimer(putInUseTimer) end if lastKCursorWheel then local sx, sy = unpack(split(currentFastUseItems[lastKCursorWheel].size, ",")) local x, y = unpack(split(currentFastUseItems[lastKCursorWheel].pos1fu, ",")) currentFastUseItems[lastKCursorWheel].size=tostring(tonumber(sx/1.5)..", "..tonumber(sy/1.5)) currentFastUseItems[lastKCursorWheel].pos1fu=tostring(tonumber(x+8.3)..", "..tonumber(y+8.3)) lastKCursorWheel = nil end end end end end addEventHandler("onClientKey", root, switchItemsUsingMouseWheel)
  14. Th ilyama but what about a loop inside function attached to onClientRender event ?
  15. Thx guys i fix it by my self
  16. try use this function https://wiki.multitheftauto.com/wiki/Se ... entVisible
  17. good one but it will center window ? I dont need to center windows
×
×
  • Create New...