Jump to content

DRW

Members
  • Posts

    364
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by DRW

  1. Hi! I have a problem with Slothman's zombies script. When I shoot them at the body they don't even get damaged, so I edited the script a bit, now I can "kill" them when I shoot them at the body, zombies appear as dead bodies but don't count as kills, after some seconds the dead zombs appear walking but they don't move from the location they died at, the corpses point at me when they are supposed to be dead, what can I do? I want them to count as zombie kills when they die by being body shot. Images: Server: ZombieLimit = get("zombiegamemode.MaxZombies")-- HOW MANY ZOMBIES SHOULD EXIST AT MAXIMUM? ZombieStreaming = get("zombiegamemode.StreamMethod") -- 1 to constantly stream zombies, 0 to only allow zombies to spawn via createZombie function, 2 to only allow spawning at set spawnpoints ZombiePedSkins = {13,22,56,67,68,69,70,92,97,105,107,108,126,127,128,152,162,167,188,195,206,209,212,229,230,258,264,277,280, } --ALTERNATE SKIN LISTS FOR ZOMBIES (SHORTER LIST IS TEXTURED ZOMBIES ONLY) --ZombiePedSkins = {7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,36,37,38,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,66,67,68,69,70,71,72,73,75,76,77,78,79,80,81,82,83,85,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,112,113,114,115,116,117,118,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,150,151,152,153,154,155,156,157,158,159,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,209,210,211,212,213,214,215,216,217,218,219,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,275,276,277,278,279,280,281,282,283,284,285,286,288 } ZombieSpeed = get("zombies.Speed") if ZombieSpeed == 0 then --super slow zombies (goofy looking) chaseanim = "WALK_drunk" checkspeed = 2000 elseif ZombieSpeed == 1 then -- normal speed chaseanim = "run_old" checkspeed = 1000 elseif ZombieSpeed == 2 then -- rocket zombies (possibly stressful on server) chaseanim = "Run_Wuzi" checkspeed = 680 else -- defaults back to normal chaseanim = "run_old" checkspeed = 1000 end resourceRoot = getResourceRootElement() moancount =0 moanlimit = 10 everyZombie = { } -- ZOMBIE PROTECTION ADDED BY STRYP setElementData (createRadarArea(2418.4255371094, -1735,121.6306152344,100,0,150,0,153),"zombieProof",true) addEventHandler("onColShapeHit", createColRectangle (2418.4255371094, -1735,121.6306152344,100), function(h)if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end) -- CJ GARAGE ADDED BY STRYP local cjGarage = createColRectangle(2502.7883300781, -1698.60546875,5.8679199219,16.1025390625) addEventHandler("onColShapeHit",cjGarage,function(h) if getElementType(h) == "player" then setGarageOpen(9,true) local tpi = getElementData(cjGarage,"tpi") or 0 setElementData(cjGarage,"tpi",tpi+1,false) end end) addEventHandler("onColShapeLeave",cjGarage,function(h) if getElementType(h) == "player" then local tpi = getElementData(cjGarage,"tpi") or 0 if not tpi or tpi <= 1 then setGarageOpen(9,false)end setElementData(cjGarage,"tpi",tpi-1,false) end end) --IDLE BEHAVIOUR OF A ZOMBIE function Zomb_Idle (ped) if isElement(ped) then if ( getElementData ( ped, "status" ) == "idle" ) and ( isPedDead ( ped ) == false ) and (getElementData (ped, "zombie") == true) then local action = math.random( 1, 6 ) if action < 4 then -- walk a random direction local rdmangle = math.random( 1, 359 ) setPedRotation( ped, rdmangle ) setPedAnimation ( ped, "PED", "Player_Sneak", -1, true, true, true) setTimer ( Zomb_Idle, 7000, 1, ped ) elseif action == 4 then -- get on the ground setPedAnimation ( ped, "MEDIC", "cpr", -1, false, true, true) setTimer ( Zomb_Idle, 4000, 1, ped ) elseif action == 5 then -- stand still doing nothing setPedAnimation ( ped ) setTimer ( Zomb_Idle, 4000, 1, ped ) end end end end --BEHAVIOUR WHILE CHASING PLAYERS function Zomb_chase (ped, Zx, Zy, Zz ) if isElement(ped) then if (getElementData ( ped, "status" ) == "chasing") and (getElementData (ped, "zombie") == true) then local x, y, z = getElementPosition( ped ) if (getElementData ( ped, "target" ) == nil) and getElementData ( ped, "Tx" ) ~= false then local Px = getElementData ( ped, "Tx" ) local Py = getElementData ( ped, "Ty" ) local Pz = getElementData ( ped, "Tz" ) local Pdistance = (getDistanceBetweenPoints3D( Px, Py, Pz, x, y, z )) if (Pdistance < 1.5 ) then setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 2000, 1, ped ) end end local distance = (getDistanceBetweenPoints3D( x, y, z, Zx, Zy, Zz )) if (distance < 1 ) then -- IF THE PED HASNT MOVED if (getElementData ( ped, "target" ) == nil) then local giveup = math.random( 1, 15 ) if giveup == 1 then setElementData ( ped, "status", "idle" ) else local action = math.random( 1, 2 ) if action == 1 then setPedAnimation ( ped ) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) elseif action == 2 then setPedAnimation ( ped ) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( Zomb_chase, 3500, 1, ped, x, y, z ) end end else local Ptarget = (getElementData ( ped, "target" )) if isElement(Ptarget) then local Px, Py, Pz = getElementPosition( Ptarget ) local Pdistance = (getDistanceBetweenPoints3D( Px, Py, Pz, Zx, Zy, Zz )) if (Pdistance < 1.2 ) then -- ATTACK A PLAYER IF THEY ARE CLOSE if ( isPedDead ( Ptarget ) ) then --EAT A DEAD PLAYER setPedAnimation ( ped ) setPedAnimation ( ped, "MEDIC", "cpr", -1, false, true, false) setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 10000, 1, ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedRotation ( ped, getPedRotation(ped)-180) end end, 10000, 1, ped ) zmoan(ped) else local action = math.random( 1, 6 ) if action == 1 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) else setPedAnimation ( ped) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) end end else if ( isPedDead (Ptarget) ) then setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 2000, 1, ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedRotation ( ped, getPedRotation(ped)-180) end end, 1800, 1, ped ) else local action = math.random( 1, 2 ) if action == 1 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) elseif action == 2 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) end end end else setElementData ( ped, "status", "idle" ) end end else setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true) --KEEP WALKING setTimer ( Zomb_chase, checkspeed, 1, ped, x, y, z ) --CHECK AGAIN end end end end --SET THE DIRECTION OF THE ZOMBIE function setangle () for theKey,ped in ipairs(everyZombie) do if isElement(ped) then if ( getElementData ( ped, "status" ) == "chasing" ) then local x local y local z local px local py local pz if ( getElementData ( ped, "target" ) ~= nil ) then local ptarget = getElementData ( ped, "target" ) if isElement(ptarget) then x, y, z = getElementPosition( ptarget ) px, py, pz = getElementPosition( ped ) else setElementData ( ped, "status", "idle" ) x, y, z = getElementPosition( ped ) px, py, pz = getElementPosition( ped ) end zombangle = ( 360 - math.deg ( math.atan2 ( ( x - px ), ( y - py ) ) ) ) % 360 --MAGIC SPELL TO MAKE PEDS LOOK AT YOU setPedRotation( ped, zombangle ) elseif ( getElementData ( ped, "target" ) == nil ) and (getElementData ( ped, "Tx" ) ~= false) then --IF THE PED IS AFTER THE PLAYERS LAST KNOWN WHEREABOUTS x = getElementData ( ped, "Tx" ) y = getElementData ( ped, "Ty" ) z = getElementData ( ped, "Tz" ) px, py, pz = getElementPosition( ped ) zombangle = ( 360 - math.deg ( math.atan2 ( ( x - px ), ( y - py ) ) ) ) % 360 --MAGIC SPELL TO MAKE PEDS LOOK AT YOU setPedRotation( ped, zombangle ) end end end end end --SETS THE ZOMBIE ACTIVITY WHEN STATUS CHANGES addEventHandler ( "onElementDataChange", getRootElement(), function ( dataName ) if getElementType ( source ) == "ped" and dataName == "status" then if (getElementData (source, "zombie") == true) then if ( isPedDead ( source ) == false ) then if (getElementData ( source, "status" ) == "chasing" ) then local Zx, Zy, Zz = getElementPosition( source ) setTimer ( Zomb_chase, 1000, 1, source, Zx, Zy, Zz ) local newtarget = (getElementData ( source, "target" )) if isElement (newtarget) then if getElementType ( newtarget ) == "player" then setElementSyncer ( source, newtarget ) end end zmoan(source) elseif (getElementData ( source, "status" ) == "idle" ) then setTimer ( Zomb_Idle, 1000, 1, source) elseif (getElementData ( source, "status" ) == "throatslashing" ) then local tx,ty,tz = getElementPosition( source ) local ptarget = getElementData ( source, "target" ) if isElement(ptarget) then local vx,vy,vz = getElementPosition( ptarget ) local zombdistance = (getDistanceBetweenPoints3D (tx, ty, tz, vx, vy, vz)) if (zombdistance < .-- s8) --> then zmoan(source) setPedAnimation ( source, "knife", "KILL_Knife_Player", -1, false, false, true) setPedAnimation ( ptarget, "knife", "KILL_Knife_Ped_Damage", -1, false, false, true) setTimer ( Playerthroatbitten, 2300, 1, ptarget, source) setTimer ( function (source) if ( isElement ( source ) ) then setElementData ( source, "status", "idle" ) end end, 5000, 1, source ) else setElementData ( source, "status", "idle" ) end else setElementData ( source, "status", "idle" ) end end elseif (getElementData ( source, "status" ) == "dead" ) then setTimer ( Zomb_delete, 10000, 1, source) end end end end) --RESOURCE START/INITIAL SETUP function outbreak(startedResource) newZombieLimit = get("" .. getResourceName(startedResource) .. ".Zlimit") if newZombieLimit ~= false then if newZombieLimit > ZombieLimit then newZombieLimit = ZombieLimit end else newZombieLimit = ZombieLimit end WoodTimer = setTimer ( WoodSetup, 2000, 1) -- CHECKS FOR BARRIERS if startedResource == getThisResource() then exports.scoreboard:scoreboardAddColumn("Zombie kills") exports.scoreboard:scoreboardAddColumn("Level",getRootElement(),80) local allplayers = getElementsByType ( "player" ) for pKey,thep in ipairs(allplayers) do setElementData ( thep, "dangercount", 0 ) end local alivePlayers = getAlivePlayers () for playerKey, playerValue in ipairs(alivePlayers) do setElementData ( playerValue, "alreadyspawned", true ) end if ZombieSpeed == 2 then MainTimer1 = setTimer ( setangle, 200, 0) -- KEEPS ZOMBIES FACING THE RIGHT DIRECTION (fast) else MainTimer1 = setTimer ( setangle, 400, 0) -- KEEPS ZOMBIES FACING THE RIGHT DIRECTION end MainTimer3 = setTimer ( clearFarZombies, 3000, 0) --KEEPS ALL THE ZOMBIES CLOSE TO PLAYERS if ZombieStreaming == 1 then MainTimer2 =
  2. DRW

    Slothbot spawnBot.

    Thanks but I still have a problem, when I shoot them they dont get damaged
  3. DRW

    Slothbot spawnBot.

    Oh I forgot other map elements can count as hitelements, thanks!
  4. Hello. I've tried to create a server-sided marker linked to a function that spawns a slothbot bot, it appears and shoots when he sees me. For now all works perfectly, but the problem is that when the bot sees me, another bot appears in the same place he is at, and another, and another... After all, bots don't even get damage when they get shot. What did I do wrong and how can I solve both problems? Server Marker2a = createMarker (-2065, -118, 52,"cylinder",80,100,255,150,0) function botenemy1 ()enemy1a = exports [ "slothBot" ]:spawnBot(-2068,-144,35,0,2,0,0,enemies,22,"guarding") end addEventHandler ("onMarkerHit", Marker2a, botenemy1)
  5. DRW

    Help with GUI.

    Yeah it worked, I took a look at other scripts related to the one I wanted to make and I've corrected some things, now it works! Now there is another problem, I added a function per button, the first warps the player to a zone, the other one closes the GUI. That's what I wanted to do, but now the problem is that if I click any other part of the GUI, for example the GUI window, it warps me, without even clicking the button. rRoot = getResourceRootElement(getThisResource()) addEventHandler("onClientResourceStart",rRoot,function() guiSetVisible(VentanaGUI,false) end) function verventana() guiSetVisible(VentanaGUI, true) showCursor(true) guiBringToFront(VentanaGUI) end addEvent ("verventana", true) addEventHandler ("verventana", root, verventana) VentanaGUI = guiCreateWindow(258, 212, 312, 211, "Misión: Área Restringida", false) guiWindowSetSizable(VentanaGUI, false) GUIMemo = guiCreateMemo(9, 22, 293, 137, "¿¡Lo has oído!? ¡Un soldado del Área Restringida militar se ha instalado en nuestra comunidad, y dice que ahí hay antídotos suficientes para nuestros ciudadanos! El problema es que dice que por muy poco casi ni sale vivo de ahí, está lleno de esos cadáveres caminantes. ¡Eh! A ti te he visto luchar muy bien ahí fuera. Si entras y consigues lo nuestro, te pagaremos lo debido.", false, VentanaGUI) boton1 = guiCreateButton(20, 166, 129, 35, "¡Vamos!", false, VentanaGUI) guiSetFont(boton1, "sa-header") guiSetProperty(boton1, "NormalTextColour", "FF1AF303") boton2 = guiCreateButton(161, 166, 131, 35, "No quiero morir.", false, VentanaGUI) guiSetProperty(boton2, "NormalTextColour", "FFF50000") addEventHandler ("onClientGUIClick",boton2, function() showCursor(false) guiSetVisible(VentanaGUI, false) end) addEventHandler ("onClientGUIClick",boton1, function() setElementPosition (getLocalPlayer(),213,1872,12.-- s8) --> showCursor(false) guiSetVisible(VentanaGUI, false) end)
  6. DRW

    Help with GUI.

    I've been trying to make the GUI window appear only for the player when it hits a server-sided marker and not on script start, but it's not working. Could you tell me how to make the GUI window appear only when the player hits the marker and not when the script starts? Server Marker1 = createMarker (-454,2604, 65,"cylinder",2.0,100,255,150,255) addEventHandler("onMarkerHit", Marker1, function() triggerClientEvent (source, "guiVentana", source) end) Client addEvent ("guiventana", true) addEventHandler ("guiventana", localPlayer, function() guiSetVisible (VentanaGUI, true) end) VentanaGUI = guiCreateWindow(258, 212, 312, 211, "Misión: Área Restringida", false) guiWindowSetSizable(VentanaGUI, false) GUIMemo = guiCreateMemo(9, 22, 293, 137, "¿¡Lo has oído!? ¡Un soldado del Área Restringida militar se ha instalado en nuestra comunidad, y dice que ahí hay antídotos suficientes para nuestros ciudadanos! El problema es que dice que por muy poco casi ni sale vivo de ahí, está lleno de esos cadáveres caminantes. ¡Eh! A ti te he visto luchar muy bien ahí fuera. Si entras y consigues lo nuestro, te pagaremos lo debido.", false, VentanaGUI) boton1 = guiCreateButton(20, 166, 129, 35, "¡Vamos!", false, VentanaGUI) guiSetFont(boton1, "sa-header") guiSetProperty(boton1, "NormalTextColour", "FF1AF303") boton2 = guiCreateButton(161, 166, 131, 35, "No quiero morir.", false, VentanaGUI) guiSetProperty(boton2, "NormalTextColour", "FFF50000") addEventHandler ("onClientGUIClick",boton2, function() guiSetVisible(VentanaGUI, false) end) addEventHandler ("onClientGUIClick",boton1, function() setElementPosition (getLocalPlayer(),213,1872,12.-- s8) --> guiSetVisible(VentanaGUI, false) end) EDIT: I solved it, thanks
  7. DRW

    Help with GUI.

    Thank you very much!
  8. DRW

    Bots invencibles

    El bot es parte de enemies, y su posición hace que ataque a los que no sean enemies.
  9. DRW

    Help with GUI.

    Could you give me an example of triggerclientevent and triggerserverevent?
  10. DRW

    Help with GUI.

    Hello. Sorry for bothering you, but I have a problem and if you could give me some help it would be awesome, I just started scripting yesterday. So, I'm trying to create a serverside marker, so when the player hits the marker, a GUI with two buttons will appear only for him, then when the player clicks "Yes", it'll be warped to an area, if the player clicks "No", the GUI will close. I don't want a script, just a a small example to give me a boost.
  11. DRW

    Bots invencibles

    Sí, el equipo es "enemies". Aunque hayas editado el team, el bot sigue siendo invencible, pero por razones obvias, al atacar con un cuchillo a la espalda del bot, este muere.
  12. DRW

    Bots invencibles

    Muy buenas a todos/as. Soy nuevo en esto del scripting (y por nuevo me refiero a que llevo unas horas sabiendo lo esencial), por lo que, por favor, no blasfeméis si he cometido alguna atrocidad . El caso es que estoy usando el resource Slothbot para generar un bot cuando haya un evento onMarkerHit, hasta ahí bien, el bot funciona usando la posición "guarding", dispara a los que no estén en su equipo y todo eso. El problema es que, a la hora de ser disparado no recibe ningún tipo de daño, como si fuera invencible. He buscado por el foro sobre este problema y realmente ninguna sugerencia ha logrado solucionarlo. Me he dejado llevar por los errores que me daba la consola del server y los he solucionado según sus indicaciones. Marker1 = createMarker (214.32,1879.686, 12.9,"cylinder",2.0,180,0,0,255) function botenemy1 ()enemigo = exports [ "slothBot" ]:spawnBot(212,1863,13.14,0,2,0,0,enemies,22,"guarding") end addEventHandler("onMarkerHit", Marker1, botenemy1)
×
×
  • Create New...