Jump to content

Halfmillz

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by Halfmillz

  1. thx . Did you mean automatic restart resource when player join? how to do that?
  2. This's my Spawn script. Have any suggestion? please help function createZombie ( x, y, z, rot, skin, interior, dimension ) if (table.getn( everyZombie ) < newZombieLimit ) then --this part handles the args if not x then return false end if not y then return false end if not z then return false end if not rot then rot = math.random (1,359) end if not skin then randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) ) skin = ZombiePedSkins[randomZskin] end if not interior then interior = 0 end if not dimension then dimension = 0 end --this part spawns the ped local zomb = setTimer(createPed, 8000, 0, tonumber(skin),tonumber(x),tonumber(y),tonumber(z))--spawns the ped --if successful, this part applies the zombie settings/args if (zomb ~= false) then setTimer ( setElementInterior, 100, 1, zomb, tonumber(interior)) --sets interior setTimer ( setElementDimension, 100, 1, zomb, tonumber(dimension)) --sets dimension setElementData ( zomb, "zombie", true ) setElementData ( zomb, "forcedtoexist", true ) setTimer ( function (zomb, rot) if ( isElement ( zomb ) ) then setPedRotation ( zomb, rot ) end end, 500, 1, zomb, rot ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "status", "idle" ) end end, 2000, 1, zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "forcedtoexist", true ) end end, 1000, 1, zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then table.insert( everyZombie, zomb ) end end, 1000, 1, zomb ) triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) return zomb --returns the zombie element else return false --returns false if there was a problem end else return false --returns false if there was a problem end end --SPAWN ZOMBIE (now can be cancelled!) addEvent( "onZombieSpawn", true ) function RanSpawn_Z ( gx, gy, gz, rot) local safezone = 0 local allradars = getElementsByType("radararea") for theKey,theradar in ipairs(allradars) do if getElementData(theradar, "zombieProof") == true then if isInsideRadarArea ( theradar, gx, gy ) or ( isElementInWater ( getLocalPlayer() ) == true ) then safezone = 1 end end end if safezone == 0 then if table.getn ( everyZombie ) < newZombieLimit then if not rot then rot = math.random (1,359) end randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) ) local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), gx, gy, gz ) if zomb ~= false then setElementData ( zomb, "zombie", true ) table.insert( everyZombie, zomb ) setTimer ( function (zomb, rot) if ( isElement ( zomb ) ) then setPedRotation ( zomb, rot ) end end, 500, 1, zomb, rot ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setPedAnimation ( zomb, "ped" ) end end, 200, 1, zomb )--, chaseanim, -1, true, true, true ) end end, 1000, 1, zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "status", "idle" ) end end, 2000, 1, zomb ) if ( randomZskin == 28 ) then giveWeapon( zomb, 8, 1) end if ( randomZskin == 8 ) then setElementAlpha( zomb, 30) end triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) end end end end addEventHandler( "onZombieSpawn", getRootElement(), RanSpawn_Z ) --SPAWNS ZOMBIES RANDOMLY NEAR PLAYERS function SpawnZombie () local pacecount = 0 while pacecount < 3 do --2 ZOMBIES AT A TIME TO PREVENT FPS DROP if (table.getn( everyZombie )+pacecount < newZombieLimit ) and (ZombieStreaming == 1) then local xcoord = 0 local ycoord = 0 local xdirection = math.random(1,2) if xdirection == 1 then xcoord = math.random(25,60) --defualt (15,40) else xcoord = math.random(-60,-25) --defualt = (-40,-15) end local ydirection = math.random(1,2) if ydirection == 1 then ycoord = math.random(25,60) --defualt = (15,45) else ycoord = math.random(-60,-25) --defualt = (-40,-15) end local liveplayers = getAlivePlayers () if (table.getn( liveplayers ) > 0 ) then local lowestcount = 99999 -- defualt = 99999 local lowestguy = nil for PKey,thePlayer in ipairs(liveplayers) do if isElement(thePlayer) then if (getElementData (thePlayer, "dangercount")) and (getElementData(thePlayer, "zombieProof") ~= true) and (getElementData(thePlayer, "alreadyspawned" ) == true) then if (getElementData (thePlayer, "dangercount") < lowestcount) then local safezone = 0 local gx, gy, gz = getElementPosition( thePlayer ) local allradars = getElementsByType("radararea") for theKey,theradar in ipairs(allradars) do if getElementData(theradar, "zombieProof") == true then if isInsideRadarArea ( theradar, gx, gy ) then safezone = 1 end end end if safezone == 0 then lowestguy = thePlayer lowestcount = getElementData (thePlayer, "dangercount") end end end end end pacecount = pacecount+1 if isElement(lowestguy) then triggerClientEvent ( "Spawn_Placement", lowestguy, ycoord, xcoord ) else pacecount = pacecount+1 end else pacecount = pacecount+1 end else pacecount = pacecount+1 end end end
  3. I use zday zombies script and i want dynamic zombie limit with amount of player. example when 1 player zombieslimit are 10 / 2player set limit to 20 automatic. Is this possible ? thx
  4. is possible to make ped or player can't use any weapon when standing on car roof? thank you
  5. how to limit zombies per player? , example i want to spawn 10 zombie per live player. i don't want all zombies spawn at 1 player
×
×
  • Create New...