Jump to content

LiOneLMeSsIShoT

Members
  • Posts

    609
  • Joined

  • Last visited

Everything posted by LiOneLMeSsIShoT

  1. Actually now when zombie hit me ...the guard do nothing and when 2 zombies attacks me i get error: :49: 'addEventHandler': 'onClientRender' with function is already handled I think this error comes because the guard can't handle more than one attacker?
  2. Actually now when zombie hit me ...the guard do nothing and when 2 zombies attacks me i get error: :49: 'addEventHandler': 'onClientRender' with function is already handled
  3. Errors: :38: attempt to perform arithmetic on local 'y2' (a nil value)
  4. Because this script is "Complex" you made it by complex way because the function is made in the 3 argument of the addEventHandler so it's hard for a begginer like me anyway i have tried it : local guards = {} function moveGuard() table.insert(guards, source) addEventHandler('onClientPedDamage', source, function(attacker) if attacker == localPlayer then cancelEvent() end end) end addEvent("moveGuard",true) addEventHandler ("moveGuard", getRootElement(), moveGuard) function followPlayer() for index, guard in pairs(guards) do if (not isElement(guard) or isPedDead(guard)) then table.remove(guards, index) else local int, dim = getElementInterior(localPlayer), getElementDimension(localPlayer) local tint, tdim = getElementInterior(guard), getElementDimension(guard) if (int ~= tint) then setElementInterior(guard, int) end if (dim ~= tdim) then setElementDimension(guard, dim) end local x, y, z = getElementPosition(localPlayer) local tx, ty, tz = getElementPosition(guard) local dis = getDistanceBetweenPoints2D (x, y, tx, ty) setPedRotation(guard, findRotation(tx, ty, x, y)) if (dis > 2) then setPedControlState(guard, 'forwards', true) else setPedControlState(guard, 'forwards', false) end if (dis > 4) then setPedControlState(guard, 'sprint', true) else setPedControlState(guard, 'sprint', false) end end end end addEventHandler('onClientPreRender', root, followPlayer) function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end return t end local target addEventHandler ("onClientPlayerDamage", localPlayer, function(attacker) if (isElement(attacker) and getElementType(attacker) == 'ped' and getElementData(attacker, 'zombie') and #guards > 0) then -- He's a zombie target = attacker removeEventHandler('onClientPreRender', root, followPlayer) addEventHandler('onClientRender', root, aimForTarget) end end) function aimForTarget() if (#guards == 0) then removeEventHandler('onClientRender', root, aimForTarget) addEventHandler('onClientPreRender', root, followPlayer) return end if (not isElement(target) or isPedDead(target)) then for index, guard in pairs(guards) do if (isElement(guard)) then setPedControlState(guard, 'fire', false) end end removeEventHandler('onClientRender', root, aimForTarget) addEventHandler('onClientPreRender', root, followPlayer) return end local ax, ay, az = getElementPosition(target) local tx, ty, tz = getElementPosition(guard) local x, y, z = getElementPosition(localPlayer) local bx, by, bz = getPedBonePosition(target, 1) local weapon = getPedWeaponSlot (guard) local targetDis = getDistanceBetweenPoints3D (tx, ty, tz, ax, ay, az) for index, guard in pairs(guards) do if (targetDis > 20) and (weapon == 30) then if (not isElement(guard) or isPedDead(guard)) then table.remove(guards, guard) return end setPedRotation(guard, findRotation(tx, ty, x, y)) setPedAimTarget(guard, bx, by, bz) setPedControlState(guard, 'fire', true) else setPedRotation (guard, findRotation(ax, ay, az)) setPedAimTarget(guard, bx, by, bz, false) setPedControlState(guard, 'fire', false) end if (targetDis > 15) and (weapon == 22) then if (not isElement(guard) or isPedDead(guard)) then table.remove(guards, guard) return end setPedRotation(guard, findRotation(tx, ty, x, y)) setPedAimTarget(guard, bx, by, bz) setPedControlState(guard, 'fire', true) else setPedRotation (guard, findRotation(ax, ay, az)) setPedAimTarget(guard, bx, by, bz, false) setPedControlState(guard, 'fire', false) end end end i did what i can with this script but i got errors now: 72: attempt to compare number with boolean 70:bad argument @ "getDistanceBetweenPoints3D Expected number at argument 1, got boolean 69: bad argument @ "getPedWeaponSlot" 66: bad argument @ "getElementPosition"
  5. alright man, actually it have a lot of really strange things: 1-When Zombie hit the guard he do nothing 2-when i block from zombie attacks the guard do nothing, so he's waiting for the guard to success with hitting me 3-when the guard is already Shoting in zombie after zombie hits me.. the shots don't even effect on the zombie...like nothing happen to him 4- when i spawn another guard and the guard that already spawned shot some zombie "the guard that i spawned for now hits the other guard" so the guards hit each other of i spawn one and the other already shoting 5- When the zombie move away the guard Don't want to follow me or even try to chase the zombie and actually i want the guard trys to hit the zombie if he see him in about 5 or 6 distance I'm """"Sorry"""" for making it long but this Bugged things will make the script Fail and give no sense
  6. Yep Running. and other script exported that isPedZombie and works fine. but this script not.
  7. Yeah man i want it to check if zombies are the attackers or even player, not only zombies or only players...whatever there's error: :46: call failed to call "zombies:isPedZombie"
  8. Hmm?? Are you sure that it worked? because when zombies hit my guard or even hit me the guard do nothing. and whatever i think this script made to attack "Player" who attacks me only.. because it's onClientPlayerDamage..and whatever there's exported functions that called "isPedZombie" I think it should help in the script ... --check if a ped is a zombie or not function isPedZombie(ped) if (isElement(ped)) then if (getElementData (ped, "zombie") == true) then return true else return false end else return false end end addEvent( "onZombieLostPlayer", true ) That's the Check..
  9. Only "End MIssed" and added it but when zombie attack me or my guard, the guard do nothing.
  10. Alright actually i'm almost got the solution and tried it but still there's a problem: function kiss (thePlayer, cmd, arg) if arg then local id = tonumber(arg) if id then otherPlayer = exports.ID_System:getPlayerFromID(id) else otherPlayer = getPlayerFromName (arg) end local x, y, z = getElementPosition(thePlayer) local tx, ty, tz = getElementPosition(otherPlayer) if otherPlayer ~= player then if (getPedOccupiedVehicle(thePlayer) == false and getPedOccupiedVehicle(otherPlayer) == false) then if (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)<1) then setPedAnimation (thePlayer, "KISSING", "Grlfrd_Kiss_03", -1, true, false, false ) setPedAnimation (otherPlayer, "KISSING", "Grlfrd_Kiss_03", -1, true, false, false ) bindKey (thePlayer, "space", "down", StopCommand) end end end end end addCommandHandler ("kiss", kiss) function StopCommand ( source ) setPedAnimation ( source ) unbindKey ( source, "space", "down", StopCommand) end when i try to /kiss thePlayer and not /kiss otherPlayer it work on the air 2- when i write a wrong name i get a couple of Errors: [11:56:53] WARNING: Animation_system\Kiss_Anim\anim.lua:10: Bad argument @ 'getE lementPosition' [Expected element at argument 1, got boolean] [11:56:53] WARNING: Animation_system\Kiss_Anim\anim.lua:12: Bad 'ped' pointer @ 'getPedOccupiedVehicle'(1) [11:56:53] WARNING: Animation_system\Kiss_Anim\anim.lua:12: Bad argument @ 'getP edOccupiedVehicle' [11:56:53] WARNING: Animation_system\Kiss_Anim\anim.lua:13: Bad argument @ 'getD istanceBetweenPoints3D' [11:56:53] ERROR: Animation_system\Kiss_Anim\anim.lua:13: attempt to compare boo lean with number
  11. Thanks for your advice, so could you fix it please if you can?
  12. المشكلة الاولى ههنا 1- اما اكتب اسم اللاعب او الاى دى الخاص بيه غلط! يجيلى اخطاء 2- اما اكتب /kiss LiOneLMeSsI او /Kiss 1 اقصد يعنى اما اعمل الانيميشن بدون تواجد لاعب اخر بس يكون الانيميشن يتعمل علىيا انا...المشكلة هنا انه بيعمل الانيميشن وانا عاوزى ما يعمل الانيميشن الا فى تواجد لاعب اخر وليس انا...وشئ اخر اريد "التحقق اذا كان اللاعب الاخر يقف امام اللاعب الخاص بى فى وجهه.....اذا ليم يكن واقف فى وجهه لا يمكن عمل ال انيميشن function kiss (thePlayer, cmd, arg) if arg then local id = tonumber(arg) if id then otherPlayer = exports.ID_System:getPlayerFromID(id) else otherPlayer = getPlayerFromName (arg) end local x, y, z = getElementPosition(thePlayer) local tx, ty, tz = getElementPosition(otherPlayer) if otherPlayer ~= player then if (getPedOccupiedVehicle(thePlayer) == false and getPedOccupiedVehicle(otherPlayer) == false) then if (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)<1) then setPedAnimation (thePlayer, "KISSING", "Grlfrd_Kiss_03", -1, true, false, false ) setPedAnimation (otherPlayer, "KISSING", "Grlfrd_Kiss_03", -1, true, false, false ) bindKey (thePlayer, "space", "down", StopCommand) end end end end end addCommandHandler ("kiss", kiss) function StopCommand ( source ) setPedAnimation ( source ) unbindKey ( source, "space", "down", StopCommand) end [00:45:20] WARNING: Animation_system\Kiss_Anim\anim.lua:12: Bad argument @ 'getE lementPosition' [Expected element at argument 1, got boolean] [00:45:20] WARNING: Animation_system\Kiss_Anim\anim.lua:14: Bad 'ped' pointer @ 'getPedOccupiedVehicle'(1) [00:45:20] WARNING: Animation_system\Kiss_Anim\anim.lua:14: Bad argument @ 'getP edOccupiedVehicle' [00:45:20] WARNING: Animation_system\Kiss_Anim\anim.lua:15: Bad argument @ 'getD istanceBetweenPoints3D' [00:45:20] ERROR: Animation_system\Kiss_Anim\anim.lua:15: attempt to compare boo lean with number
  13. Aha actually i know the problem now and fixed it but now there's another problem here: help please [23:54:27] WARNING: Animation_system\Kiss_Anim\anim.lua:5: Bad argument @ 'getEl ementPosition' [Expected element at argument 1, got nil]
  14. It's Exported yes...in meta and the resource started.
  15. Man! please, could you check the script once again? it will work when someone hit the player so the guard will hit the guy which hurted the owner...... and i got that errors could you help me with fixing them? And Yep, Zombie system here Exports function that allows me to check if that ped is zombie and proofs here first proof: It's in Zady script second one here: Script: function Example () table.insert (guards, source) local guard = guards local zombies = exports ["zombies"]:isPedZombie (source) local gx, gy, gz = getElementPosition(guard) -- guards local zx, zy, zz = getElementPosition(zombies) -- zombies local clear = isLineOfSightClear (gx, gy, gz, zx, zy, zz,true, false, false, true, false, false, false) if zombies and isElement (guards[source]) then if clear then setPedControlState( ped, "fire", true ) outputChatBox ("Attack! ") end end end addEventHandler ("onClientPlayerDamage",getRootElement(),Example) Exports Function: --check if a ped is a zombie or not function isPedZombie(ped) if (isElement(ped)) then if (getElementData (ped, "zombie") == true) then return true else return false end else return false end end addEvent( "onZombieLostPlayer", true ) Meta Exported: "*MaxZombies" value="[100]" /> --maximum allowed zombies --> "*StreamMethod" value="[1]" /> -- 1 to constantly stream zombies, 0 to only allow zombies to spawn via createZombie function, 2 to only allow spawning at set spawnpoints --> "*Speed" value="[1]" /> -- 0 is slowest, 1 is normal, 2 faster --> "Slothman" name="Zday script" version="3.0.1" type="script" description="Zombie Infestation script" edf:definition="edf/zombies.edf"/>/> Can you help me now with that man? !!!!
×
×
  • Create New...