bartje01 Posted March 13, 2011 Posted March 13, 2011 Hey guys I have this line local zomb = createPed (1542.68,-1675,13.55)--spawns the ped But I want more locations for it
bartje01 Posted March 13, 2011 Author Posted March 13, 2011 Well the only locations where the zombies spawn is 1542.68,-1675,13.55. I want to make them spawn on different places. how
#Paper Posted March 13, 2011 Posted March 13, 2011 Well the only locations where the zombies spawn is 1542.68,-1675,13.55.I want to make them spawn on different places. how so make more lines whit other locations .-."
bartje01 Posted March 13, 2011 Author Posted March 13, 2011 local zomb = createPed (1542.68,-1675,13.55) local zomb = createPed (1542.68,-1675,13.55) Won't work and if I do local zomb2 = createPed (1542.68,-1675,13.55) I will have many things to edit
#Paper Posted March 13, 2011 Posted March 13, 2011 you must make differents locals whit different names and different locations...
bartje01 Posted March 13, 2011 Author Posted March 13, 2011 you must make differents locals whit different names and different locations... That's what I mean. I can't do that. Because there are to many things I have to edit and suchs things.
Castillo Posted March 13, 2011 Posted March 13, 2011 Do this, locations = { {1542.68,-1675,13.55}, {0, 0, 0} } for i,v in pairs(locations) do local zomb = createPed (v[1],v[2],v[3]) end This way you can create as many as you want by just adding the x,y,z position following the example.
bartje01 Posted March 13, 2011 Author Posted March 13, 2011 locations = { {1542.68,-1675,13.55}, {1676.63,-1717.06,13.54} } for i,v in pairs(locations) do local zomb = createPed (v[1],v[2],v[3]) end Only the first spawn works
Castillo Posted March 13, 2011 Posted March 13, 2011 That's because you forgot the SKIN part locations = { {1542.68,-1675,13.55}, {1676.63,-1717.06,13.54} } for i,v in pairs(locations) do local zomb = createPed (0,v[1],v[2],v[3]) -- spawn them with CJ skin. end
bartje01 Posted March 13, 2011 Author Posted March 13, 2011 I see. There is another function: 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 ) 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 ) ) locations = { {1676.63,-1717.06,13.54}, {1542.68,-1675,13.55}, {1676.63,-1717.06,13.54} } for i,v in pairs(locations) do local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), (v[1],v[2],v[3])) 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", 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 ) triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) end end end end addEventHandler( "onZombieSpawn", getRootElement(), RanSpawn_Z ) I added your part. Error + Warning on this line: local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), (v[1],v[2],v[3])) [2011-03-13 23:27:32] SCRIPT ERROR: zombies\zombie_server.lua:701: 'end' expected (to close 'function' at line 385) near '<eof>' [2011-03-13 23:27:32] WARNING: Loading script failed: zombies\zombie_server.lua:701: 'end' expected (to close 'function' at line 385) near '<eof>'
Castillo Posted March 13, 2011 Posted March 13, 2011 locations = { {1676.63,-1717.06,13.54}, {1542.68,-1675,13.55}, {1676.63,-1717.06,13.54} } 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 ) 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 ) ) for i,v in pairs(locations) do local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), v[1],v[2],v[3]) 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", 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 ) triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) end end end end end addEventHandler( "onZombieSpawn", getRootElement(), RanSpawn_Z )
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now