Jump to content

Mahlukat

Members
  • Posts

    37
  • Joined

  • Last visited

Posts posted by Mahlukat

  1. oyunun standart paintjoblarından bahsediyorsan, onlar değişmiyor diye biliyorum ama yinede istersen forumda ingilizce bi arat

    çözüm yolu bulamazsan shader ile özel kaplama sistemi yapabilirsin. DD sunucularının paketlerinde vardır araç skin olayları. Onlara göz atabilrisin

  2. function pedHealthbar()
    	local target = getPedTarget(localPlayer) -- get localPlayers's target
    	for k, peds in pairs(getElementsByType("ped", root, true)) do
    		if getElementData(peds, "type") == "Secur.ped" then
    			if ( isElement(target) and target == peds ) then
    				local recBar = dxDrawRectangle(sX+420, sY-600,150, 12, tocolor(0, 0, 0, 200))
    				local health = getElementHealth(peds)
    				local lineLength = 144 * (health / 100)
    				local healthBar = dxDrawRectangle(sX+423, sY-597,lineLength, 7, tocolor(46, 139, 87, 210))
    				dxDrawText("Security", sX+460, sY-627, sX+155, sY-19-(32*7), tocolor(0,0,0, 255), 1.6, font, "left", "top")
    				dxDrawText("Security", sX+461.5, sY-625.5, sX+153.5, sY-17.5-(32*7), tocolor(255, 255, 255, 255), 1.6, font, "left", "top")
    			end           
    		end
    	end
    end	
    addEventHandler("onClientRender", root, pedHealthbar)

     

  3. speed run from Slothman's superpowers script;

    local obj = {} 
      
    function WaterWalk() 
    if obj[localPlayer] then 
    local x,y,_ = getElementPosition(localPlayer) 
    setElementPosition(obj[localPlayer],x,y,-.6) 
    end 
    end 
    
      
    function WaterOn() 
    local px,py,_ = getElementPosition(localPlayer) 
    obj[localPlayer] = createObject(3095,px,py,-2) 
    setElementAlpha(obj[localPlayer],0)
    setElementDimension(obj[localPlayer], getElementDimension(localPlayer))
    setTimer ( destroyElement, 50, 1, obj[localPlayer])
    end 
    
    function getPointFromDistanceRotation(x, y, dist, angle)
    
        local a = math.rad(90 - angle);
     
        local dx = math.cos(a) * dist;
        local dy = math.sin(a) * dist;
     
        return x+dx, y+dy;
     
    end
    
    
    speeding = 0
    resting = 0
    function speedforce( key, keyState, obj )
    	if keyState == "down" then
    		if speeding == 0 then
    			if isTimer(buildup) then
    				resetTimer(buildup)
    			else
    				buildup = setTimer ( startSpeeding, 1000, 1)
    			end
    		end
    	else
    		if isTimer(buildup) then
    			killTimer(buildup)
    			buildup = nil
    		end
    		if speeding == 1 then
    			outofspeed()
    		end
    	end
    end
    bindKey ( "sprint", "both", speedforce )
    
    
    function startSpeeding()
    	if resting == 0 then
    		speeding = 1
    		buildup = nil
    		-- endRun = setTimer( outofspeed, 9999999999, 0 )
    		addEventHandler("onClientRender",getRootElement(), speedupplayer )
    		addEventHandler("onClientRender",getRootElement(), WaterOn )
    		addEventHandler ("onClientRender",getRootElement(),WaterWalk) 
    		-- triggerServerEvent ("onSpeedChange", getLocalPlayer(), "fast")
    		-- triggerEvent( "switchRadialBlur", root, true )
    	end
    end
    
    function outofspeed()
    	speeding = 0
    	if isTimer(endRun) then
    		killTimer(endRun)
    		endRun = nil
    	end
    	resting = 1
    	doneresting = setTimer( resetspeedpower, 50, 1 )
    	removeEventHandler("onClientRender",getRootElement(), speedupplayer )
    	removeEventHandler("onClientRender",getRootElement(), WaterOn )
    	removeEventHandler ("onClientRender",getRootElement(),WaterWalk) 
    	-- triggerServerEvent ("onSpeedChange", getLocalPlayer(), "normal")
    	-- triggerEvent( "switchRadialBlur", root, false )
    end
    
    
    function resetspeedpower()
    	resting = 0
    	if getControlState("sprint") == true then
    		speedforce( "sprint", "down" )
    	end
    end
    
    function speedupplayer()
    	if getControlState("sprint") == true then
    		if getControlState("forwards") == true or getControlState("backwards") == true or getControlState("left") == true or getControlState("right") == true then
    			-- setPedWeaponSlot(getLocalPlayer(), 0)
    			local x, y, z = getElementPosition(getLocalPlayer())
    			local prot = getPedRotation(getLocalPlayer())
    			local nx, ny = getPointFromDistanceRotation(x, y, 1, (prot)*-1)
    			local clear = isLineOfSightClear( x, y, z, nx, ny, z, true, true, true, true, true, true, true)
    			if clear == true then
    				local lx, ly = getPointFromDistanceRotation(x, y, 1, (prot-8)*-1)
    				local rx, ry = getPointFromDistanceRotation(x, y, 1, (prot+8)*-1)
    				local clearl = isLineOfSightClear( x, y, z, lx, ly, z, true, true, true, true, true, true, true)
    				local clearr = isLineOfSightClear( x, y, z, rx, ry, z, true, true, true, true, true, true, true)
    				if clearl == true and clearr == true then
    					local task = getPedSimplestTask(getLocalPlayer())
    					if task == "TASK_SIMPLE_PLAYER_ON_FOOT" then
    						local nz = getGroundPosition ( nx, ny, z+1 )
    						if  getDistanceBetweenPoints3D( x, y, z, nx, ny, nz) < 2 then
    							setElementPosition(getLocalPlayer(), nx, ny, nz+1, false)
    						end
    					elseif task == "TASK_SIMPLE_SWIM" then
    						local level = getWaterLevel ( nx, ny, z )
    						if level then
    							if  getDistanceBetweenPoints3D( x, y, z, nx, ny, level) < 2 then
    								local nx2, ny2 = getPointFromDistanceRotation(x, y, 1, (prot)*-1)
    								local clear = isLineOfSightClear( x, y, z, nx2, ny2, z, true, true, true, true, true, true, true)
    								setElementPosition(getLocalPlayer(), nx, ny, level, false)
    							end
    						end
    					end
    				end
    			end
    		end
    	end
    end
    

     

    • Like 1
  4. --client-side
    
    yasaklilar = {
    	--"command",
    	"useitem",
    	"say",
    	...
    }
    
    addEventHandler("onClientKey", root,function(button, press) 
    	local komut = getBinds(button)
    	if komut and press then  
    		if not guiGetInputEnabled() and not isChatBoxInputActive() then  
    			cancelEvent()  
    			outputChatBox("This button has an inappropriate command. To remove: #FFFFFF/unbind #CC0000"..button.." #FFFFFF"..komut, 255,0,0, true)
    		end	
    	end	
    end)
    
    function getBinds(buton)
    	for i,v in pairs(yasaklilar) do
    		local butons = getBoundKeys ( v )
    		if type(butons) ~= "boolean" and butons[buton] then
    			return v
    		end	
    	end
    	return false	
    end

     

    • Like 1
  5. 34 minutes ago, IIYAMA said:

    But for what kind of reason do you want to use a coroutines?

    Thanks you for your answer

    When i call querydb function, its return before dbQuery's callback function

    and i thought maybe querydb function can wait for dbQuery's callback function

    because i have a another function like this;

    function getQueryResult(id)
    	if not queries[id] then return false end
    	return queries[id]
    end	

    I am using exactly like this;

    local id = querydb("SOME DB FUNCS")
    local result = getQueryResult(id)

     

  6. Hey
    i have a export function for dbQuery
    but when i call func, data from database stay late

    I searched the forum and found a few solutions with coroutine

    but I could not :((
    anyone can explain how's work coroutine and what should i do please

    function querydb(str)
    	if str:find("DROP TABLE") then return end
    	local id = getFreeID()
    	local co = nil
    	function verileriAktar(sorgu)
    		coroutine.resume(co, sorgu) 
    	end
    	co = coroutine.create(function() 
    		dbQuery(verileriAktar,connection,str) 
    		local results = coroutine.yield() 
    		local cevap = dbPoll(results,0)
    		queries[id] = cevap 
    		print(id) 
    	end) 
    	coroutine.resume(co)
    	-- should stop here i guess but its not
    	print("cevap: "..id)	
    	return id 
    end
    
    local id = querydb("SOME DB CODES")
    -- cevap: 1
    -- 1

     

  7. can you try this?

    teams = {"Liberation Army", "Imperial Forces"}
    
    function getPos() 
        local x, y ,z = getElementPosition(localPlayer) 
        local pos = tostring(x..", "..y..", "..z) 
        outputChatBox(pos, 255, 100, 100, false) 
        setClipboard(pos) 
    end 
    addCommandHandler("pos", getPos) 
    
    ---- GUI Creation
    addEventHandler("onClientResourceStart", resourceRoot,
        function()
            window = guiCreateWindow(0.57, 0.25, 0.19, 0.37, "Spawn Menu", true)
            guiWindowSetMovable(window, false)
            guiWindowSetSizable(window, false)
            guiSetAlpha(window, 1.00)
            team_gridlist = guiCreateGridList(10, 32, 284, 98, false, window)
            column = guiGridListAddColumn(team_gridlist, "Team", 0.9)
    		for i,teamtext in pairs(teams) do local row = guiGridListAddRow(team_gridlist,teamtext) end
            -- rowA = guiGridListAddRow(team_gridlist)
            -- rowB = guiGridListAddRow(team_gridlist)
            -- guiGridListSetItemText(team_gridlist, 0, 1, "Liberation Front", false, false)
            -- guiGridListSetItemText(team_gridlist, 1, 1, "Imperial Forces", false, false)
            skin_label = guiCreateLabel(58, 248, 71, 15, "Select a skin", false, window)
            skin_btn_next = guiCreateButton(96, 273, 33, 16, ">", false, window)
            skin_btn_previous = guiCreateButton(58, 273, 33, 16, "<", false, window)
            location_gridlist = guiCreateGridList(10, 140, 284, 98, false, window)
            location_col = guiGridListAddColumn(location_gridlist, "Location", 0.9)
            weapon_label = guiCreateLabel(155, 248, 96, 15, "Select a weapon", false, window)
            weapon_btn_next = guiCreateButton(165, 273, 33, 16, ">", false, window)
            weapon_btn_previous = guiCreateButton(204, 273, 33, 16, "<", false, window)    
            spawn_btn = guiCreateButton(114, 299, 67, 24, "Spawn", false, window)
            guiSetVisible(window, false)
        end
    )
    
    ---- GUI functions
    function isGUIVisible(gui)
        return (guiGetVisible(gui) == true)
    end
    
    -- Make the GUI appear on login.
    addEvent("onClientPlayerLoginn", true)
    addEventHandler("onClientPlayerLoginn", root, function()
        if isGUIVisible(window) then
            return
        end
        guiSetVisible(window, true)
    
    -- Set the camera to the desired location.
        setCameraMatrix(-2610.9792480469, 1445.4840087891, 7.1875, -2610.9792480469, 1445.4840087891, 7.1875)
    
    -- Make a ped with default skin (0).
        local ped = createPed(0, -2614.0212402344, 1451.1651611328, 7.1875, 180) 
    end)
    
    -- Team
    addEventHandler("onClientGUIClick", resourceRoot, function()
        if (source == spawn_btn) then
            local team = getSelectedTeam()
            if team then
                triggerServerEvent("setTeam", localPlayer, team)
            end
        end
    end)
    
    function getSelectedTeam()
    	local row, col = guiGridListGetSelectedItem(team_gridlist)
    	if row and col and row ~= -1 and col ~= -1 then
    		return guiGridListGetItemText(team_gridlist, row, col)
    	else
    		return false
    	end
    end
    
    local LALocations = {"LA Test 1", "LA Test 2", "LA Test 3"}
    local IFLocations = {"IF Test 1", "IF Test 2", "IF Test 3"}
    -- Location (according to the team)
    addEventHandler("onClientGUIClick", resourceRoot, function(button, state)
    	if source == team_gridlist then
    		local team = getSelectedTeam()
    		if team then
    			guiGridListClear(location_gridlist)
    			if team == "Liberation Army" then
    				outputChatBox("Test successful", 100, 255, 100)
    				for _, locations_LA in ipairs(LALocations) do
    					local location_row_LA = guiGridListAddRow(location_gridlist,locations_LA)
    					--guiGridListSetItemText(location_gridlist, location_row_LA, location_col, locations_LA, false, false)
    				end
    			elseif team == "Imperial Forces" then
    				for _, locations_IF in ipairs(IFLocations) do
    					local location_row_IF = guiGridListAddRow(location_gridlist,locations_IF)
    					--guiGridListSetItemText(location_gridlist, location_row_IF, location_col, locations_IF, false, false)
    				end
    			end
    		end	
    	end	
    end)
    
    -- Skin
    -- Weapon

     

  8. function getPlayerFromPhoneNumber(phoneNumber)
    	local phoneNumber = tonumber(phoneNumber)
    	for i,v in pairs(getElementsByType("player")) do
    		local playerNumber = tonumber(getElementData(v,"YOUR_PHONE_NUMBER_DATA_HERE"))
    		if playerNumber and playerNumber == phoneNumber then
    			return v
    		end
    	end
    	return false
    end

    try this

     

    • Thanks 1
  9. carshopWindow = guiCreateWindow(0.01, 0.22, 0.39, 0.58, "CarShop", true)
    guiSetVisible(carshopWindow, false)
    guiSetAlpha(carshopWindow, 1)
    guiWindowSetSizable(carshopWindow, false)
    carGridList = guiCreateGridList(0.02, 0.06, 0.47, 0.80, true, carshopWindow)
    guiGridListSetSelectionMode(carGridList, 0)
    carColumn = guiGridListAddColumn(carGridList, "Car", 0.4)
    costColumn = guiGridListAddColumn(carGridList, "$", 0.4)
    
    
    local cars = {
    	["Level1"] = { ------------------TEXT TEX
    		{481, 50000},-- BMX  
    		{509, 50000},-- bike
    		{529, 55000},-- Willard
    		{492, 60000},-- Gleenwood
    	},  
    	["Level2"] = { ------------------TEXT TEX
    		{421, 60000},-- Whasington 
    		{466, 65000},-- Glendale
    		{422, 65000},-- Bobcat
    		{600, 70000},-- Picador
    		{578, 70000},-- DFT-30
    		{582, 70000},-- Newsvan
    		{410, 71000},-- Manana
    		{489, 75000},-- Rancher  
    		{474, 75000},-- Hermes
    		{491, 75000}, -- Virgo
    	},
    }  
    
    function setTexts()
    	for i,v in pairs(cars) do
    		local row = guiGridListAddRow(carGridList)
    		guiGridListSetItemText(carGridList,row,1,i,true,false)
    		for i,k in pairs(v) do
    			local model,price = unpack(k)
    			local row2 = guiGridListAddRow(carGridList)
    			guiGridListSetItemText(carGridList,row2,1,getVehicleNameFromModel(model),false,false)
    			guiGridListSetItemText(carGridList,row2,2,price,false,false)
    		end
    	end
    end	
    setTexts()

     

  10. 4 hours ago, _Evo_ said:

    did you tried to use onClientPlayerQuit ?

     

    
    https://wiki.multitheftauto.com/wiki/OnClientPlayerQuit

     

    Yea, i tried but wiki said;
    This event is triggered when a remote player quits the game or leaves the server. It will not get triggered on the source player's client. (Use onClientResourceStop to save client side data when the local player quits.)

     

    19 minutes ago, xMKHx said:

    try this

    
    -- Client
    function SureKaydet ()
    	triggerServerEvent("Freeroam:SureKaydet", localPlayer, sureVerileri, true)
    	 if sureVerileri[localPlayer] and isTimer(sureVerileri[localPlayer].timer) then 
    		killTimer(sureVerileri[localPlayer].timer) 
    		end
    	end
    addEventHandler( "onClientPlayerQuit", getRootElement(), SureKaydet )
    
    
    -- server
    function SureKaydet (sureVerileri,bosmu)
    outputServerLog("triggered server")
    local hesap = getPlayerAccount(source)
    if isGuestAccount(hesap) then return false end
    outputServerLog("not guest")
    		local sure = 60*10
    		if sureVerileri[source] and sureVerileri[source].sure then
    			sure = sureVerileri[source].sure
    			end
    			exports.Hesaplar:SAD(hesap, "KiralikSure", sure)
    		
    		outputServerLog("saved.")
    		outputServerLog(sure)
    		
    		if bosmu then
    			exports.Hesaplar:SAD(hesap, "KiralikSureBos", true)
    			end
    		end
    		addEvent("Freeroam:SureKaydet", true)
    		addEventHandler("Freeroam:SureKaydet", getRootElement(), SureKaydet)
    			
    

     

    thanks for help but it's still not triggered :((

  11. Hey

    i want to save table in client-side when localPlayer disconnected

    --client
    addEventHandler( "onClientResourceStop", resourceRoot,function()
    
    	triggerServerEvent("Freeroam:SureKaydet", localPlayer, sureVerileri, true)
    	
        if sureVerileri[localPlayer] and isTimer(sureVerileri[localPlayer].timer) then 
    		killTimer(sureVerileri[localPlayer].timer) 
    	end
    end)
    --server
    addEvent("Freeroam:SureKaydet", true)
    addEventHandler("Freeroam:SureKaydet", root, function(sureVerileri,bosmu)
    	outputServerLog("triggered server") -- i can't see this message in console
    	local hesap = getPlayerAccount(source)
    	if not isGuestAccount(hesap) then
    		outputServerLog("not guest")
    		local sure = 60*10
    		if sureVerileri[source] and sureVerileri[source].sure then
    			sure = sureVerileri[source].sure
    		end	
    		exports.Hesaplar:SAD(hesap, "KiralikSure", sure)
    		
    		outputServerLog("saved.")
    		outputServerLog(sure)
    		
    		if bosmu then
    			exports.Hesaplar:SAD(hesap, "KiralikSureBos", true)
    		end	
    	end
    end)

    but event isn't triggered :(( how can ido it?

    -
     

  12. for disable skin changing;

    --server-side
    local yourCol = createColSphere(...)
    
    addEventHandler("onElementModelChange", root, function(oldModel,newModel)
    	if getElementType(source) == "player" then
    		if isElementWithinColShape(source,yourCol) then
    			setTimer(setElementModel,50,1,source,oldModel)
    			outputChatBox("You can't change skin in this place!",source,255,0,0)
    		end	
    	end
    end)

     

  13. function spamEngelle(oyuncu,deger) -- spam engelleme fonksiyon
     if isElement (oyuncu) then -- player check
          local serial = getPlayerSerial(oyuncu)
          if deger == "Mutele" then
              outputChatBox(getPlayerName(oyuncu).."#CC0000 60 #FFFFFFSaniye Susturuldun. #CC0000Sebep: #FFFFFFFlood/Spam", root, 255,255,255,true) 
              setPlayerMuted(oyuncu, true)
              setTimer (spamEngelle, 60000, 1, oyuncu, "Mute Kaldır")
              muteliler[serial] = true
          elseif deger == "Mute Kaldır" then	
              if  isElement (oyuncu) and isPlayerMuted (oyuncu)  then
                  setPlayerMuted ( oyuncu, false )
                  antiSpam[oyuncu] = nil
                  muteliler[serial] = false
                  outputChatBox ("#FFFFFF"..getPlayerName ( oyuncu ).." #66FF00Cezan Bitti.",root, 255, 255, 0,true )
              else
                  antiSpam[oyuncu] = nil
              end
          end	
      end
    end

    try this

  14. You can hide with other gui element like this;

    local backLabel = guiCreateLabel(x,y,w,h, "", relative, parent)
    local list = guiCreateGridList(0,0,w+15,h, false, backLabel)

     

  15. GUIEditor = {
        gridlist = {},
        button = {}
    }
    addEventHandler("onClientResourceStart", resourceRoot,
        function()
            mission = guiCreateWindow(596, 264, 204, 247, "Zombie Mission", false)
    		guiSetVisible(mission,false)	
            guiWindowSetSizable(mission, true)
            GUIEditor.button[1] = guiCreateButton(10, 22, 184, 15, "\"MISSIONS\"", false, mission)
            GUIEditor.button[2] = guiCreateButton(-1, 154, 31, 33, "", false, GUIEditor.button[1])
            GUIEditor.button[3] = guiCreateButton(9, 214, 92, 18, "TAKE", false, mission)
            GUIEditor.button[4] = guiCreateButton(106, 214, 88, 18, "EXIT", false, mission)
            GUIEditor.gridlist[1] = guiCreateGridList(230, 206, 0, 15, false, mission)
            GUIEditor.gridlist[2] = guiCreateGridList(10, 39, 184, 168, false, mission)
            guiGridListAddColumn(GUIEditor.gridlist[2], "Mission", 0.9)
            for i = 1, 9 do
                guiGridListAddRow(GUIEditor.gridlist[2])
            end
            guiGridListSetItemText(GUIEditor.gridlist[2], 0, 1, "Kill 1 boss RED", false, false)
            guiGridListSetItemText(GUIEditor.gridlist[2], 1, 1, "Kill 1 boss yellow", false, false)
            guiGridListSetItemText(GUIEditor.gridlist[2], 2, 1, "Kill 2 boss RED", false, false)
            guiGridListSetItemText(GUIEditor.gridlist[2], 3, 1, "Kill 2 boss yellow", false, false)
            guiGridListSetItemText(GUIEditor.gridlist[2], 4, 1, "Kill 3 boss RED", false, false)
            guiGridListSetItemText(GUIEditor.gridlist[2], 5, 1, "Kill 3 boss yellow", false, false)
            guiGridListSetItemText(GUIEditor.gridlist[2], 6, 1, "Kill 300 zombies", false, false)
            guiGridListSetItemText(GUIEditor.gridlist[2], 7, 1, "Kill 600 zombies", false, false)
            guiGridListSetItemText(GUIEditor.gridlist[2], 8, 1, "Kill 900 zombies", false, false)    
        end
    )
    
    bindKey ("U","down",function()
    	guiSetVisible(mission, not guiGetVisible(mission))
    	showCursor(guiGetVisible(mission))
    end)

     

  16. Hello

    How can i change spray color like this;

    I've tried change color with png like this;

    local shader = dxCreateShader("shader.fx")
    local texture = dxCreateTexture("smoke.png")
    dxSetShaderValue(shader,"Tex0",texture)
    engineApplyShaderToWorldTexture(shader,"smoke")

    its worked without white color and i need white color too

    Anybody can explain me ?

  17. maybe you can like this;

    guiGridListSetItemText (moneysend,row,col,(string.gsub ( getPlayerName(player), '#%x%x%x%x%x%x', '' ) or getPlayerName(player)), false, false)
    guiGridListSetItemData (moneysend,row,col,player)
    
    player = guiGridListGetItemData(moneysend, row, col)
    if isElement(player) then

     

×
×
  • Create New...