Jump to content

.:HyPeX:.

Members
  • Posts

    1,255
  • Joined

  • Last visited

Everything posted by .:HyPeX:.

  1. .:HyPeX:.

    AntiSpam

    Okay.. havent tested yet, but lets see, is it too carzy? ----Anti-Spam-Script-by-HyPeX-- ----Locals---- MuteTimePerMins = 5 ------------------------------- ----Messages of Startup---- outputChatBox ("#00aaff[AntiSpam]: Script v2.0 by HyPeX Started.",root, 255, 255, 255, true) outputChatBox ("#00aaff[AntiSpam]: Special Thanks to 3NAD for helping me.",root, 255, 255, 255, true) outputChatBox ("#00aaff[AntiSpam]: Aviable commands: sleft",root , 255, 255, 255, true) ------------------------------- ----Functions--- function credits(onPlayerJoin) outputChatBox ( "Anti-Spam Script By HyPeX Loaded", source, 55, 125, 255 ) end addEventHandler("onPlayerJoin", root, credits) SpamTable = { }; AntiSpam = function ( msg, type ) if not SpamTable[source] then SpamTable[source] = { Timer = { }; Command = { }; Mute = { }; MuteTime = { }; }; end if type == 0 then if SpamTable[source] then if SpamTable[source].Mute == true then outputChatBox("[AntiSpam]: Type /sleft to get your time left muted.", source, 0, 170, 255) return end if SpamTable[source].Command == msg then if isTimer ( SpamTable[source].Timer ) then if SpamTable[source].Mute ~= true then SpamTable[source].Mute = true SpamTable[source].MuteTime = setTimer ( function ( player ) if isElement ( player ) then UnMutePlayer ( player ) SpamTable[player].Mute = false end end, MuteTimePerMins*60*1000, 1, source ) setPlayerMuted(source, true) outputChatBox("[AntiSpam]: ".. (string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "")) .." has have been muted for flooding for "..MuteTimePerMins.." Mins.", source, 0, 170, 255) cancelEvent ( ) return end end cancelEvent ( ) outputChatBox ( "[AntiSpam]: You have been Warned.", source, 0, 170, 255, true ) outputChatBox ( "[AntiSpam]: If you Spam again withing 10 secs, you will be muted.", source, 0, 170, 255, true ) SpamTable[source].Timer = setTimer ( function ( player ) if isElement ( player ) then SpamTable[player].Command = nil end end, 10000, 1, source ) else SpamTable[source].Command = msg end end end end addEventHandler ( "onPlayerChat", root, AntiSpam ) function timerDetails ( source ) if SpamTable[source].MuteTime and isTimer ( SpamTable[source].MuteTime ) then local remaining, executesRemaining, totalExecutes = getTimerDetails ( SpamTable[source].MuteTime ) outputChatBox ( "[AntiSpam]: Time left muted: "..string.format ( '%02d:%02d', math.floor(remaining/60/1000), math.fmod(math.floor(remaining/1000),60)), source, 0, 170, 255, true ) else outputChatBox ( "[AntiSpam]: You are not muted.", source, 0, 170, 255, true ) elseif isTimer( ClearCount[thePlayer] ) then local remaining2, executesRemaining2, totalExecutes2 = getTimerDetails ( ClearCount[thePlayer] ) outputChatBox ( "[AntiSpam]: Time left muted: "..string.format ( '%02d:%02d', math.floor(remaining2/60/1000), math.fmod(math.floor(remaining2/1000),60)), source, 0, 170, 255, true ) else outputChatBox ( "[AntiSpam]: You are not muted.", source, 0, 170, 255, true ) end end end addCommandHandler ( "sleft", timerDetails ) addEventHandler ( "onResourceStop", resourceRoot, function ( ) for i, v in ipairs ( getElementsByType ( "player" ) ) do onDeleteTables ( v ) end end ) onDeleteTables = function ( player ) if not player then player = source end SpamTable[player] = nil end addEventHandler ( "onPlayerQuit", root, onDeleteTables ) ----UnmutePlayer function UnMutePlayer(player) if isElement ( player ) then if isPlayerMuted( player ) then setPlayerMuted(player, false) else outputChatBox ( "[AntiSpam]:".. (string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")) .."is now unmuted!",player,0, 175 ,255 ) end end end ----Manage on quit or join function OnPlayerMutedLeft() local playerAccount = getPlayerAccount(source) if not isGuestAccount ( playerAccount ) then if isPlayerMuted( source ) or isTimer ( SpamTable[source].MuteTime ) or isTimer( ClearCount[thePlayer] ) then local remaining, executesRemaining, totalExecutes = getTimerDetails ( SpamTable[source].MuteTime ) local remaining2, executesRemaining2, totalExecutes2 = getTimerDetails ( ClearCount[thePlayer] ) if remaining then setAccountData( playerAccount, "MutedTimeScript", tostring(remaining) ) setPlayerMuted( source, false) killTimer(SpamTable[source].MuteTime) elseif remaining2 then setAccountData( playerAccount, "MutedTimeScript", tostring(remaining2) ) setPlayerMuted( source, false) killTimer(ClearCount[thePlayer]) end else setAccountData( playerAccount, "MutedtimeScript", false ) end end end addEventHandler("onPlayerQuit", root, OnPlayerMutedLeft) function OnPlayerMutedJoint ( _, acc ) local MutedLeft = getAccountData( acc, "MutedTimeScript" ) if MutedLeft then if not SpamTable[source] then SpamTable[source] = { Timer = { }; Command = { }; Mute = { }; MuteTime = { }; }; end setPlayerMuted(source, true) setTimer(UnMutePlayer, tonumber(MutedLeft), 1, source ) SpamTable[source].MuteTime = setTimer ( function ( player ) if isElement ( player ) then SpamTable[player].Mute = false end end, tonumber(MutedLeft), 1, source ) outputChatBox ( "[AntiSpam]: Welcome back, here's your time left muted:", source, 0, 170, 255, true ) outputChatBox ( "[AntiSpam]: Time left muted: "..string.format ( '%02d:%02d', math.floor(MutedLeft/60/1000), math.fmod(math.floor(MutedLeft/1000),60)), source, 0, 170, 255, true ) setAccountData( acc, "MutedTimeScript", false ) elseif not ClearCount[thePlayer] then setPlayerMuted(source, true) setTimer(UnMutePlayer, tonumber(MutedLeft), 1, source ) ClearCount[thePlayer] = setTimer( function(thePlayer) ClearCount[thePlayer] = 0 end, tonumber(MutedLeft), 1, thePlayer) outputChatBox ( "[AntiSpam]: Welcome back, here's your time left muted:", source, 0, 170, 255, true ) outputChatBox ( "[AntiSpam]: Time left muted: "..string.format ( '%02d:%02d', math.floor(MutedLeft/60/1000), math.fmod(math.floor(MutedLeft/1000),60)), source, 0, 170, 255, true ) setAccountData( acc, "MutedTimeScript", false ) end end addEventHandler("onPlayerLogin", root, OnPlayerMutedJoint) ----Prevent Muted from changing nick function StopMuted() if isPlayerMuted( source ) or isTimer ( SpamTable[source].MuteTime ) then outputChatBox ( "[AntiSpam]:".. (string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "")) .."was kicked for trying to change his nick while muted!", source,0, 175 ,255 ) kickPlayer( source, AntiSpam, "You are muted dont change ur nick!" ) cancelEvent() end end addEventHandler("onPlayerChangeNick", getRootElement(), StopMuted) local disabledCmds = { [ "me" ] = true, [ "pm" ] = true } addEventHandler ( "onPlayerCommand", root, function ( cmd ) if disabledCmds [ cmd ] then if isPlayerMuted ( source ) or isTimer ( SpamTable[source].MuteTime) then outputChatBox ( "[AntiSpam]: ".. (string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "")) .." was kicked for trying to use commands while muted!", root, 0, 175 ,255 ) kickPlayer ( source, "AntiSpam: Dont try to use commands while muted!" ) end end end ) ----Functions--- ClearCount = {} g_MessageCount = {} function AntiSpam2 (message, messageType) thePlayer = getPlayerName( source ) if messageType == 0 if g_MessageCount = 1 then killTimer(ClearCount[thePlayer]) g_MessageCount[thePlayer] = 2 ClearCount[thePlayer] = setTimer( function(thePlayer) ClearCount[thePlayer] = 0 end, 10000, 1, thePlayer) outputChatBox("[AntiSpam]: You have been Warned.", source, 0, 170, 255) outputChatBox("[AntiSpam]: If you Spam again withing 10 secs, you will be muted.", source, 0, 170, 255) elseif g_MessageCount[thePlayer] = 0 then g_MessageCount[Player] = 1 ClearCount[thePlayer] = setTimer( function(thePlayer) ClearCount[thePlayer] = 0 end, 1500, 1, thePlayer) elseif g_MessageCount[thePlayer] = 2 then killTimer(ClearCount[thePlayer]) g_MessageCount[thePlayer] = 3 setPlayerMuted(thePlayer, true) ClearCount[thePlayer] = setTimer( function(thePlayer) ClearCount[thePlayer] = 0 setPlayerMuted(thePlayer, false) end, MuteTimePerMins*60*1000, 1, thePlayer) elseif g_MessageCount[thePlayer] = 3 then cancelEvent() end end end addEventHandler("onPlayerChat", getRootElement(), AntiSpam2) addEventHandler("onPlayerChat", getRootElement(), PreventFromMute)
  2. the information the owner has about the server he bought says it is NY... he has also another server he moved from LA to NY due to ping. i'll check with the owner the info he has about the server location
  3. Thank you for the kind words! right now at the time of the post, i've seen major lags and downtime from a server located in NY, is it general? avoiding that, its the best one i've seen so far. PD: the affected server i've checked on was 198.23.130.85:22005
  4. Thats not possible. the command mute alone mute and unmutes. you will have to use a custom command for that. function MutePlayer(player, victimName, command) if victimName then victimName = getPlayerName(victimName) if victim then if (not isPlayerMuted(victim)) then setPlayerMuted(victim, true) else outputChatBox("You have been muted by".. player .."", victim, 255, 0, 0) outputChatBox("".. victim .."is already muted!", source, 255, 0, 0) cancelEvent() end else outputChatBox("Could not find player with name: "..tostring(victimName),player, 255, 0, 0) end else outputChatBox("Usage: /m ",player, 255, 0, 0) addCommandHandler("m", MutePlayer)
  5. .:HyPeX:.

    SlothBot

    i got alot of errors from bad argument on lines 3, 10, 14 and 18.(getPlayersInTeam, getAccountdata, setAccountdata, compare a boolean). the one you did also spams the firt time zombie spawned message. i was also working out on my side, but i'm getting the debug message that the player isnt in the ZombieArena team.(i created the team via Admin panel and got me in). i havent still checked the main function. ZombieCap = {} function getaPlayer() local RandomPlayer = getRandomPlayer() local RandomPlayerTeam = getPlayerTeam(RandomPlayer) if RandomPlayerTeam == "ZombieArena" then g_Player = RandomPlayer if not ZombieCap[g_Player] then ZombieCap[g_Player] = 0 setTimer ( ZombieToEnemy, 50, 1 ) else outputChatBox("ZombieCap is already defined!") setTimer ( ZombieToEnemy, 50, 1 ) end else outputChatBox("RandomPlayerTeam is not == ZombieArena") end end setTimer(getaPlayer, 1000, 0) function ZombieToEnemy(Player) local isEnemy = getPlayerTeam( g_Player ) if not getAccountData( thePlayer, ZombiesKilled ) then outputChatBox("Welcome to the Zombie Arena, each zombie killed will give you $500", source) outputChatBox("If you recived this message it means its your first time in the Zombie Arena", source) outputChatBox("This also means there's a Zombie spawning near you. You can spend the money in the lobby", source) setAccountData( thePlayer, ZombiesKilled, 0) else outputChatBox("a zombie spawned near you, warning!", source) end if not ZombieCap[g_Player] > 20 then if IsEnemy == ZombieArena then ZombieCap[g_Player] = tonumber(ZombieCap[g_Player])+1 local X,Y,Z = getElementPosition( g_Player ) local Rot = getElementRotation( g_Player ) spawnBot( tonumber(X)+10, tonumber(Y)+10, tonumber(Z), tonumber(Rot), 10, 0, 50, nil, 0, "chasing", thePlayer) else outputChatBox("".. g_Player .." is not into ZombieArena team, Zombie spawning failed!") end else outputChatBox("" .. g_Player .." has reached the cap of Zombies allowed!") end end function ZombieKilled(attacker, weapon, bodypart) local thePlayer = getPlayerName( attacker ) if ( not ZombieCap[attacker] ) then ZombieCap[attacker] = 0 end ZombieCap[attacker] = tonumber(ZombieCap[attacker])-1 local account = getPlayerAccount( thePlayer ) local money = getPlayerMoney( thePlayer ) local KilledZombies = getAccountData( account, ZombiesKilled) setPlayerMoney( tonumber(money)+500 ) setAccountData( account, ZombiesKilled, tonumber(KilledZombies)+1) outputChatBox("".. thePlayer .." has killed a zombie and $500 were added to his account!") end addEventHandler("onBotWasted", getRootElement(), ZombieKilled)
  6. .:HyPeX:.

    SlothBot

    line 4: index table is nil
  7. .:HyPeX:.

    SlothBot

    error line 1: attempt to index global variable.. ZombieCap[thePlayer] = {} function ZombieToEnemy(Player) local ZombieTeam = getPlayersInTeam( ZombieArena ) local RandomPlayer = getRandomPlayer( ZombieTeam ) local thePlayer = getPlayerName( RandomPlayer ) local IsEnemy = getPlayerTeam( Player ) if not getAccountData( thePlayer, ZombiesKilled ) then outputChatBox("Welcome to the Zombie Arena, each zombie killed will give you $500", source) outputChatBox("If you recived this message it means its your first time in the Zombie Arena", source) outputChatBox("This also means there's a Zombie spawning near you. You can spend the money in the lobby", source) setAccountData( thePlayer, ZombiesKilled, 0) else outputChatBox("a zombie spawned near you, warning!", source) end if not ZombieCap[Player] > 20 then if IsEnemy == ZombieArena then ZombieCap[thePlayer] = tonumber(ZombieCap[Player])+1 local X,Y,Z = getElementPosition( Player ) local Rot = getElementRotation( Player ) spawnBot( tonumber(X)+10, tonumber(Y)+10, tonumber(Z), tonumber(Rot), 10, 0, 0, nil, 0, "chasing", thePlayer) else outputChatBox("".. thePlayer .." is not into ZombieArena team, Zombie spawning failed!") end else outputChatBox("" .. thePlayer .." has reached the cap of Zombies allowed!") end end setTimer( ZombieToEnemy, 1000, 0) function ZombieKilled(attacker, weapon, bodypart) local thePlayer = getPlayerName( attacker ) ZombieCap[thePlayer] = tonumber(ZombieCap[Player])-1 local account = getPlayerAccount( thePlayer ) local money = getPlayerMoney( thePlayer ) local KilledZombies = getAccountData( account, ZombiesKilled) setPlayerMoney( tonumber(money)+500 ) setAccountData( account, ZombiesKilled, tonumber(KilledZombies)+1) end outputChatBox("".. thePlayer .." has killed a zombie and $500 were added to his account!") addEventHandler("onBotWasted", getRootElement(), ZombieKilled)
  8. Remember Moderator uses Moderator ACL, SuperModerator uses Moderator and SuperModerator ACL, and admin uses the 3 group's ACLs.. Check if the other ones dont have also allowed mute.
  9. does the getammo get also the current clip? probably you are using only one clip (or half of it) and the script as it isnt saving the used clip is loading a new one... idk if you get what i mean..
  10. great, thanks for the help
  11. .:HyPeX:.

    SlothBot

    Hello, i'm working out slothbot, should this work? i've been doing it according to the wiki..https://wiki.multitheftauto.com/wiki/Slothman/Slothbot ZombieCap[thePlayer] = {} function ZombieToEnemy(Player) local ZombieTeam = getPlayersInTeam( ZombieArena ) local thePlayer = getRandomPlayer( ZombieTeam ) local IsEnemy = getPlayerTeam( Player ) if not ZombieCap[Player] > 20 then if IsEnemy == ZombieArena then ZombieCap[thePlayer] = tonumber(ZombieCap[Player])+1 local X,Y,Z = getElementPosition( Player ) local Rot = getElementRotation( Player ) spawnBot( tonumber(X)+10, tonumber(Y)+10, tonumber(Z), tonumber(Rot), 10, 0, 50, nil, 0, "chasing", Player) end end end EDIT//: ZombieCap[thePlayer] = {} function ZombieToEnemy(Player) local ZombieTeam = getPlayersInTeam( ZombieArena ) local RandomPlayer = getRandomPlayer( ZombieTeam ) local thePlayer = getPlayerName( RandomPlayer ) local IsEnemy = getPlayerTeam( Player ) if not getAccountData( thePlayer, ZombiesKilled ) then outputChatBox("Welcome to the Zombie Arena, each zombie killed will give you $500", source) outputChatBox("If you recived this message it means its your first time in the Zombie Arena", source) outputChatBox("This also means there's a Zombie spawning near you. You can spend the money in the lobby", source) setAccountData( thePlayer, ZombiesKilled, 0) else outputChatBox("a zombie spawned near you!", source) end if not ZombieCap[Player] > 20 then if IsEnemy == ZombieArena then ZombieCap[thePlayer] = tonumber(ZombieCap[Player])+1 local X,Y,Z = getElementPosition( Player ) local Rot = getElementRotation( Player ) spawnBot( tonumber(X)+10, tonumber(Y)+10, tonumber(Z), tonumber(Rot), 10, 0, 50, nil, 0, "chasing", Player) end end end function ZombieKilled(attacker, weapon, bodypart) local thePlayer = getPlayerName( attacker ) ZombieCap[thePlayer] = tonumber(ZombieCap[Player])-1 local account = getPlayerAccount( thePlayer ) local money = getPlayerMoney( thePlayer ) local KilledZombies = getAccountData( account, ZombiesKilled) setPlayerMoney( tonumber(money)+500 ) setAccountData( account, ZombiesKilled, tonumber(KilledZombies)+1) end addEventHandler("onBotWasted", getRootElement(), ZombieKilled)
  12. .:HyPeX:.

    AntiSpam

    With the code i did i should be able to cancel it inside the server, but they can come with the binds from outside. I can block the player from using the say(the bind will do that) but im not sure if it would or not cancel the normal command, since its: Bind = say T = chatbox:say
  13. if i want to load a 2nd arena but at a different function, this version of the code will work? (assuming the original is in a function before) addEventHandler ( "onResourceStart", resourceRoot, function ( ) local xml = xmlLoadFile ( "Lobby.map" ) local Mapnode = xmlNodeGetChildren ( xml ) g_ObjectsLobby = { } for _, node in ipairs ( Mapnode ) do local attrs = xmlNodeGetAttributes ( node ) table.insert ( g_ObjectsLobby, { attrs.model, attrs.scale, attrs.posX, attrs.posY, attrs.rotX, attrs.rotY, attrs.rotZ } ) end end ) function CreateLobby ( ) for index = 1, #g_ObjectsLobby do local ob2 = g_ObjectsLobby [ index ] local objectLobby = createObject ( tonumber ( ob2 [ 1 ] ), tonumber ( ob2 [ 3 ] ), tonumber ( ob2 [ 4 ] ), tonumber ( ob [ 5 ] ), tonumber ( ob [ 6 ] ), tonumber ( ob2 [ 7 ] ), tonumber ( ob2 [ 8 ] ), false ) setElementDimension ( objectLobby, 0 ) setObjectScale ( objectLobby, ob2 [ 2 ] ) end end
  14. Like this? addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() local xml = xmlLoadFile("ZombieArena.map") local Mapnode = xmlNodeGetChildren(xml) g_Objects = {} for i,node in ipairs(MapObjects) do local model = xmlNodeGetChildren(Mapnode, "model") local Scale = xmlNodeGetChildren(Mapnode, "scale") local ZombieX = xmlNodeGetChildren(Mapnode, "posX") local ZombieY = xmlNodeGetChildren(Mapnode, "posY") local ZombieZ = xmlNodeGetChildren(Mapnode, "posZ") local ZombieRX = xmlNodeGetChildren(Mapnode, "rotX") local ZombieRY = xmlNodeGetChildren(Mapnode, "rotY") local ZombieRZ = xmlNodeGetChildren(Mapnode, "rotZ") g_Objects[i] = xmlNodeGetValue(model, scale, ZombieX, ZombieY, ZombieZ, ZombieRX, ZombieRY, ZombieRZ) end end ) function CreateZombieArena() local ObjectCount = #g_Objects for i in g_Objects do createObject( tonumber(model), tonumber(ZombieX),tonumber(ZombieY), tonumber(ZombieZ), tonumber(ZombieRX), tonumber(ZombieRY), tonumber(ZombieRZ), false ) setElementDimension( "createObject", 50 ) setObjectScale( "createObject", Scale ) end end addEventHandler("LoadZombieArena", getRootElement(), CreateZombieArena)
  15. Like this? function CreateZombieArena() local xml = xmlLoadFile("ZombieArena.map") local Mapnode = xmlFindChild ( Map, "Object id", 0 ) local model = xmlNodeGetChildren(xml, "model") local dimension = 50 local Scale = xmlNodeGetChildren(xml, "scale") local ZombieX = xmlNodeGetChildren(xml, "posX") local ZombieY = xmlNodeGetChildren(xml, "posY") local ZombieZ = xmlNodeGetChildren(xml, "posZ") local ZombieRX = xmlNodeGetChildren(xml, "rotX") local ZombieRY = xmlNodeGetChildren(xml, "rotY") local ZombieRZ = xmlNodeGetChildren(xml, "rotZ") for i,node in ipairs(MapNode) do createObject[i]( tonumber(model), tonumber(ZombieX),tonumber(ZombieY), tonumber(ZombieZ), tonumber(ZombieRX), tonumber(ZombieRY), tonumber(ZombieRZ), false ) setElementDimension( "Object id", dimension ) setObjectScale( "Object id", Scale ) end end addEventHandler("LoadZombieArena", getRootElement(), CreateZombieArena)
  16. how could i do it then? is it the workout of getting the element right? (locals)
  17. .:HyPeX:.

    AntiSpam

    Wich one, mine or the one you posted? the one you posted will only block message repeating, and i want to block players if they manage to flood the chat too
  18. should this work? function CreateZombieArena() local xml = xmlLoadFile("ZombieArena.map") local Mapnode = xmlFindChild ( Map, "Object id", 0 ) local model = xmlNodeGetAttribute(xml, "model") local dimension = 50 local Scale = xmlNodeGetAttribute(xml, "scale") local ZombieX = xmlNodeGetAttribute(xml, "posX") local ZombieY = xmlNodeGetAttribute(xml, "posY") local ZombieZ = xmlNodeGetAttribute(xml, "posZ") local ZombieRX = xmlNodeGetAttribute(xml, "rotX") local ZombieRY = xmlNodeGetAttribute(xml, "rotY") local ZombieRZ = xmlNodeGetAttribute(xml, "rotZ") for Mapnode do createObject( tonumber(model), tonumber(ZombieX),tonumber(ZombieY), tonumber(ZombieZ), tonumber(ZombieRX), tonumber(ZombieRY), tonumber(ZombieRZ), false ) setElementDimension( "Object id", dimension ) setObjectScale( "Object id", Scale end addEventHandler("LoadZombieArena", getRootElement(), CreateZombieArena)
  19. Hello, i know i can Createobjects with createObject(), but if i create a map within the map editor, then the .map will contain all the objects. Is there a function to actually load the .map? or i should create the object script 1 by 1, becouse if i load the map directly it would be alot easier. Thanks. HyPeX
  20. .:HyPeX:.

    AntiSpam

    How could i prevent it?
  21. Um, did you just try to get the account of a vehicle? lol local car = getPedOccupiedVehicle(hitElement) i was using his local before
  22. .:HyPeX:.

    AntiSpam

    Oh and if i use different messages (bind say a and bind say b) i can totally spam the thing.
  23. If you meant to get the Damage of the weapon to the ped then its easy, just you need to get the damage. about using tables.. i still do not know how to read them correctly, i'm still playing over them. This should make it easier. function onpeddamge(attacker, weapon, bodypart, loss) -- Your function local weaponType = getPedWeapon(attacker) -- Getting the weapon.. if weaponType == 1 then -- If its this weapon then give it a string name(letters) local PedAtacker = M4 elseif weaponType == 2 then local PedAtacker = AK-47 elseif weaponType == 3 then local Pedatacker = Shotgun elseif weaponType == 4 then local Pedatacker = Silenced end if PedAtacker == M4 then -- Give the weapons a damage local PedAttackerWeapon = 100 elseif PedAtacker == AK-47 then local PedAttackerWeapon = 80 elseif PedAtacker == Shotgun then local PedAttackerWeapon = 100 elseif PedAtacker == Silenced then local PedAttackerWeapon = 10 end end setElementHealth ( source, ( getElementHealth (source) - PedAttackerWeapon) ) outputChatBox("You did".. PedAttackerWeapon .."damage with a ".. PedAtacker .." to the zombie!",source, true, 50, 255, 50) end addEventHandler ( "onClientPedDamage", getRootElement(), onpeddamage )
  24. You are not getting the Weapon type over those scripts so Weapon will not apply. also you got some -- over there wich might be blocking the function.
  25. well, you can edit the variables of the gun.. not sure if concat will work like this, never used it. -----------Zombie Managing---------- local ZombieCap = 10 -- Max zombies to spawn local alivezombies = 0 -- Current Zombies alive --------Weapon Managing-------------- local Weapon1 = 1 local Weapon2 = 2 local Weapon3 = 3 local Weapon4 = 4 local Weapon5 = 5 local Weapon6 = 6 local Weapon = { Weapon1 = {10}; -- Just edit values according to Weapon Type Weapon2 = {20}; Weapon3 = {30}; Weapon4 = {40}; Weapon5 = {50}; Weapon6 = {60}; };-- you can add more tables ----------------Function for Spawning Zombies------------- function zombies() if ZombieCap < alivezombies then local X, Y, Z = getElementPosition(getRandomPlayer) -- get Player Position local ZombiePed = createPed ( 10,X+10, Y-10,Z) -- Create the zombie next to player setElementData(ZombiePed, Blood, 5000) local alivezombies = alivezombies + 1 -- New Zombie to count end end --------Function for Damage on Zombies or kill---------------- function pedDamagep(attacker, weapon, bodypart, loss) local WeaponDamage local thePedZombie = getElementModel(source) -- get if its a zombie local weaponType = getPedWeapon(attacker) local WeaponDamage = table.concat(Weapon, weaponType) local Health = getElementData(source, Blood) if weaponType > 0 then -- If player has a weapon setElementData(source, Blood, Health-WeaponDamage) else if thePedZombie = 10 then -- Check the zombie setElementData(source, Blood, Health-ClientPedDamage) cancelEvent(ClientPedDamage) if getElementData(source, "Blood") <= 0 then outputChatBox("Ped died!", getLocalPlayer()) local x, y, z = getElementPosition(source) local alivezombies = alivezombies - 1 -- Zombie died, spawn a new one end end end end addEventHandler("onClientPedDamage", getRootElement(), pedDamagep)
×
×
  • Create New...