Jump to content

SoManyTears

Members
  • Posts

    35
  • Joined

  • Last visited

Posts posted by SoManyTears

  1. Because the codes are client-sided, the players cannot see each other's animation.Which event or function should I use on the server side for the players to see each other's animation? I really need help.

     

    local animTable = {
    
    	ifp = {},
    
    	anims = {
    		"abseil",
    		"ARRESTgun",
    		"ATM",
    		"swat_run",
    		"Swim_Tread",
    		"Tap_hand",
    		"Tap_handP",
    		"turn_180",
    		"Turn_L",
    		"Turn_R",
    		"WEAPON_crouch",
    		"XPRESSscratch"
    	}
    
    }
    
    addEventHandler("onClientResourceStart", resourceRoot,
    function ()
    
    		animTable.ifp["block"] = "ped"
    		animTable.ifp["ifp"] = engineLoadIFP("ped.ifp", animTable.ifp["block"])
    
    		for _, v in ipairs(animTable.anims) do
    			engineReplaceAnimation(localPlayer, "ped", v, animTable.ifp["block"], v)
    		end
    
    	end
    )

     

  2. these codes I wrote do drop fps every 10 seconds.How can I use the setlementCollidableWith function properly? please help friends.

     

    setTimer (function()
    for i,peds in ipairs (getElementsByType ("ped")) do
    for i,players in ipairs (getElementsByType ("player")) do
    setElementCollidableWith (peds,players,false)
    end
    for i,vehicles in ipairs (getElementsByType ("vehicle")) do
    setElementCollidableWith (peds,vehicles,false)
    end
    for i,objects in ipairs (getElementsByType ("object")) do
    setElementCollidableWith (peds,objects,false)
    end
    end
    end,10000,0)

     

  3. hi guys 

    Can you tell me why I got "warning" from these little codes?

    warning : Expected numbers,got non-convertable string.This warning may be an error in future versions.

     

    function showSpecificSlotWindow( slotid )
        local slotname = getVehicleUpgradeSlotName( slotid )
        if type( slotid ) == 'string' then
            slotname = slotid
        end
        local upgrades = getVehicleCompatibleUpgrades( moddingVeh )
        if not hideSubToo then
            guiSetText( upgradeGUI.wnd, slotname )
            showNewSub = false 
        else
            addEventHandler( "onClientRender", getRootElement(), contractSubWindow )
        end
        layoutButtons( slotname )
    end

     

  4. thanks for helping.I put a ped of 181 id on my local server right now and his skin changes with your codes friend.only those with the "seals" group should change their skin.I left the seals group and I can still use this skin.really ı am stuck on it. :/

  5. Hello friends,

    I checked forum topics for how to make  private group skins but  creating private group's skins topics are always unfinished.I'm just trying a simple way.The skin of the "SEALS" group should change when I start the resource.So I used a very simple code, but it had no effect.What can I do about it?Can someone help me ? thanks.

     

    function ReplaceSkin(player) 
        if (player and isElement(player) and getElementType(player)) == "player" then 
    		if getElementData(player,'Group') == 'Seals' then
            txd = engineLoadTXD ( "SL.txd" ) 
            engineImportTXD ( txd, 181) 
            end 
        end 
    end   
    addEventHandler("onClientResourceStart",resourceRoot, ReplaceSkin) 

     

  6. I want this sound to play only in the cities that are there.But even when I enter las venturas or los santos, the sound does not stop.can someone help me ?

    cities = {
    ["Bone County"] = true,
    ["Red County"] = true,
    ["Tierra Robada"] = true,
    ["Flint County"] = true,
    ["Whetstone"] = true,
    
    }
    
    
    function change_weather()
    	local x,y,z = getElementPosition(localPlayer)
    	local city = getZoneName(x,y,z, true)
    	if cities[city] then
    local sound = playSound("ambiance.mp3",true)
    else
    stopSound (sound)
    end
    end
    setTimer(change_weather, 1000, 1)

     

  7. hi guys,

    All of my codes are working,except removeEventHandler.What should ı do to remove the video on screen ? I'am really stuck on it.thanks for helps.

    function getB()
    loadBrowserURL(source, "https://www.youtube.com/")
    end
    
    
    addEventHandler("onClientGUIClick",root,
      function ()
    local browser = guiCreateBrowser(0, 0, 1, 300, false, false, true, bbas)
    local theBrowser = guiGetBrowser(browser)
    if source == youbutton then
    addEventHandler("onClientBrowserCreated", theBrowser,getB)
    guiSetEnabled ( youbutton, false )
    guiSetEnabled ( googlebutton, false )
    elseif source == stopbutton then
    removeEventHandler("onClientBrowserCreated", theBrowser,getB)
    guiSetEnabled ( youbutton, true )
    guiSetEnabled ( googlebutton,true)
    
    end
    end)

     

  8. Hello MTA World,

    I prepared something so that the wanted level can be seen on the player's head.but with these codes, I have to have a wanted level to see the text on the head of the player.but I don't want this.I want everyone to see whoever has a wanted level.so what's wrong here?

     

    addEventHandler( "onClientRender",root,
       function( ) 
          local px, py, pz, tx, ty, tz, dist
             px, py, pz = getCameraMatrix( )
    	     for k, player in pairs(getElementsByType("player",root, true)) do
             if(player ~= localPlayer) then
             local level = getPlayerWantedLevel ( player ) 
               if ( level > 0 ) then 
               tx, ty, tz = getElementPosition( player )
               dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 )
               if dist < 30.0 then
                  if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then
                     local sx, sy, sz = getPedBonePosition( player, 6 )
                     local x,y = getScreenFromWorldPosition( sx, sy, sz +0.7 )
                     if (x) then
    	           dxDrawText( "WANTED ["..level.."]", x-34, y+1, x+1, y+1, tocolor(0,0,0), 0.85 + ( 15 - dist ) * 0.030, "default-bold" )
                   dxDrawText( "WANTED ["..level.."]", x-35, y, x, y, tocolor(250,250,0), 0.85 + ( 15 - dist ) * 0.030, "default-bold" )
                     end
                  end
               end
             end
          end
       end
       end
    )

     

     

  9. then I explain the logic in me.I created a simple wanted level save with SetAccountData.I'm really new to Lua and couldn't do any other save system.ı did it :

    function onQuit() 
        local acc = getPlayerAccount(source) 
        if not isGuestAccount(acc) then 
            local wantedLevel = getPlayerWantedLevel (source) 
            setAccountData(acc, "wlevel", wantedLevel)		
        end 
    end 
    addEventHandler("onPlayerQuit", getRootElement(), onQuit) 
      
    function onLogin(_, acc) 
        local acc = getPlayerAccount(source)
        local wantedLevel = getAccountData(acc, "wlevel") 
        setTimer (setPlayerWantedLevel,500,1,source,wantedLevel)	
    end 
    addEventHandler("onPlayerLogin", getRootElement(), onLogin)
    and I created a logic.If this player has a star, I wrote a code to teleport him to jail.and I didnt write codes for every star, because I don't know how to make a table right now.Anyway I can edit this in the future.these are all the codes i have and i can't get results.Maybe it is easy for you but I wrote something as much as I know about Lua and it is negative ...
  10. it works when I use this event as onPlayerWasted.but the player does not teleport while login.am i using a wrong event?

    local warps = {
    { 2,2577.3100585938, -1329.7434082031, 1058.2553710938 },
    { 2,2573.6740722656, -1353.0935058594, 1058.2553710938 },
    { 2,2581.5959472656, -1343.3308105469, 1054.0562744141 }
    } 
    
    addEventHandler( "onPlayerLogin", getRootElement( ),
    function()
    local rnd = math.random( 1, #warps ) 
     local level = getPlayerWantedLevel ( source )
     if ( level == 1 ) then 
    setPedWeaponSlot ( source, 0 )
    fadeCamera(source,false, 1.0)
    setTimer(fadeCamera, 1000, 1,source,true)
    setTimer ( setElementInterior, 1000, 1, source, warps[rnd][1], warps[rnd][2], warps[rnd][3], warps[rnd][4], warps[rnd][5], warps[rnd][6], warps[rnd][7], warps[rnd][8] )
    triggerClientEvent(source, "jailTime1", source)
    
            setTimer(function(freeman)
                    if isElement(freeman) then
    				fadeCamera(freeman,false, 1.0)
    setTimer(fadeCamera, 1000, 1,freeman,true)
    setTimer (setElementPosition, 1000, 1, freeman, 1803.2666015625, -1575.6591796875, 13.408905029297 )  
    setElementInterior ( freeman, 0 )
    setPlayerWantedLevel ( freeman, 0 )
    				end     
            end,1000*20,1,source)
    	end
    	end
    )

     

  11. ı wrote something.everything works good.When the player goes to jail for the second time, time comes down and doesn't work.we can remove the jail time text with removeEventHandler when the player gets out of jail, but countdown is still working.and when the player goes to jail for the second time, a bug occurs in countdown.How can I restart the time as the player goes back to prison? I'm really stuck.can you help me please? thanks.

    local start = getTickCount()
    local countDown = 20
    function render()
        local now = getTickCount()
        if now-start > 1000 then
            countDown = countDown-1
            start = getTickCount()
            if countDown < 1 then 
    removeEventHandler("onClientRender",root,render) 
            end
        end
    end 
    
    function convertTime ( time ) 
        local min = math.floor ( time / 60 ) 
        local sec = ( time %60 )
        return string.format("%02d:%02d", min, sec) 
    end 
    
    
    addEvent ( "jailTime1", true )
    addEventHandler ( "jailTime1", root,
    	function ( )
    	addEventHandler("onClientRender",root,render) 
    	addEventHandler("onClientRender",root,jailText)
    	       render()
    		setTimer(function()
    			removeEventHandler("onClientRender",root,jailText)
    		end, 20000, 1)
    	end
    )
    	
    local screenW, screenH = guiGetScreenSize()
    local refx,refy = 1920,1080
    
    function jailText()
         dxDrawText("Time out of jail: "..convertTime(countDown).."",screenW*((refx/2+2)/refx),screenH*((refy/2+54)/refy),_,_, tocolor(0,0,0), screenH*(1.7/refy), "bankgothic", "center", "center", false, true, false, true, false)
    	 dxDrawText("Time out of jail: "..convertTime(countDown).."",screenW*((refx/2)/refx),screenH*((refy/2+55)/refy),_,_, tocolor(200,200,200), screenH*(1.7/refy), "bankgothic", "center", "center", false, true, false, true, false)
         dxDrawText("Time out of jail: "..convertTime(countDown).."",screenW*((refx/2+2)/refx),screenH*((refy/2+94+2)/refy),_,_, tocolor(0,0,0), screenH*(0.9/refy), "bankgothic", "center", "center", false, true, false, true, false)
    	 dxDrawText("Time out of jail: "..convertTime(countDown).."",screenW*((refx/2)/refx),screenH*((refy/2+95)/refy),_,_, tocolor(200,200,200), screenH*(0.9/refy), "bankgothic", "center", "center", false, true, false, true, false)
    end

     

×
×
  • Create New...