Jump to content

.:HyPeX:.

Members
  • Posts

    1,255
  • Joined

  • Last visited

Everything posted by .:HyPeX:.

  1. Just a quick thingy.. not sure if it helps or not local ZombieCap = 10 -- Max zombies to spawn local alivezombies = 0 -- Current Zombies alive 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 pedDamagep(attacker, weapon, bodypart, loss) local thePedZombie = getElementModel(source) -- get if its a zombie if thePedZombie = 10 then -- Check the zombie local Health = getElementData(source, Blood) 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 addEventHandler("onClientPedDamage", getRootElement(), pedDamagep)
  2. Searching user's post.. found this viewtopic.php?f=91&t=63362&p=617760#p617760 we should suppose he is using elementData then.
  3. .:HyPeX:.

    AntiSpam

    but that would interfer the rest of the script, so i'll keep to the locals PD: still not working, im muted after logging in and its not saying anything. Also sleft will not work unless i say something. i'm not seeing any message when i'm muted for 5 mins.
  4. .:HyPeX:.

    AntiSpam

    isnt it already defined as local on the previous function?
  5. That didnt worked? try this instead.. local accountSource = getPlayerAccount ( car )
  6. .:HyPeX:.

    AntiSpam

    Nothing, i'm just muted after loging in.
  7. .:HyPeX:.

    AntiSpam

    Regardless everyhing, i tried to give the players mute even if they left to avoid them from reconnecting and unmuting.. but i really dont see any error here, can someone tell me why the player isnt being muted after loggin in.. ----Anti-Spam-Script-by-HyPeX-- ----Locals---- ------------------------------- ----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 SpamTable[player].Mute = false end end, 5*60*1000, 1, source ) setPlayerMuted(source, true) setTimer(UnMutePlayer, 5*60*1000, 1) outputChatBox("[AntiSpam]: ".. (string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "")) .." has have been muted for flooding for 5 Mins.", 0, 170, 255) 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 then if 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 ) 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() if isPlayerMuted( source ) then setPlayerMuted(source, false) else outputchatbox ( "[AntiSpam]:".. (string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "")) .."is now unmuted!", 0, 175 ,255 ) end end ----Manage on quit or join function OnPlayerMutedLeft() if isPlayerMuted( source ) or isTimer ( SpamTable[source].MuteTime )then local remaining, executesRemaining, totalExecutes = getTimerDetails ( SpamTable[source].MuteTime ) local playerAccount = getPlayerAccount(source) setAccountData( playerAccount, MutedTimeScript, remaining ) setPlayerMuted( source, false) killTimer(SpamTable[source].MuteTime) else setAccountData( playerAccout, MutedtimeScript, 0 ) end end addEventHandler("onPlayerQuit", getRootElement(), OnPlayerMutedLeft) function OnPlayerMutedJoint() local playerAccount = getPlayerAccount(source) if getAccountData(playerAccount,MutedTimeScript) > 0 then local MutedLeft = getAccountData( playerAccount, MutedTimeScript ) setPlayerMuted(source, true) setAccountData( playerAccount, MutedTimeScript, 0 ) setTimer(UnmutePlayer, MutedLeft, 1 ) SpamTable[source].MuteTime = setTimer ( function ( player ) if isElement ( player ) then SpamTable[player].Mute = false end end, 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(remaining/60/1000), math.fmod(math.floor(remaining/1000),60)), source, 0, 170, 255, true ) end end addEventHandler("onPlayerLogin", getRootElement(), OnPlayerMutedJoint) ----Prevent Muted from changing nick function StopMuted() if isPlayerMuted( source ) or isTimer ( SpamTable[source].MuteTime ) then outputchatbox ( "[AntiSpam]:".. (string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "")) .."was kicked for trying to change his nick while muted!", 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(p), "#%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 )
  8. .:HyPeX:.

    AntiSpam

    tables arent being used already by the [source]?
  9. Okay just totally missed the points, turn out i cant use the string to read a table, how can i use the same function string.match does on a table? Thanks HyPeX
  10. how? this should be the totally fixed end (without saying that) ----Reservation-Script-by-HyPeX-- ----Locals---- local Players = {} local g_PlayerCount = getPlayerCount() local LastLogued = table.match(Players, ~=LxG, 99999) local TablePos = getElementData( source, TablePosition ) local accPlayer = getPlayerAccount( source ) local Name = getPlayerName(source) ------------------------------- ----Messages of Startup---- outputChatBox ("#00aaff[Reservation]: 32nd Slot is Now reserved for LxG Members!",root, 255, 255, 255, true) ------------------------------- ----Functions--- antiFake = {} function credits(onPlayerJoin) setElementData( accPlayer, TablePosition, math.random( 99999 )) table.insert(Players, TablePos, Name) if g_PlayerCount == 2 then if string.match(Name, LxG) = LxG then outputChatBox( "Welcome LxG Player, You are joining in a reserved Slot", source, 55, 125, 255 ) antiFake[source] = setTimer(function(source) antiFake[source] = nil end, 1000*60*2, 1, source) kickPlayer(LastLogued, Reservation, you were kicked becouse you were the lastest player who joined. sorry ) else kickPlayer(source, Reservation, this slot is reserved for LxG Members. sorry ) end else outputChatBox ( "Reserved Slot for LxG Members Script Online", source, 55, 125, 255 ) end end addEventHandler("onPlayerJoin", root, credits) function antiFakeLogin() Player = getPlayerFromName( source ) if isTimer(antiFake[source]) then outputchatbox ( "[Reservation]:"..Player.."was kicked for trying to fake the reserved slot!", 0, 175 ,255 ) kickPlayer( source, Reservation, Dont fake the reservation slot! ) end end addEventHandler("onPlayerChangeNick", getRootElement(), antiFakeLogin) function ClearPlayerLeaving table.remove( Players, TablePos ) removeElementData( accPlayer, TablePosition ) end addEventHandler ( "onPlayerQuit", resourceRoot, ClearPlayerLeaving )
  11. I've been working alot since this.. this is my end script.. (not sure if it will work the actual search of the name i asked on the previous post.. but if it does) ----Reservation-Script-by-HyPeX-- ----Locals---- local Players = {} local g_PlayerCount = getPlayerCount() local LastLogued = table.gmatch(Players, ~LxG) local TablePos = getElementData( source, TablePosition ) local accPlayer = getPlayerAccount( source ) ------------------------------- ----Messages of Startup---- outputChatBox ("#00aaff[Reservation]: 32nd Slot is Now reserved for LxG Members!",root, 255, 255, 255, true) ------------------------------- ----Functions--- antiFake = {} function credits(onPlayerJoin) local Name = getPlayerName(source) setElementData( accPlayer, TablePosition, math.random( 99999 )) table.insert(Players, TablePos, Name) if g_PlayerCount == 31 then if string.match(Name, LxG) = LxG then outputChatBox( "Welcome LxG Player, You are joining in a reserved Slot", source, 55, 125, 255 ) antiFake[source] = setTimer(function(source) antiFake[source] = nil end, 1000*60*2, 1, source) if string.match(LastLogued, LxG) then kickPlayer (LastLogued, Reservation, you were kicked becouse you were the lastest player who joined, sorry ) else kickPlayer(source, Reservation, This slot is reserved for a LxG Member, we're sorry) end else outputChatBox ( "Reserved Slot for LxG Members Script Online", source, 55, 125, 255 ) end end addEventHandler("onPlayerJoin", root, credits) function antiFakeLogin() Player = getPlayerFromName( source ) if isTimer(antiFake[source]) then outputchatbox ( "[Reservation]:"..Player.."was kicked for trying to fake the reserved slot!", 0, 175 ,255 ) kickPlayer( source, Reservation, Dont fake the reservation slot! ) end end addEventHandler("onPlayerChangeNick", getRootElement(), antiFakeLogin) addEventHandler ( "onResourceStop", resourceRoot, table.remove( Players, TablePos ) removeElementData( source, TablePosition ) addEventHandler ( "onPlayerQuit", root, onDeleteTables )
  12. .:HyPeX:.

    Help

    he got a local on that already so.. dxDrawText ( "#0080FFNitro: [size=6][b]..hColor..[/b][/size]".. ( type ( fNitroLevel ) == "number" and fNitroLevel .."#0080FF%" or "No nitro" ), (rx - 199 ), ( ry - 29), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1, "default-bold", "left", "top", false, false, true, true, false )
  13. .:HyPeX:.

    Help

    you will need to do some maths, the percentage goes over 100, the car colours over 255. (since you got the variable already you will only need to do the car colour.) probably: //EDIT: setTimer(function() local r, g, b = ( fNitroLevel*2.5, fNitroLevel/2.5, [fNitroLevel*3]/4 ) setVehicleColor( car, r, g, b ) end, 500, 0)
  14. Found this problem.. i want to find the lastest player who joined who hasnt got the LxG in its name(to avoid kicking LxG players) How could i do the opposite into a table? like this? local LastLogued = table.gmatch(Players, ~LxG)
  15. Just came out with the idea, we got a 32 Slot server on our clan, is there a function to get player count? (i know i could count them with like a joinquit and a table or local) but i'm asking if there is a function to get current player count in the server. This is to let only 31 players join and reserve a slot for the members (via getPlayerName on join). Thanks HyPeX
  16. Kick a player when he uses the /me or /pm command if he is muted.
  17. i've further worked it out a bit, but i might stop here, i'm trying to get the command itself and check if its one i want to be blocked in a muted guy. local Checktable = CommandTable = {} function StopCommands(commandname) local thecommand = string.match(commandname) local Player = getPlayerFromName( source ) table.insert( CommandTable[ thecommand ] ) if isPlayerMuted( source ) and if Checktable = true then outputchatbox ( "[AntiSpam]:"..Player.."was kicked for trying to change his nick while muted!", 0, 175 ,255 ) kickPlayer( source, AntiSpam, Dont try to use commands while muted! ) end end addEventHandler("onPlayerCommand", getRootElement(), StopCommands) function(g_CheckTable) if string.match( CommandTable, me) or string.match( CommandTable, pm ) then Checktable = true end end addEventHandler("onPlayerCommand", getRootElement(), g_CheckTable)
  18. Can i get Wich the command was? would this work? function StopCommands(commandname) local CommandNotSay = string.match(commandname, say) Player = getPlayerFromName( source ) if isPlayerMuted( source ) and if CommandNotSay = nil then outputchatbox ( "[AntiSpam]:"..Player.."was kicked for trying to use commands while muted!", 0, 175 ,255 ) kickPlayer( source, AntiSpam, Dont try to use commands while muted! ) addEventHandler("onPlayerCommand", getRootElement(), StopCommands)
  19. There isnt some compile programs arround the web? i've heared someone saying that somewhere..
  20. .:HyPeX:.

    arrays

    I'm not sure that you can make someone or something be on two teams, the tab would just bug up to start with..
  21. what are the function or event for maps? (onmapchange, isnextmap, etc) i couldnt find them with the search on the wiki..
  22. .:HyPeX:.

    AntiSpam

    Noticed the code takes ALL messages into account, in a server with lots of players a player can get muted alone (if Player A Writes and player B in less than 1sec, you get the warning). Should the usage of "source" fix it?
  23. .:HyPeX:.

    AntiSpam

    i also noticed you did the time 5*60*1000 and remaining/60/1000, that will output seconds and minutes alone? Thanks again HyPeX
×
×
  • Create New...