Jump to content

Bean666

Members
  • Posts

    732
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Bean666

  1. 6 hours ago, Maruchan said:

    Now???

     

    
    function Seleccion()	 
    		 
    		 fadeCamera(false,0.0)
    		 showChat(false)
    		 for i = 1, 8 do
    		 guiSetVisible(buttons[i],true)	 
    		 end
    		 
    		 local time = getRealTime()
    		 local hour = time.hour
    
    		 if hour >= 6 and hour <= 11 then	 
    		 guiSetVisible(Temprano,true)
    		 
    		 elseif hour >= 12 and hour <= 17 then
    		 guiSetVisible(Tarde,true)		 
    		 
    		 elseif hour >= 18 and hour <= 23 then
    		 guiSetVisible(Noche,true)
    	
    		 elseif hour >= 1 and hour <= 5 then
    		 guiSetVisible(Madrugada,true)
    		 end
    		 showCursor(true)		 
    end
    addEvent("Seleccion",true)
    addEventHandler("Seleccion",getRootElement(),Seleccion)

     

    Do u want a real time or IN-Game time? 

  2. 1 hour ago, Gentlehero said:
    
    how to disable the sound of reloading weapons by default someone help me?
    local removedIDs = { 33, 4, 28, 21, 22, 23, 6, 7, 8, 29, 30, 17, 18, 26,
    27, 52, 53, 5, 0, 1, 2, 12, 14, 15, 16, 11 }
    
    setWorldSoundEnabled ( 5,  true)
    for i, sound in pairs(removedIDs) do
    	setWorldSoundEnabled(5, sound, false)
    end

    All gunsounds / reload sounds are disabled here except for M4 / AK, just remove the other ids if u want, im not sure what id the reload sound there is but yeah you'll find out if you try and edit it yourself.

  3. 39 minutes ago, Wananazo said:

    This script is not working it has an assigned acl group Police and the script should only give permissions to those of that group, but the truth is that everyone can open the panel who can guide me

     

    
    Grupo = { "Policial" } -- Grupos do Painel P, que terá acesso ao DX !
    
    function isPlayerOnGroup2 ( thePlayer )
        local account = getPlayerAccount ( thePlayer )
        local inGroup = false
        for _, group in ipairs ( Grupo ) do
            if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) then
                inGroup = true
                break
            end
        end
        return inGroup
    end
     
     
    function ClickJogdor ( Player )
      if isPlayerOnGroup2 ( source ) then
      	local account = getPlayerAccount (Player)
        if isGuestAccount (account) then msgFeniX(source, "Esse Jogador está deslogado !", "error") return end
       local cx, cy, cz = getElementPosition ( Player )
        local px, py, pz = getElementPosition ( source )
         local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
         if ( distance <= 1.7 ) then
      -- if Player == source then return end
          triggerClientEvent (source , "FeniX_AbrirDX" , source)
    	  setElementData(source, "FeniXMTA_Suspeito" , Player)
    	 
    	  end
        end
    end
    addEvent ( "FeniX_ClickJogdor", true )
    addEventHandler ( "FeniX_ClickJogdor", root, ClickJogdor)  

     

    No idea what you're trying to do with function 2 but i fixed the check. if the check's your only problem then this should fix it.

    local Grupo = {
    	["Policial"] = true
    	-- You can add more groups here if you want.
    }
    
    function isPlayerOnGroup2 ( thePlayer )
        local account = getPlayerAccount ( thePlayer )
    	for group, bool in pairs(Grupo) do
    		if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup(group)) then
    			return true
            end
    		return false 
        end
    end
     
    function ClickJogdor ( Player )
    	if isPlayerOnGroup2 ( source ) then
    		local account = getPlayerAccount (Player)
    		if isGuestAccount (account) then msgFeniX(source, "Esse Jogador está deslogado !", "error") return end
    		local cx, cy, cz = getElementPosition ( Player )
    		local px, py, pz = getElementPosition ( source )
    		local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
    		if ( distance <= 1.7 ) then
    		-- if Player == source then return end
    			triggerClientEvent (source , "FeniX_AbrirDX" , source)
    			setElementData(source, "FeniXMTA_Suspeito" , Player)
    		end
        end
    end
    addEvent ( "FeniX_ClickJogdor", true )
    addEventHandler ( "FeniX_ClickJogdor", root, ClickJogdor)  

     

    • Thanks 1
  4. 5 minutes ago, Burak5312 said:

    Since the vehicle was exploded by you, the same event is triggered again, that is, because the white vehicle did not explode, 1 time because the black vehicle exploded 2

    hahah i have the same vehicle damage property, why were they not gaining the same damage they are the same model. and no it doesn't trigger on vehicle explosion, the first SWAT tank only got 1 trigger on the rocket explosion, the second one got 2 triggers on the rocket explosion itself. anyways i think this is a bug, suddenly i restarted server and everything's fine now, thanks!

  5. Hi i noticed something different, When i create a vehicle via script the damage event doesn't work, but when i create by admin panel it does

    Black vehicle is created serverside, are vehicles in admin panel created client side? idk man here:

    also the damage function on vehicle works properly, but its just with the vehicles created from script serverside as u can see on the video.

    damage event is onClientVehicleDamage btw. also you can see the outputChatBox debug there, when i shot the vehicle created by admin panel the "boom" message only popped up once, even with the RPG, but when i shot the vehicle created by a server-side script, the boom shows up twice on the explosion thus triggering the damage event twice as well. why?

    They shouldn't be any different right? I mean, they're the same vehicle model and all so what's the thing that's messing with it? I only have 1 vehicle damaging script as well. and if there would have to be something messing with it, why is it not triggering twice on the vehicle made by the panel?

     

    Damage Part on the onClientVehicleDamage

    if weapon ~= 37 and warMachines[model] then 
    	if attacker and attacker == localPlayer then 
    		outputChatBox("boom!")
    		triggerServerEvent ("damageWarMachine", source, source, attacker, weapon, bodypart )
    		cancelEvent()
        end 
    end 

    creation of the vehicle server:

    APC1 = createVehicle( 601, 447.017578125, 725.5615234375, 6.7242736816406, 0, 0, 246.6 )
    setVehicleColor(APC1, 45, 45, 45, 45, 45, 45)

     

  6. 22 hours ago, Maruchan said:

     

    bad usage@ addeventhandler OnclientRender with this function is already handled

    
    
     

     

    Try adding a check so it doesn't repeat itself

    local DXShowing = false
    
    function Imagen_al_morir()
    	if DXShowing == false then 
    		DXShowing = true 
    		addEventHandler("onClientRender", root, MuerteSistema)
    	end 
    	tempo = 30
    	setElementData(localPlayer,'tiempo_de_respawn',tempo)
    	setTimer (function() 
    		tempo = tempo-1 	
    		setElementData(localPlayer,'tiempo_de_respawn',tempo)
    	end,1000,30)	
    	setTimer (function() 
    		DXShowing = false 
    		removeEventHandler("onClientRender", root, MuerteSistema)
    	end,1000*30,1)
    end

     

    • Thanks 1
  7. 8 hours ago, freudo said:

    it doesn't work.

    
    
    function Scoreboard.playersShow()
        scoreboard = {}
    	local arenaElement = getElementParent(localPlayer)
    	if getElementData(localPlayer,"mode") == "Competitive" then
    		for i,player in pairs(exports["CCS"]:export_getPlayersAndSpectatorsInArena(arenaElement)) do
    			table.insert(scoreboard,{"player",player})
    		end
    		return
    	end
    	for i,player in pairs(exports["CCS"]:export_getPlayersAndSpectatorsInArena(arenaElement)) do
    		if not getPlayerTeam(player) then
    			table.insert(scoreboard,{"player",player})
    		end
    	end
    	for i,team in pairs(getElementsByType("team")) do
    		if (tonumber(countPlayersInTeam(team))>=1) then
    
    			local teams = getTeamFromName ( tostring(team) )
    			if not teams then
    				table.insert(scoreboard,{"teamName",team})
    			end
    			for v,playerTeam in ipairs (getPlayersInTeam(team)) do
    				if getElementParent(playerTeam) == arenaElement then
    					
    					table.insert(scoreboard,{"player",playerTeam})
    				end
    			end
    		end
    	end
    
    end

    full code this.

    I have no idea what you're trying to do but i can see that your problem is "creating new team names in scoreboard right?" i'm assuming that's because of the amount of loops you have anyway try this:

    function Scoreboard.playersShow()
        scoreboard = {}
    	local arenaElement = getElementParent(localPlayer)
    	if getElementData(localPlayer,"mode") == "Competitive" then
    		for i,player in pairs(exports["CCS"]:export_getPlayersAndSpectatorsInArena(arenaElement)) do
    			table.insert(scoreboard,{"player",player})
    		end
    		return
    	end
    	for i,player in pairs(exports["CCS"]:export_getPlayersAndSpectatorsInArena(arenaElement)) do
    		if not getPlayerTeam(player) then
    			table.insert(scoreboard,{"player",player})
    		end
    	end
    	local team = getElementsByType("team")
    	local teamCount = countPlayersInTeam ( team )
    	if teamCount >= 1 then
    		local teams = getTeamFromName ( tostring(team) )
    		if not teams then
    			table.insert(scoreboard,{"teamName",team})
    		end
    		for v,playerTeam in ipairs (getPlayersInTeam(team)) do
    			if getElementParent(playerTeam) == arenaElement then
    				table.insert(scoreboard,{"player",playerTeam})
    			end
    		end
    	end
    end

    and tell me what doesn't work, if this doesn't work, explain your problem properly, and make sure to check /debugscript 3 if there are any errors.

    also i'm confused on what you're trying to do with this:

    for v,playerTeam in ipairs (getPlayersInTeam(team)) do
    	if getElementParent(playerTeam) == arenaElement then
    		table.insert(scoreboard,{"player",playerTeam})
    	end
    end

     

  8. Hello , i've been trying to make rhino be damaged by RPGs or explosions and such, but it's hard to do it. 

    'on ID S.W.A.T tank explosions work, they do the damage, but for the rhino idk why it doesn't. I didn't restrict any Weapon IDs for now to check if it really works. but still explosions do not work on rhino despite the event. 

    local armoredVehicles = { [432] = true, [601] = true }
    
    function warMachineDamage(attacker, weapon, loss, x, y, z, tire)
    	local model = getElementModel(source)
        if weapon and armoredVehicles[model] then 
            cancelEvent()
    		triggerServerEvent ("damageWarMachine", source, source, attacker, weapon, bodypart )
        end
    end
    addEventHandler("onClientVehicleDamage", root, warMachineDamage)

     

    Server:

    addEvent( "damageWarMachine", true )
    function damageWarMachine( vehicle, attacker, weapon, bodypart)
    	local vehicleHealth = getElementHealth(vehicle)
    	setElementHealth(vehicle, vehicleHealth - 500 )
    end 
    addEventHandler( "damageWarMachine", root, damageWarMachine )

    Does anyone know a workaround this?

    Like

    maybe use onClientExplosion? and maybe onClientPlayerWeaponFire then define the weapon and the hitElement then trigger the event?

  9. 42 minutes ago, Patrick said:

    Maybeee, idk. I tried to reproduce what you did in the video, but I can't. Works fine for me.

    indeed, it's working fine now too, it seldomly happens. idk why, but now it's all good, i'll update if it ever happens again, might've been just an error. thanks!

  10. 1 hour ago, Patrick said:

    Is it works fine if you don't modify weapon property?

    yes. i tried on a vanilla weapon property. it works fine. at some times it works fine, but the one shown above also happens sometimes and once it happens, it never disappears even if players / you reconnect, not only for me but for other players.  I don't have any other script that has weapon properties customized, I restarted server and it works fine now, idk what's causing it. Only solution for me when it happens is to restart the server.

    Could it be AK's getting affected by the anim loop stop? idk.. but i have the ID defined minigun on it.

    function onWeaponSystemStart()
    	for _, skillname in ipairs({"poor", "std", "pro"}) do
    		setWeaponProperty( 30, skillname, "accuracy", 1 )
    		setWeaponProperty( 38, skillname, "anim_loop_stop", 0.5 )
    		setWeaponProperty( 38, skillname, "anim2_loop_stop", 0.5 )
    		setWeaponProperty( 38, skillname, "damage", 40)
    	end 
    end 
    addEventHandler("onResourceStart", resourceRoot, onWeaponSystemStart)

     

  11. Hi i changed my AK-47 accuracy, it works fine, however, whenever i'm attached to something EX: glue to a vehicle, it goes weird, it stops animation like every 3 secs. anyone know how to fix? maybe some properties can do the trick if element is attached, etc etc? if so what property?

     

     

  12. 11 minutes ago, Captain07 said:

    Yup, it's working, I stopped everything else. 

    and that's because you disabled a whole group, you need to find the index. anyway,

    I have a code that disables most gunshots, M4/AK is still around here i think since i didn't want to disable the rustler/seasparrow sound...( but M4/AK sounds are not noticeable if it has a custom sound anyway..  unlike Deagle, etcs) what type of sounds do u want to disable? anyway here:

    local removedIDs = { 33, 4, 28, 21, 22, 23, 6, 7, 8, 29, 30, 17, 18, 26,
    27, 52, 53, 5, 0, 1, 2, 12, 14, 15, 16, 11 }
    
    setWorldSoundEnabled ( 5,  true)
    for i, sound in pairs(removedIDs) do
    	setWorldSoundEnabled(5, sound, false)
    end

    Just play with it, see what IDs u wanna remove / add.

    It's all weapon sounds btw.

    • Thanks 1
  13. It's been almost month since we last posted, Of course we're nearing our 1.0 release, only maps are being worked on right now, Here are the current screenshots we have

    NOTE: 80% of our scripts have been reworked, redesigned, and optimized. There are also tons of new stuff have been added since our last update here!

     

    Bored of typical DayZ, survival servers which you can't  freely do what you want? or some Zombie TDM servers that lack content and you easily get bored? this server is the answer! we have a mixture of Survival, RPG, TDM , also you can RP here! which is a better experience and you will never get bored! We have Gangs/Groups, for you to invite your mates and fight other Gangs/Groups, a new DM experience.

     

    Also what's shown on the screenshots below is just a 1/4 of the server we have more than that. The rest is for you to discover and experience, cheers.

    Bored of the typical nemesis bosses? sure we have a nemesis boss too, but he's way stronger and his machinegun accuracy is over the top.

    We currently have 5 Main bosses and 3 Mini bosses right now, TOTAL: 8 Bosses, including minibosses.

    BOSSES:

    Main bosses:

    Mutant, Tyrant, Orion, Nemesis, Goliath (Tyrant, Goliath isn't shown on the screenshots below)

    Mini Bosses:

    Immolator, Supersoldier, Protein (Protein, Immolator isn't shown on the screenshots below)

    Screenshots of Bosses:

    Spoiler

    MUTANT INSIDE A LAB

    F9ckIvD.png

    ORION INSIDE A LAB

    9PI5nI3.png

    NEMESIS IN LSPD

    O6G9v7O.png

    SUPERSOLDIER GUARDING A CRASHED PLANE WITH LOOTS INSIDE ( bottom right big guy )

    vZwbEIg.png

     

    Screenshots of framework, login panel etcs:

    Spoiler

    Login Panel

    Qr9ZiXp.png

    Spawn Panel

    y6Z2eLA.png

    Drug Panel ( we have drugs here, lol, for PVP purposes )

    sjTteTp.png

    Event / Boss Checker:

    EiNGL1k.png

    Map with guide:

    PGadVRm.png

    Weapon Shop:

    8Uc660h.png

     

     

     

    Gameplay contents, Levels are hard to earn here, not at an early phase, but mostly if youre level 10 above, thus, we added rewards for your hardwork, such as Nano-suits, and more! Mission windows, etcs shown below.

    Things you can do(not all):

    Rescue Zone aka Red-Cross(RC) - Rescue Mission

    Extort Zone - Opposite of Rescue Mission ( Rebel Perspective )

    Horde-Clear - Clearing Hordes of Zombies

    Rebel-Truck - A Skirmish between the Military and the Rebels

    Cargo-Drops - Cargo dropped filled with loot

    Mystery-Planes - Crashed military planes filled with loot, with peds guarding inside

    City-Wide Airstrikes - Air-strikes in 3 Major cities occur every hour

    Settlements / Settlement-Wars - Settlements for you to capture and profit from it

    and yes Bosses and more for you to see!.

    Spoiler

    Nano-Suit Window:

    xfVCSk9.png

    Example of a mission-window(We have limited missions atm):

    6wkCB0h.png

    A simple loot system, yes we have a loot system, random loots around the map.

    IuiUStD.png

    Cargo Drops!:

    fnWsTFH.png

    Crashed Military Planes with loots and guards guarding it:

    vZwbEIg.png

    Rescue Missions!

    uiCi9JY.png

    Airstrike Zones:

    YTP6Yjn.png

    Base system! you can buy a base if your group is not an official group, not an own spawn, but you can set respawn point.

    H6LOfOR.png

     

    Bored of typical zombies? we have different zombie types!

    We also have a thing called the "Blacklight Zone" which you cannot enter if you do not have an antivirus or a "hazmat suit", zombies are stronger there and more durable.

    Spoiler

    Blacklight Zone and Zombies in it.

    fdoYK6N.png57G9BtI.png

    zCTct0n.png

    Normal Zombies( also horde-clear event is shown here ?

    JaXw1VC.png

     

    Teaser of map:

    Spoiler

    MUTANT LAB(Outside, Inside), this is where you fight the mutant, you need to defeat lab soldiers and the scientist to fight him.

    J2v2lwz.png

    0An8h0l.png

    ORION LAB (Similar to mutant lab, just way harder)

    swVXMBL.png

    otVrpbJ.png

    uYSPfte.png

    Example of underground tunnels:

    Yk6bcSn.png

    Entrance to LS Tunnel:

    ktGwpMa.png

    Tilted buildings:

    KEJQsSn.png

     

    And for the last thing! We have settlements here! which you can capture and earn profit from it every 30 minutes! similar to turfing, but to capture it, you need to kill the peds guarding it!, also the players guarding it! a fun experience. We have around 15+ Settlements around the map, each belonging to different teams, which the owner can be changed if captured.

    Spoiler

    San andreas military forces settlement example:

    zTv2EEh.png

     

    Interested? Join us on http://www.zo-aftermath.net

    or send me a PM! we're releasing officialy very soon enough.

  14. 8 hours ago, freudo said:

    I'm using this. but if team player have 2 and more creating new team names in scoreboard. 

    That is because you are placing a loop inside a loop. What exactly are you trying to achieve? You need to simplify / optimize your code, try not to put a loop inside another loop. 

    Instead of this:

    for i,team in pairs(getElementsByType("team")) do
    		if (tonumber(countPlayersInTeam(team))>=1) then
    			for v,playerTeam in ipairs (getPlayersInTeam(team)) do
    				
    				if getElementParent(playerTeam) == arenaElement then
    					local teams = getTeamFromName ( tostring(team) )
    					if not teams then
    						if not team == scoreboard["teamName"][team] then
    							table.insert(scoreboard,{"teamName",team})
    						end
    					end
    				end
    				if getElementParent(playerTeam) == arenaElement then
    					
    					table.insert(scoreboard,{"player",playerTeam})
    				end
    			end
    		end
    	end

    Maybe try this:

    local team = getElementsByType("team")
    local teamCount = countPlayersInTeam ( team )
    	if teamCount >= 1 then
    	for v,playerTeam in ipairs (getPlayersInTeam(team)) do
    		if getElementParent(playerTeam) == arenaElement then
    			local teams = getTeamFromName ( tostring(team) )
    			if not teams then
    				if not team == scoreboard["teamName"][team] then
    					table.insert(scoreboard,{"teamName",team})
    				end
    			end
    		end
    		if getElementParent(playerTeam) == arenaElement then	
    			table.insert(scoreboard,{"player",playerTeam})
    		end
    	end
    end

    I don't know what you're trying to achieve but I removed the first loop you had which might be the cause of the problem you have. 

    also tonumber in countPlayersInTeam is not necessary.

  15. buildingSF = createObject(9900, -1055.4000244141, 1298.1999511719, 59, 0, 0, 0)
    
    local x, y, z = getElementPosition(buildingSF)
    
    objLowLOD = createObject ( 5154, x,y,z,0,0,0,true )
    
    setLowLODElement ( buildingSF, objLowLOD )
    
    engineSetModelLODDistance ( 5154, 300 )

    tried this example from the wiki, but it doesn't work, only the lowlod object is visible from afar, anyone knows how to be able to see created buildings from afar? 

    EDIT: fixed, i missed the bool: isLowLod. setLowLODElement is no longer necessary. 

    EDIT #2: Also, im wondering if converting .map files to lua files are safe and won't cause any lags? im refering to Patrick's converter, since i might consider replacing some of my map files to lua ones.

  16. 26 minutes ago, Wananazo said:

    the truth still keeps throwing me inside 6 and not inside 0 as I want it to work, the marker is supposed to be inside 6 and I want the vehicle to appear inside 0
     

    what I really want is for that marker that is inside 6 to send me inside 0 I'm going to share the complete fragment here

     

     

    local mrk = createMarker(254.03366, 78.57809, 1003.64062 -1, "cylinder", 1.5, 70,130,85) 
    setElementInterior(mrk,6)
    local destroyM = createMarker(-2408.79712, -590.94116, 132.64844 -1, "cylinder", 3, 255, 0, 0)
    
    
    -- OPEN PANEL --
    
    addEventHandler("onMarkerHit", mrk,
    function(onHit)
        if isElement(onHit) and getElementType(onHit) == "player" then
            triggerClientEvent(onHit, "LS:AbrirMarkerPOL", onHit)
        end
    end
    )
    --
    
    -- Destroy Function
    
    function destroy(player)
    	if isElementWithinMarker(player, destroyM) then
    		local theVehicle = getPedOccupiedVehicle(player)
    		if theVehicle then 
    			if isElement(veh[player]) then 
    				destroyElement(veh[player])
    			elseif isElement(veh[player]) then 
    				destroyElement(veh2[player])
    			elseif isElement(veh3[player]) then 
    				destroyElement(veh3[player])
    			elseif isElement(veh4[player]) then 
    				destroyElement(veh4[player])
    			end 
    			outputChatBox("", player, 255,255,255,true)
    		else
    			outputChatBox("", player, 255,255,255,true)
    		end
    	end
    end
    addEventHandler("onMarkerHit", destroyM, destroy)
    
    --
    
    -- Give Viatura 01
    
    veh = {}
    
    function spawnVehicleVTR()
    	if veh[source] and isElement( veh[source] ) then destroyElement(veh[source])
    		veh[source] = nil
    	end     
        veh[source] = createVehicle(490, -2421.15649, -608.30200, 132.56250)
    	local x, y, z = getElementPosition(veh[source])
    	setElementInterior(source, 0)
    	setElementPosition(source, x, y, z+2)
        warpPedIntoVehicle(source, veh[source])
        outputChatBox("#00FF00 Jefatura | #FFFFFF Patrulla 1 Seleccionada.", source, 255, 255, 255, true)
    end
    addEvent("LS:GiveVTR", true)
    addEventHandler("LS:GiveVTR", root, spawnVehicleVTR)
    --
    
    -- Give Rocam
    
    veh3 = {}
    
    function spawnVehicleRocam()
    	if veh3[source] and isElement( veh3[source] ) then destroyElement(veh3[source])
    		veh3[source] = nil
    	end     
        veh3[source] = createVehicle(523, 1586.75207, -1671.39477, 6.61896)
    	local x, y, z = getElementPosition(veh3[source])
    	setElementInterior(source, 0)
    	setElementPosition(source, x, y, z+2)
        warpPedIntoVehicle(source, veh3[source])
        outputChatBox("#00FF00 Jefatura | #FFFFFF Patrulla Seleccionado.", source, 255, 255, 255, true)
    end
    addEvent("LS:GiveRocam", true)
    addEventHandler("LS:GiveRocam", root, spawnVehicleRocam)

    Here, i dont think the setElementPosition is necessary, but just put that so i can make sure you'll arrive at your car. it's just a checker if it will work, later on you can try to remove the setElementPosition see if it still works. anyways you had two functions that had the same name, I changed the two function names. make sure to add checks on the destroyElements.

    also I suggest using getPedOccupiedVehicle check instead of isPedInVehicle.

  17. 3 hours ago, IIYAMA said:

    Position synchronization is already handled by the server. Better to try something else.

    noticed that. tested already with someone , hell looks terrible hahaha, any ideas u can suggest? or what functions to use or what do i need to get and set.

  18. 37 minutes ago, IIYAMA said:

    More consistent and at the right timing. Not sure about 'smoother'.

    wdyt about this? tried it on myself, without the sync yet, setelementposition with bool false doesnt look weird. curious what itll look like to other players.

    Send zombie element to server:

    triggerServerEvent("zombieSyncServer", resourceRoot, zombie)

     

    Server, get position of zombie:

    addEvent("zombieSyncServer", true)
    
    function syncSendToClient (ped, x, y, z)
    	-- get all players except for the one that triggered the the event --
    	local players = getElementsByType("player")
    	for i=1, #players do
    		if players[i] == client then
    			table.remove(players, i)
    			break
    		end
    	end
     	-- --
    	local Zx, Zy, Zz = getElementPosition(ped)
    	triggerClientEvent(players, "zombieSyncClient", resourceRoot, ped, Zx, Zy, Zz)
    end
      
    addEventHandler("zombieSyncServer", root, syncSendToClient)

     

    back to client:

    addEvent("zombieSyncClient", true)
    
    function syncReceiveFromServer (ped, x, y, z)
    	setElementPosition ( ped, x, y, z, false )  
    end
      
    addEventHandler("zombieSyncClient", root, syncReceiveFromServer)

    I don't know what im doing for now but that's what i came up first with.

  19. 3 minutes ago, IIYAMA said:

    The 100ms function is not the issue.

    The issue is the synchronization with the server. Which means that the syncer has to keep track of what the ped is actually doing. And only send a message to the server and other players when the ped is doing something else.

    so will it be okay if i only send the message while the ped is following? so it would look smoother than it was? forget the attacking, etc etc.

  20. 2 minutes ago, IIYAMA said:

     

    That data rate is a bit too high, especially if you are sending the data separately, that is a multiplier after all.

    • All data merged in to 1 packet/message: triggerServerEvent/triggerClientEvent
    • Do not send data double. If you set the ped to sprinting, do not tell the other players that over and over.

     

     

    I can see that as well, so anyway to do this without having to put it on the 100 ms function? 

  21. 9 minutes ago, IIYAMA said:

    Yes

     

     

    A small one, you have to fill in the blanks: --[[...]]

     

    Syncer (clientside):

    
    
    triggerServerEvent(--[[...]])

     

     

     

     

    let's say i put this on the trackMe function,

    which initiates every 100 ms, would that be fine? or would I have to create it's own timer that's not 100 ms since I feel like that would eat bandwidth or something. What do you suggest?

  22. 11 hours ago, Wananazo said:

    Hello friends I have a question about this fragment of code, the marker is in the department of the saints (interior 6) its function is to be able to choose a vehicle which I want to appear in the police garage (interior 0) my question is how I would do so that the interior can be invoked 0

     

    
    veh3 = {}
    function spawnVehicle()
    	if veh3[source] and isElement( veh3[source] ) then destroyElement(veh3[source])
    		veh3[source] = nil
    	end     
        veh3[source] = createVehicle(523, 1586.75207, -1671.39477, 6.61896)
    
        setElementInterior(spawnVehicle,0) -- ???
    
        warpPedIntoVehicle(source, veh3[source])

     

    aren't you setting interior of a function name? try replacing with the veh3[source] if u mean u want to set the interior of the car to 0.

    veh3 = {}
    function spawnVehicle()
    	if veh3[source] and isElement( veh3[source] ) then destroyElement(veh3[source])
    		veh3[source] = nil
    	end     
        veh3[source] = createVehicle(523, 1586.75207, -1671.39477, 6.61896)
        setElementInterior(veh3[source], 0) 
        warpPedIntoVehicle(source, veh3[source])

     

    • Like 1
  23. Use this to check if player changed dimension then put the replaceModel function instead of rendering the replaceModel function.

    https://wiki.multitheftauto.com/wiki/OnClientElementDimensionChange

    note: 

    never tried it, just an idea, but it might work, i feel like rendering the replace model functions would really cause lag since it just spams.

    EDIT: 

    tried something like this, it works, goodluck.

    function SA_Model() 
    	local txd = engineLoadTXD("test.txd", 202 )
    	engineImportTXD(txd , 202)
    	local dff = engineLoadDFF("test.dff", 202)
    	engineReplaceModel(dff , 202)
    end
    
    function VC_Model()
    	local txd = engineLoadTXD("test2.txd", 202 )
    	engineImportTXD(txd , 202)
    	local dff = engineLoadDFF("test2.dff", 202)
    	engineReplaceModel(dff , 202)
    end 
    
    addEventHandler ( "onClientElementDimensionChange", localPlayer,
    	function ( oldDimension, newDimension )
    		if oldDimension == 0 then 
    			VC_Model()
    			outputChatBox("check 1")
    		elseif newDimension == 0 then 
    			SA_Model()
    			outputChatBox("check 0")
    		end 
    	end
    )

     

×
×
  • Create New...