Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --By: Superzilla, Older versions by Soap and Superzilla
- --antiname = false -- requires client side modification, prevents players from joining with the same name
- hide_speed = 5 -- self explanatory
- falldamage = 0.375 --Is a percentage
- vehidamage = 0 --Is a percentage
- weapontotal = 3 --Total weapons. (If enabled third weapon will be a plasma pistol)
- sprotect = 5 -- spawn protection time, in seconds, (0 to disable)
- mdamage = 1 -- Modified damage, 1 to turn off, othersise use a decimal (ex, mdamage = .75 would reduce damage by 75%, mdamage = 2 would double damage)
- -----Chat Settings-----
- chatFilter = true -- to add words to filter open your chatFilter.txt in your server's profile path.
- -----Custom Nades-----
- cnades = 1 -- custom nades on (1) or off (0). If you have infinate nades on, turn this off (0), or if you want to use gametype default, turn this off.
- fragamount = 3 -- how many frag nades the player is to spawn with. More than 4 may cause errors.
- plasmaamount = 2 -- how many plasma nades the player is to spawn with. More than 4 may cause errors.
- -----Command Aliases-----
- commandAlias = {} -- Don't touch this line
- ----Example: commandAlias[numbergoeshere] = {"real command", "what you want it to work as"}
- commandAlias[1] = {"sv_kick", "sv_k"}
- commandAlias[2] = {"sv_admin_add", "sv_a"}
- commandAlias[3] = {"sv_admin_cur", "sv_viewadmins"}
- commandAlias[4] = {"sv_map", "sv_m"}
- commandAlias[5] = {"sv_mapcycle_begin", "sv_mc"}
- commandAlias[6] = {"sv_map_reset", "sv_reset"}
- commandAlias[7] = {"sv_players", "sv_pl"}
- commandAlias[8] = {"sv_ban", "sv_b"}
- commandAlias[9] = {"sv_falldmg", "sv_falldamage"}
- commandAlias[10] = {"sv_pnades", "sv_setplasmas"}
- commandAlias[11] = {"sv_teleport_pl", "sv_tp"}
- commandAlias[10] = {"sv_fnades", "sv_setfrags"}
- commandAlias[11] = {"sv_unipban", "sv_ipunban"}
- -- Don't touch below here, if you do, and you're a noob, you probably just screwed up something...
- jacking = {}
- t_boslist = {}
- pastplayer = {}
- protected = {}
- weapdespawning = {}
- messages = {}
- flamebrains = {}
- hidden = {} -- hidden players
- flying = {}
- muted = {} -- muted players
- damagequery = {} --players who have damagequery on
- scriptName = "sCommands"
- scriptVersion = "2"
- t_ipbanlist = {}
- filteredWords = {}
- camera_size = 0x30
- camera_base = 0x69C2F8
- command_execute = false
- T_publicCmdHandler = true --Set this defalut to true if you want this script to handle @<command> text commands
- T_adminCmdHandler = true --Set this default to true if you want this script to handle /<command> text commands
- T_rAdminCmdHandler = false --Set this default to true if you want this script to handle \<command> text commands
- handledCommands = { --[[Commands that this script should handle by default]]--
- "sv_hide",
- "sv_unhide",
- "sv_myobj",
- "sv_splatterdmg",
- "sv_falldmg",
- "sv_damageq",
- "sv_mdamage",
- "sv_pnades",
- "sv_fnades",
- "sv_cnades",
- "sv_ipban",
- "sv_ipbanlist",
- "sv_unipban",
- "sv_superban",
- "sv_commandAlias",
- "sv_k",
- "sv_a",
- "sv_viewadmins",
- "sv_m",
- "sv_mc",
- "sv_reset",
- "sv_pl",
- "sv_b",
- "sv_falldamage",
- "sv_setplasmas",
- "sv_tp",
- "sv_setfrags",
- "sv_ipunban",
- "sv_addfilter",
- "sv_fly",
- "sv_camq",
- "sv_hsay",
- "sv_bos",
- "sv_boslist",
- "sv_unbos",
- "sv_viewip",
- "sv_weapontotal"
- }
- --[[r_names = {} -- the feature that corresponds with this table needs client side modification
- r_names[1] = {"Bieber",false}
- r_names[2] = {"Minaj",false}
- r_names[3] = {"Timberlake",false}
- r_names[4] = {"Pelosi",false}
- r_names[5] = {"McCain",false}
- r_names[6] = {"Bush",false}
- r_names[7] = {"Obama",false}
- r_names[8] = {"Boo Boo",false}
- r_names[9] = {"LeBeouf",false}
- r_names[10] = {"Lil Wayne",false}
- r_names[11] = {"Carey",false}
- r_names[12] = {"Ferril",false}
- r_names[13] = {"Colbert",false}
- r_names[14] = {"Sanchez",false}
- r_names[15] = {"Dynamite",false}
- r_names[16] = {"JayZ",false}--]]
- --Objects Table (for handling purposes) (also origionally from wizard's scriptoid)
- objects = {}
- -- Bipeds
- objects[1] = {"cyborg", "bipd", "characters\\cyborg_mp\\cyborg_mp"}
- -- Equipment
- objects[2] = {"camo", "eqip", "powerups\\active camouflage"}
- objects[3] = {"health", "eqip", "powerups\\health pack"}
- objects[4] = {"overshield", "eqip", "powerups\\over shield"}
- objects[5] = {"fnade", "eqip", "weapons\\frag grenade\\frag grenade"}
- objects[6] = {"pnade", "eqip", "weapons\\plasma grenade\\plasma grenade"}
- -- Vehicles
- objects[7] = {"shee", "vehi", "vehicles\\banshee\\banshee_mp"}
- objects[8] = {"turret", "vehi", "vehicles\\c gun turret\\c gun turret_mp"}
- objects[9] = {"ghost", "vehi", "vehicles\\ghost\\ghost_mp"}
- objects[10] = {"rhog", "vehi", "vehicles\\rwarthog\\rwarthog"}
- objects[11] = {"tank", "vehi", "vehicles\\scorpion\\scorpion_mp"}
- objects[12] = {"hog", "vehi", "vehicles\\warthog\\mp_warthog"}
- -- Weapons
- objects[13] = {"rifle", "weap", "weapons\\assault rifle\\assault rifle"}
- objects[14] = {"ball", "weap", "weapons\\ball\\ball"}
- objects[15] = {"flag", "weap", "weapons\\flag\\flag"}
- objects[16] = {"flamethrower", "weap", "weapons\\flamethrower\\flamethrower"}
- objects[17] = {"needler", "weap", "weapons\\needler\\mp_needler"}
- objects[18] = {"pistol", "weap", "weapons\\pistol\\pistol"}
- objects[19] = {"ppistol", "weap", "weapons\\plasma pistol\\plasma pistol"}
- objects[20] = {"prifle", "weap", "weapons\\plasma rifle\\plasma rifle"}
- objects[21] = {"frg", "weap", "weapons\\plasma_cannon\\plasma_cannon"}
- objects[22] = {"rocket", "weap", "weapons\\rocket launcher\\rocket launcher"}
- objects[23] = {"shotgun", "weap", "weapons\\shotgun\\shotgun"}
- objects[24] = {"sniper", "weap", "weapons\\sniper rifle\\sniper rifle"}
- -- Projectiles
- objects[25] = {"sheebolt", "proj", "vehicles\\banshee\\banshee bolt"}
- objects[26] = {"sheerod", "proj", "vehicles\\banshee\\mp_banshee fuel rod"}
- objects[27] = {"turretbolt", "proj", "vehicles\\c gun turret\\mp gun turret"}
- objects[28] = {"ghostbolt", "proj", "vehicles\\ghost\\ghost bolt"}
- objects[29] = {"tankshot", "proj", "vehicles\\scorpion\\bullet"}
- objects[30] = {"tankshell", "proj", "vehicles\\scorpion\\tank shell"}
- objects[31] = {"hogshot", "proj", "vehicles\\warthog\\bullet"}
- objects[32] = {"rifleshot", "proj", "weapons\\assault rifle\\bullet"}
- objects[33] = {"flame", "proj", "weapons\\flamethrower\\flame"}
- objects[34] = {"needlershot", "proj", "weapons\\needler\\mp_needle"}
- objects[35] = {"pistolshot", "proj", "weapons\\pistol\\bullet"}
- objects[36] = {"ppistolbolt", "proj", "weapons\\plasma pistol\\bolt"}
- objects[37] = {"priflebolt", "proj", "weapons\\plasma rifle\\bolt"}
- objects[38] = {"priflecbolt", "proj", "weapons\\plasma rifle\\charged bolt"}
- objects[39] = {"rocketproj", "proj", "weapons\\rocket launcher\\rocket"}
- objects[40] = {"shottyshot", "proj", "weapons\\shotgun\\pellet"}
- objects[41] = {"snipershot", "proj", "weapons\\sniper rifle\\sniper bullet"}
- function GetRequiredVersion()
- return 10057
- end
- function OnScriptLoad(process)
- profilepath = getprofilepath()
- registertimer(30, "hide")
- registertimer(1000*60*5, "servertimer")
- registertimer(500, "HprintTimer")
- --registertimer(10, "fly")
- if falldamage == 0 then --DEFINATELY DONT TOUCH THIS IF
- falldamage = 0.00001 --IF YOU TOUCH THIS YOU WILL BE SORRY
- end --IF YOU SCREW ANYTHING UP, I TOLD YOU SO
- --[[If the server has a falldamage of 0 then the player can't exit]]--
- commandsHandler()
- filterLoad()
- ipbanlist(0)
- boslist(1)
- end
- function OnScriptUnload()
- filterSave()
- end
- function OnNewGame(map)
- end
- function OnGameEnd(mode)
- end
- function OnServerChat(player, chattype, message)
- local response = 1 --returns this variable when this function has completed. 1 means that the message should go through, 0 to block it.
- local hash = gethash(player) --sets local variable hash to the player's hash who has done the message
- local name = getname(player) --sets local variable name to the player's name who has done the message
- local first_character = string.sub(message, 1, 1) --see if this is a /, \, or @ command
- if first_character == "@" and T_publicCmdHandler == true then -- public commands, if the first character is @ and this script handles public commands then
- local message = string.sub(message, 2) --gets the command (after the @)
- local count = gettokencount(message, " ") --gets the amount of words/paramaters.
- local t = {} --local table t
- -- insert the tokens (words) into a table
- for i=1,count do --i=1 then after i reaches local variable count stop the loop
- local word = gettoken(message, " ", i - 1) -- sets local variable "word" to token i-1 with a space separating the tokens
- word = string.lower(word) --converts the string to all lowercase
- word = word:gsub('"', "") --sets local variable "word" to word without the quotes.
- table.insert(t, word) --puts local variable "word"
- end --end of the code to loop
- if t[1] == "suicide" then --if t[1] (the command) is suicide then
- kill(player) -- kill the player
- end
- response = 0 --set response to 0 (don't send to public chat)
- elseif first_character == "/" and T_adminCmdHandler == true then -- admin commands, if the first character is / and this script handles admin commands then
- if string.sub(message, 2, player) ~= "reloadscripts" then --if the command (everything after the 1st character) isn't reloadscripts then
- svcmd("sv_" .. string.sub(message, 2), player) --execute the command with sv_ appended to the beggining.
- else
- privateSay(player, "You cannot use this command.") --private console message
- end
- response = 0 --set response to 0 (don't send to public chat)
- elseif chatFilter == true then
- local count = gettokencount(message, " ") --gets the amount of words/paramaters.
- -- insert the tokens (words) into a table
- for i=1,count do --i=1 then after i reaches local variable count stop the loop
- local word = gettoken(message, " ", i - 1) -- sets local variable "word" to token i-1 with a space separating the tokens
- word = string.lower(word) --converts the string to all lowercase
- word = word:gsub('"', "")
- word = word:gsub("_", "")
- word = word:gsub("-", "")
- for i,v in ipairs(filteredWords) do
- if word == v then response = 0 end
- end
- end --end of the code to loop
- end
- return response
- end
- function OnServerCommand(player, command)
- local handledcommand = false
- local response = 1 --returns this variable when this function has completed. 1 means that the command should go through, 0 to block it.
- local hash = gethash(player) --sets local variable hash to the player's hash who has done the command
- local name = getname(player) --sets local variable hash to the player's hash who has done the command
- local toksize = getcmdtokencount(command) --same as count in OnServerChat except words in-between quotes are counted as one.
- local cmd = getcmdtoken(command, 0) --Command being executed
- local t = {}
- -- insert the tokens (words) into a table
- for i=1,toksize do --i=1 then after i reaches local variable "toksize" stop the loop
- local word = getcmdtoken(command, i-1)
- table.insert(t, word)
- end
- for i = 1 , #handledCommands--[[Amount of handled commands]] do --loop through all of the handled commands.
- if t[1] == handledCommands[i] then -- if t[1] (the command) is a handled command
- if t[1] == "sv_hide" then response = hidecommand(player,hash)-- hide command
- elseif t[1] == "sv_unhide" then response = unhidecommand(player,hash)-- unhide command
- elseif t[1] == "sv_myobj" then response = myobj(player,hash) --myobj command
- elseif t[1] == "sv_splatterdmg" then response = splatterdmgCommand(player, hash,t[2])--splatterdmg command
- elseif t[1] == "sv_falldmg" then response = falldmgCommand(player,hash,t[2]) --falldmg command
- elseif t[1] == "sv_damageq" then response = damageqCommand(player,hash) --damage query command
- elseif t[1] == "sv_mdamage" then response = mdamageCommand(player,hash, t[2]) --falldmg command
- elseif t[1] == "sv_pnades" then response = pnadesCommand(player,hash, t[2])
- elseif t[1] == "sv_fnades" then response = fnadesCommand(player,hash, t[2])
- elseif t[1] == "sv_cnades" then response = cnadesCommand(player,hash)
- elseif t[1] == "sv_ipban" then response = ipbanCommand(player, hash, t[2])
- elseif t[1] == "sv_ipbanlist" then response = ipbanlistCommand(player, hash)
- elseif t[1] == "sv_unipban" then response = unipbanCommand(player, hash, t[2])
- elseif t[1] == "sv_superban" then response = superbanCommand(player, hash, t[2])
- elseif t[1] == "sv_addfilter" then response = addfilterCommand(player, hash, t[2])
- elseif t[1] == "sv_camq" then response = cameQueryCommand(player)
- elseif t[1] == "sv_hsay" then response = hsayCommand(player, t[2])
- elseif t[1] == "sv_bos" then response = bosCommand(t[2])
- elseif t[1] == "sv_unbos" then response = unbosCommand(t[2])
- elseif t[1] == "sv_boslist" then response = boslistCommand(player, hash)
- elseif t[1] == "sv_viewip" then response = viewipCommand(t[2])
- elseif t[1] == "sv_weapontotal" then response = weapontotalCommand(t[2])
- --elseif t[1] == "sv_fly" then response = flycommand(player, hash) -- requires client side modification
- --elseif t[1] == "sv_samename" then response = samename(t[2] - 1) -- requires client side modification
- --elseif t[1] == "sv_antiname" then response = antinameCommand() -- requires client side modification
- --elseif t[1] == "sv_sj" then response = sjCommand(player, t[2])-- requires client side modification
- else
- for ib = 1, table.getn(commandAlias) do
- if commandAlias[ib][2] == t[1] then
- if commandAlias[ib][2] == handledCommands[i] then
- local rebuiltCommand = commandAlias[ib][1] .. string.sub(command, string.len(commandAlias[ib][2]) + 1)
- response = 0
- svcmd(rebuiltCommand, player)
- end
- end
- end
- end
- end
- end
- if response ~= 0 and response ~= 1 then
- privateSay(player, response)
- saidsomething = true
- response = 0
- end
- return response
- end
- function OnTeamDecision(cur_team)
- end
- function OnPlayerJoin(player, team)
- local pip = getip(player)
- local hash = gethash(player)
- for i,v in ipairs(t_ipbanlist) do
- for k,p in ipairs(t_ipbanlist[i]) do
- if p == pip then svcmd("sv_kick " .. player + 1) end
- end
- end
- for i,v in ipairs(t_boslist) do
- for k,p in ipairs(t_boslist[i]) do
- if p == hash then svcmd("sv_ban " .. player + 1 .. " 0") end
- end
- end
- --if antiname == true then samename(player) end -- Requires client modification
- end
- function OnPlayerLeave(player, team)
- local currentPlayers = getplayers()
- if currentPlayers == 0 then svcmd("sv_map_reset") end -- do a map reset to fix any bugs.
- local hash = gethash(player)
- hidden[hash] = nil
- pastplayer[player+1] = {getname(player), gethash(player)}
- --[[for i,v in ipairs(r_names) do -- Requires client modification
- if r_names[i][2] == player then
- r_names[i][2] = false
- end
- end--]]
- end
- function OnPlayerKill(killer, victim, mode)
- if protected[hash] ~= nil then -- if they have been in the list
- protected[hash] = nil --then remove them from protected list
- end
- end
- function OnKillMultiplier(player, multiplier)
- end
- function OnPlayerSpawn(player, m_objectId)
- local hash = gethash(player)
- if sprotect ~= 0 then
- registertimer(sprotect * 1000, "spawnprotect", hash) --initiate spawn protection
- spawnprotect(1, 0, hash)
- end
- end
- function OnPlayerSpawnEnd(player, m_objectId)
- if weapontotal == 3 then
- local weapobj3 = createobject(objects[19][2], objects[19][3], 0, 1, false, 0, 0, 0)
- assignweapon(player, weapobj3)
- table.insert(weapdespawning, weapobj3) -- created weapons can't be destroyed automatically, putting them in a table
- end
- local m_obj = getobject(m_objectId)
- if cnades == 1 then
- writebyte(m_obj, 0x31E, fragamount)
- writebyte(m_obj, 0x31F, plasmaamount)
- end
- end
- function OnTeamChange(relevant, player, team, dest_team)
- return 1
- end
- function OnObjectInteraction(player, m_ObjectId, tagType, tagName)
- damagesay(tagName, tagType)
- local hash = gethash(player)
- local response = 1
- return response
- end
- function OnWeaponReload(player, weapon)
- return 1
- end
- function OnVehicleEntry(relevant, player, vehicleId, vehicle_tag, seat)
- local hash = gethash(player)
- local response = 1
- if hidden[hash] ~= nil then
- response = 0
- end
- return response
- end
- function OnVehicleEject(player, forceEject)
- return 1
- end
- function OnDamageLookup(receiving_obj, causing_obj, tagdata, tagname)
- damagesay(tagname, tagdata)
- local _min_dmg = readfloat(tagdata, 0x1D0)
- local _max_dmg_min = readfloat(tagdata, 0x1D4)
- local _max_dmg_max = readfloat(tagdata, 0x1D8)
- if tagname == "globals\\vehicle_collision" or --if damage is by vehicle/splatter
- tagname == "globals\\vehicle_kiled_unit" then
- local min_dmg = readfloat(tagdata, 0x1D0)
- local max_dmg_min = readfloat(tagdata, 0x1D4) --vv
- local max_dmg_max = readfloat(tagdata, 0x1D8) ----vv
- writefloat(tagdata, 0x1D0, min_dmg * vehidamage) --vv
- writefloat(tagdata, 0x1D4, max_dmg_min * vehidamage) --set damage to %age
- writefloat(tagdata, 0x1D8, max_dmg_max * vehidamage) --^^
- end
- if causing_obj ~= 0xFFFFFFFF then --if damage by player
- local causer = objecttoplayer(causing_obj) --causer memory id
- local causerhash = gethash(causer) --causer hash
- local receiver = objecttoplayer(receiving_obj) -- reciever memory id
- local recieverhash = gethash(receiver) --reciever hash
- if hidden[causerhash] ~= nil then --and causer is hidden
- writefloat(tagdata, 0x1D0, 0) --vv
- writefloat(tagdata, 0x1D4, 0) --disable damage
- writefloat(tagdata, 0x1D8, 0) --^^
- elseif protected[recieverhash] == 1 and sprotect ~= 0 then -- if reciever is protected
- writefloat(tagdata, 0x1D0, 0) --vv
- writefloat(tagdata, 0x1D4, 0) --disable damage
- writefloat(tagdata, 0x1D8, 0) --^^
- end
- end
- if hidden[recieverhash] ~= nil then --if reciever is hidden
- writefloat(tagdata, 0x1D0, 0) --vv
- writefloat(tagdata, 0x1D4, 0) --disable damage
- writefloat(tagdata, 0x1D8, 0) --^^
- end
- if mdamage ~= 1 and tagname ~= "globals\\falling" then
- local min_dmg = readfloat(tagdata, 0x1D0)
- local max_dmg_min = readfloat(tagdata, 0x1D4) --vv
- local max_dmg_max = readfloat(tagdata, 0x1D8) ----vv
- writefloat(tagdata, 0x1D0, min_dmg * mdamage) --vv
- writefloat(tagdata, 0x1D4, max_dmg_min * mdamage) --set damage to %age
- writefloat(tagdata, 0x1D8, max_dmg_max * mdamage) --^^
- end
- if tagname == "globals\\falling" then --if damage is by falldamage
- local min_dmg = readfloat(tagdata, 0x1D0)
- local max_dmg_min = readfloat(tagdata, 0x1D4) --vv
- local max_dmg_max = readfloat(tagdata, 0x1D8) ----vv
- writefloat(tagdata, 0x1D0, min_dmg * falldamage) --set damage to %age
- writefloat(tagdata, 0x1D4, max_dmg_min * falldamage)----^^
- writefloat(tagdata, 0x1D8, max_dmg_max * falldamage)--^^
- end
- if tagname == "globals\\falling" and max_dmg_max == 0 then --if damage is by falldamage
- local min_dmg = readfloat(tagdata, 0x1D0)
- local max_dmg_min = readfloat(tagdata, 0x1D4) --vv
- local max_dmg_max = readfloat(tagdata, 0x1D8) ----vv
- writefloat(tagdata, 0x1D0, _min_dmg * .0001) --set damage to %age
- writefloat(tagdata, 0x1D4, _max_dmg_min * .0001)----^^
- writefloat(tagdata, 0x1D8, _max_dmg_max * .0001)--^^
- end
- end
- function OnWeaponAssignment(player, object, count, tag)
- end
- function OnObjectCreation(m_objectId, player_owner, tag)
- local m_object = getobject(m_objectId)
- local obj_type = readbyte(m_object, 0xB4)
- damagesay(tag, obj_type)
- end
- ---------- Custom Functions ----------
- function writestring(string, address, offset, spacing, endian)
- local char_table = {}
- address = address + offset
- if spacing == nil then
- spacing = 0x1
- end
- for word in string:gmatch(".") do
- table.insert(char_table, string.byte(word))
- end
- local length = table.getn(char_table)
- if endian == 1 then
- for i=0,length do
- writebyte(address, spacing * i, char_table[length - i])
- end
- else
- for i=0,length do
- writebyte(address, spacing * i, char_table[i + 1])
- end
- end
- end
- function servertimer(id, count)
- svcmd("sv_teams_balance")
- return 1
- end
- hashToPlayer = function(hash) -- Made by wizard
- for i = 0, 15 do
- if gethash(i) == hash then
- return i
- end
- end
- return nil
- end
- function spawnprotect(id, count, hash)
- if protected[hash] == nil or protected[hash] == 0 then --if player isn't in protected list
- if count == 0 then --first millisecond the function is called
- protected[hash] = 1 --then add player to protected list
- end
- end
- if protected[hash] == 1 then --if player is in protected list
- if count == 1 then -- if they have been in the list
- protected[hash] = 0 --then remove them from protected list
- return 0
- end
- end
- if count > 1 and protected[hash] ~= nil then
- protected[hash] = 0
- return 0
- end
- if count >= 1 then return 0 end
- end
- function getplayers() --returns how many players are in server
- local playeramount = 0
- for i = 0,15 do
- if getplayer(i) ~= nil then
- playeramount = playeramount + 1
- end
- end
- return playeramount
- end
- function damagesay(damage, dtype)
- for player = 0, 15 do
- local hash = gethash(player)
- if damagequery[hash] == 1 then
- privateSay(player, damage .. " " .. dtype)
- end
- end
- end
- function hide(id, count) --le other part of hide
- for player = 0, 15 do
- local hash = gethash(player)
- if hidden[hash] ~= nil then
- local m_player = getplayer(player)
- local m_objectId = getplayerobjectid(player)
- local m_object = getobject(m_objectId)
- local x = 0.678638
- local y = -164.587585
- local z = 15.038022
- writefloat(m_player, 0xF8, 0) -- Moves the visibility of the player somewhere else
- writefloat(m_player, 0xFC, 0) -- Moves the visibility of the player somewhere else
- writefloat(m_player, 0x100, 0) -- Moves the visibility of the player somewhere else
- writefloat(m_object, 0x170, x) -- Moves the coords that the player will be damaged to
- writefloat(m_object, 0x174, y) -- Moves the coords that the player will be damaged to
- writefloat(m_object, 0x178, z) -- Moves the coords that the player will be damaged to
- end
- end
- return 1
- end
- ---------- Say Functions ----------
- Say = function(message) -- Made by Wizard
- message = message or "Hollie!"
- for i = 0,15 do
- if getplayer(i) ~= nil then
- privateSay(i, message)
- end
- end
- end
- privateSay = function(player, message, time) -- Made by Wizard
- time = time or 5
- local hash = gethash(player)
- if hash ~= nil then
- if messages[hash] == nil then messages[hash] = {} end
- table.insert(messages[hash], {["message"] = message, ["time"] = time})
- end
- end
- HprintTimer = function(id, count) -- Made by Wizard
- if messages ~= {} then
- for k,v in pairs(messages) do
- if messages[k] ~= {} then
- for key,value in ipairs(messages[k]) do
- messages[k][key].time = messages[k][key].time - 0.5
- if messages[k][key].time < 0 then
- table.remove(messages[k], key)
- end
- end
- end
- end
- for k,v in pairs(messages) do
- if #messages[k] > 0 then
- local player = hashToPlayer(k)
- for i = 1, 30 do
- hprintf(" ", player)
- end
- for key,value in ipairs(messages[k]) do
- hprintf(messages[k][key].message, player)
- end
- end
- end
- end
- return 1
- end
- ------------
- ---------- Chat Filter Section ----------
- function filterLoad()
- local file = io.open(profilepath .. "\\chatFilter.txt", "r")
- if file == nil then
- file = io.open(profilepath .. "\\chatFilter.txt","w")
- file:close()
- file = io.open(profilepath .. "\\chatFilter.txt", "r")
- end
- local i = 1
- for line in file:lines() do
- sLine = tostring(line)
- filteredWords[i] = sLine
- i = i+1
- end
- end
- function filterSave()
- local file = io.open(profilepath .. "\\chatFilter.txt", "w")
- for i,v in ipairs(filteredWords) do
- file:write(v .. "\n")
- end
- file:flush()
- file:close()
- end
- ---------- Phasor Markup Section ----------
- function commandsHandler()
- local pcm = io.open(profilepath .."\\commands.pmf", "r") --opens commands.pmf, a text file.
- if pcm ~= nil then --If that file exists, then
- local locationFound = false --script found
- local foundIn = 0 --line script found in
- local foundEnd = false --found end of script
- local commandsFound = false --commands of the script found
- local commandsEnd = false -- end of commands found
- local totalCommands = 0 --total commands
- local i = 1 --set local variable i to 1
- for line in pcm:lines() do -- for every line in pcm
- local sLine = tostring(line) --convert the line to a string
- if locationFound == false and foundEnd == false then --if the script hasn't been found or hasn't finished then
- if string.find(sLine, "script: " .. scriptName .. " " .. scriptVersion) ~= nil then --if this line starts the script
- locationFound = true --set the locationfound to true
- end
- elseif locationFound == true and foundEnd == false then --if we're in the script then
- if string.find(sLine, "T_publicCmdHandler") ~= nil then --if T_publicCmdHandler is found then
- if string.find(sLine, "true") ~= nil then -- set T_publicCmdHandler to true
- T_publicCmdHandler = true
- else
- T_publicCmdHandler = false
- end
- elseif string.find(sLine, "T_adminCmdHandler") ~= nil then --
- if string.find(sLine, "true") ~= nil then
- T_adminCmdHandler = true
- else
- T_adminCmdHandler = false
- end
- elseif string.find(sLine, "T_rAdminCmdHandler") ~= nil then
- if string.find(sLine, "true") ~= nil then
- T_rAdminCmdHandler = true
- else
- T_rAdminCmdHandler = false
- end
- elseif string.find(sLine, "commands:") ~= nil and commandsFound == false then
- commandsFound = true
- handledCommands = {}
- elseif commandsFound == true and commandsEnd == false then --if in the commands section then
- local commandStLoc = string.find(sLine, "sv_") --see if line contains a command
- if commandStLoc ~= nil then --if it does then
- totalCommands = totalCommands + 1 --increase totalCommands
- handledCommands[totalCommands] = string.sub(sLine, commandStLoc) --add command to handled command list
- end
- elseif string.find(sLine, "endCommands:") ~= nil and commandsfount == true then --if end of commands found then
- commandsEnd = true
- elseif string.find(sLine, "endScript:") ~= nil and locationFound == true then --if end of script found then
- foundEnd = true
- end
- end
- i = i + 1 --increase i
- end
- else
- --say("commands.pmf could not be opened.")
- end
- end
- -------------------------------------------------
- function ipbanlist(mode)
- if mode == 0 then --load file
- local textFile = io.open(profilepath .. "\\ipbanlist.txt", "r")
- if textFile == nil then
- textFile = io.open(profilepath .. "\\ipbanlist.txt","w")
- textFile:close()
- textFile = io.open(profilepath .. "\\ipbanlist.txt", "r")
- end
- if textFile ~= nil then
- local i = 1
- for line in textFile:lines() do
- local sLine = tostring(line)
- local comma = string.find(sLine, ",")
- if comma ~= nil then
- local name = string.sub(sLine, 1, comma - 1)
- local ipaddr = string.sub(sLine, comma + 1)
- t_ipbanlist[i] = {name,ipaddr}
- end
- i = i + 1
- end
- end
- textFile:close()
- elseif mode == 1 then -- save file
- local textFile = io.open(profilepath .. "\\ipbanlist.txt", "w")
- for i,v in ipairs(t_ipbanlist) do
- if t_ipbanlist[i] ~= nil then
- local linetowrite = t_ipbanlist[i][1] .. "," .. t_ipbanlist[i][2] .. "\n"
- textFile:write(linetowrite)
- end
- end
- textFile:flush()
- textFile:close()
- end
- end
- function boslist(mode)
- if mode == 0 then --load file
- local textFile = io.open(profilepath .. "\\boslist.txt", "r")
- if textFile == nil then
- textFile = io.open(profilepath .. "\\boslist.txt","w")
- textFile:close()
- textFile = io.open(profilepath .. "\\boslist.txt", "r")
- end
- if textFile ~= nil then
- local i = 1
- for line in textFile:lines() do
- local sLine = tostring(line)
- local comma = string.find(sLine, ",")
- if comma ~= nil then
- local daname = string.sub(sLine, 1, comma - 1)
- local dahash = string.sub(sLine, comma + 1)
- t_boslist[i] = {daname,dahash}
- end
- i = i + 1
- end
- end
- textFile:close()
- elseif mode == 1 then -- save file
- local textFile = io.open(profilepath .. "\\boslist.txt", "w")
- for i,v in ipairs(t_boslist) do
- if t_boslist[i] ~= nil then
- local linetowrite = t_boslist[i][1] .. "," .. t_boslist[i][2] .. "\n"
- textFile:write(linetowrite)
- end
- end
- textFile:flush()
- textFile:close()
- end
- end
- ----------------------
- ---- Require Mods ----
- ----------------------
- --[[function samename(player) -- requires client side modification
- local m_player = getplayer(player)
- local m_objectId = getplayerobjectid(player)
- local m_object = getobject(m_objectId)
- for i,v in ipairs(r_names) do
- if r_names[i][2] == player then
- return "Player already using fixed name"
- end
- if r_names[i][2] == false then
- writestring(r_names[i][1],m_player, 0x4, 0x14)
- writestring(r_names[i][1],m_player, 0x48, 0x14)
- writestring(r_names[i][1],0x745D4A, 0x20 * player, 0x14)
- r_names[i][2] = player
- end
- end
- end--]]
- --[[function fly(id, count) --le other part of fly -- requires client side modification
- for player = 0, 15 do
- local hash = gethash(player)
- local m_objectId = getplayerobjectid(player)
- local m_object = getobject(m_objectId)
- if flying[hash][1] == true then
- local x = flying[hash][3]
- local y = flying[hash][4]
- local z = flying[hash][5]
- writefloat(flying[hash][2], 0x5C, 0)
- writefloat(0x69C2F8 + player*0x30, 0x1C, x)
- writefloat(0x69C2F8 + player*0x30, 0x20, y)
- writefloat(0x69C2F8 + player*0x30, 0x24, z)
- end
- end
- end --]]
- ---------- Command Section ----------
- ---------- BoS Commands ----------
- function bosCommand(ptbos)
- boslist(0)
- response = 0
- if string.len(ptbos) ~= 32 and string.len(ptbos) <= 2 then
- ptbos = tonumber(ptbos, 10)
- if ptbos <= 16 and ptbos >= 1 then
- if pastplayer[ptbos] ~= nil then
- local name = pastplayer[ptbos][1]
- local hash = pastplayer[ptbos][2]
- local found = false
- for i = 1, table.getn(t_ipbanlist) do
- if t_boslist[i][2] == hash then
- found = true
- break
- end
- end
- if found == false then
- if t_boslist[1] == nil then
- t_boslist[1] = {name,hash}
- else
- t_boslist[table.getn(t_boslist) + 1] = {name,hash}
- end
- boslist(1)
- response = name .. " is to be banned on sight."
- else
- response = "Player already to be banned on sight."
- end
- end
- else
- response = "Invalid player number"
- end
- elseif string.len(ptbos) == 32 then
- local name = "N/A"
- local hash = pastplayer[ptbos][2]
- local found = false
- for i = 1, #t_ipbanlist do
- if t_boslist[i][2] == hash then
- found = true
- break
- end
- end
- if found == false then
- if t_boslist[1] == nil then
- t_boslist[1] = {name,hash}
- else
- t_boslist[#t_boslist + 1] = {name,hash}
- end
- boslist(1)
- response = "The hash, \"" .. hash .. "\" is to banned on sight."
- else
- response = "Player already to be banned on sight."
- end
- else
- response = "Invalid player number/hash"
- end
- return response
- end
- function unbosCommand(pln)
- local response = "Invalid Number"
- boslist(0)
- pln = tonumber(pln,10)
- local plname = ""
- local plip = ""
- for i,v in ipairs(t_boslist) do
- if pln == i then
- plname = t_boslist[i][1]
- plh = t_boslist[i][2]
- t_boslist[pln] = nil
- response = "Successfully removed hash: " .. plh .. " or Name: " .. plname .. "."
- end
- end
- boslist(1)
- return response
- end
- function boslistCommand(player, hash)
- local response = 0
- boslist(0)
- if #t_boslist > 0 then
- for i,v in ipairs(t_boslist) do
- response = "[Number] , [Name] , [Hash]\n"
- response = response .. i .. " , " .. t_boslist[i][1] .. " , " .. t_boslist[i][2] .. "\n"
- end
- else
- return "Boslist empty"
- end
- return response
- end
- ------------------------------------------
- function viewipCommand(pln)
- local response = 0
- pln = tonumber(pln) - 1
- if gethash(pln) ~= nil then
- response = "Player's IP: " .. getip(pln)
- else
- response = "Invalid Player Number"
- end
- return response
- end
- function reloadfilter(player, hash)
- filterLoad()
- return "Reloaded successfully!"
- end
- function addfilterCommand(player, hash, wta)
- words = table.getn(filteredWords)
- table.insert(filteredWords, tostring(wta))
- response = wta .. " was added successfully!"
- return response
- end
- function flycommand(player, hash)
- local response = 0
- local m_objectId = getplayerobjectid(player)
- local m_object = getobject(m_objectId)
- if flying[hash] == nil then
- local shee = createobject(objects[7][2], objects[7][3], 0, 1, false, 0, 0, 0)
- flying[hash] = {true, shee, readfloat(m_object, 0x5C), readfloat(m_object, 0x60),readfloat(m_object, 0x64)}
- entervehicle(player, shee, 0)
- writefloat(m_object, 0x5c, flying[hash][3])
- writefloat(m_object, 0x60, flying[hash][4])
- writefloat(m_object, 0x64, flying[hash][5])
- response = "BRAHAHADHSGFDFGDFHJKFDLH\n ME GUSTAN EL FLYING."
- end
- return response
- end
- --- Hide Command Section ---
- function hidecommand(player,hash)
- local response = 0
- if hidden[hash] == nil then --if player isn't hidden
- local id = resolveplayer(player) --gets player id
- local m_objectId = getplayerobjectid(player) --gets object id
- local m_object = getobject(m_objectId) --gets memory address
- -- store player coords for later use
- hidden[hash] = {readfloat(m_object, 0x5C), readfloat(m_object, 0x60), readfloat(m_object, 0x64)}
- setspeed(player, hide_speed) --set player speed to hide speed.
- response = "*** YOU ARE NOW COMPLETELY INVISIBLE ***\n"
- response = response .. "Do not kill or disrupt the flow of the game while hidden.\n"
- response = response .. "FYI, shooting or throwing nades doesn't do any damage, so don't even try. It's disrupting\n"
- response = response .. "and it's abuse. Not to mention you're wasting ammo."
- end
- return response
- end
- function unhidecommand(player,hash)
- local response = 0
- setspeed(player, 1)
- -- teleport player back to original location
- svcmd("sv_teleport " .. player + 1 .. " " .. hidden[hash][1] .. " " .. hidden[hash][2] .. " " .. hidden[hash][3])
- -- clear data
- hidden[hash] = nil
- response = "You have been unhidden, and teleported back to your original location!"
- return response
- end
- function myobj(player,hash)
- local response = 0
- local m_player = getplayer(player) --gets player id
- local m_objectId = getplayerobjectid(player) --gets object id
- local m_object = getobject(m_objectId) --gets memory address
- response = m_player .. "\n"
- response = response .. m_objectId "\n"
- response = response .. m_object
- return response
- end
- function splatterdmgCommand(player,hash, dmg)
- local response = 0
- vehidamage = dmg
- response = "Splatter damage has been set to " .. dmg * 100 .. "%"
- return response
- end
- function falldmgCommand(player,hash, dmg)
- local response = 0
- local falldamagetmp = dmg
- if falldamagetmp == 0 then
- falldamage = 0.00001
- else
- falldamage = falldamagetmp
- end
- response = "Fall damage has been set to " .. dmg * 100 .. "%"
- return response
- end
- function damageqCommand(player,hash, dmg)
- local response = 0
- if damagequery[hash] == nil or damagequery[hash] == 0 then
- damagequery[hash] = 1
- response = "Damage Query has been turned on"
- elseif damagequery[hash] == 1 then
- damagequery[hash] = 0
- response = "Damage Query has been turned off"
- end
- return response
- end
- function mdamageCommand(player, hash, dmg)
- mdamage = dmg
- privateSay(player, "Fall damage has been set to " .. dmg * 100 .. "%")
- end
- function cnadesCommand(player, hash)
- local response = 0
- local truefalse = false
- if cnades == 1 then
- cnades = 0
- truefalse = false
- response = "Custom nades off."
- else
- cnades = 1
- truefalse = true
- response = "Custom nades on."
- end
- return response
- end
- function pnadesCommand(player, hash, amt)
- local response = 0
- plasmaamount = amt
- response = "Players will now spawn with " .. amt .. " plasma grenades"
- return response
- end
- function mdamageCommand(player, hash, dmg)
- mdamage = dmg
- local response = "Fall damage has been set to " .. dmg * 100 .. "%"
- return response
- end
- function ipbanCommand(player, hash, ptb)
- ipbanlist(0)
- local ptb = tonumber(ptb,10) - 1
- local pip = getip(ptb)
- local pnm = getname(ptb)
- if pnm ~= nil then
- local found = false
- for i = 1, table.getn(t_ipbanlist) do
- if t_ipbanlist[i][2] == pip then
- found = true
- break
- end
- end
- if found == false then
- if t_ipbanlist[1] == nil then
- t_ipbanlist[1] = {pnm,pip}
- else
- t_ipbanlist[table.getn(t_ipbanlist) + 1] = {pnm,pip}
- end
- ipbanlist(1)
- end
- ptb = ptb + 1
- svcmd("sv_kick " .. ptb, player)
- return "Successfully banned IP: " .. pip .. " or Name: " .. pnm .. "."
- end
- return "Invalid Player Number"
- end
- function ipbanlistCommand(player, hash)
- local response = 0
- ipbanlist(0)
- response = "[Number] , [Name] , [IP]\n"
- if t_ipbanlist ~= {} then
- for i,v in ipairs(t_ipbanlist) do
- response = response .. i .. " , " .. t_ipbanlist[i][1] .. " , " .. t_ipbanlist[i][2] .. "\n"
- end
- else
- resposne = "IP banlist is empty."
- end
- return response
- end
- function unipbanCommand(player, hash, pln)
- local response = "Invalid Number"
- ipbanlist(0)
- pln = tonumber(pln,10)
- local plname = ""
- local plip = ""
- for i,v in ipairs(t_ipbanlist) do
- if pln == i then
- plname = t_ipbanlist[i][1]
- plip = t_ipbanlist[i][2]
- t_ipbanlist[pln] = nil
- response = "Successfully removed IP: " .. plip .. " or Name: " .. plname .. "."
- end
- end
- ipbanlist(1)
- return response
- end
- function superbanCommand(player, hash, pn)
- ipbanCommand(player, hash, pn)
- svcmd("sv_ban " .. pn .. " 0", player)
- end
- function cameQueryCommand(player)
- local camera_xy = readfloat(camera_base + player*camera_size, 0x0)
- local camera_z = readfloat(camera_base + player*camera_size, 0x4)
- local camera_x_aim = readfloat(camera_base + player*camera_size, 0x1C)
- local camera_y_aim = readfloat(camera_base + player*camera_size, 0x20)
- local camera_z_aim = readfloat(camera_base + player*camera_size, 0x24)
- local response = "c_xy: " .. camera_xy
- response = response .. "\nc_z: " .. camera_z
- response = response .. "\nc_x_a: " .. camera_x_aim
- response = response .. "\nc_y_a: " .. camera_y_aim
- response = response .. "\nc_z_a: " .. camera_z_aim
- return response
- end
- function hsayCommand(player, msg)
- Say(msg)
- return 0
- end
- function weapontotalCommand(num)
- num = tonumber(num, 10)
- if num < 4 then
- weapontotal = num
- return "Weapon total now at " .. num .. "."
- end
- end
- --[[function antinameCommand() --Requires client side modification
- if antiname == false then
- antiname = true
- return "Users will be prevented from having the same names when joining a server"
- else
- antiname = false
- return "Users will be allowed to have the same names when joining a server"
- end
- end--]]
- --[[ Sightjack commands -- require client side modification
- function sjCommand(player, jacked)
- local response = 0
- local hash = gethash(player)
- jacked = jacked - 1
- if gethash(jacked) ~= nil then
- local jackedName = getname(jacked)
- if jacking[hash] == nil then
- jacking[hash] = registertimer(30, "sightjack", player, jacked)
- response = "You are now sightjacking " .. jackedName .. "."
- else
- removetimer(jacking[hash])
- jacking[hash] = nil
- jacking[hash] = registertimer(30, "sightjack", player, jacked)
- response = "You are now sightjacking " .. jackedName .. "."
- end
- else
- response = "Incorrect player number"
- end
- return response
- end
- function sightjack(id, count, jacker, jacked)
- if gethash(jacker) ~= nil and gethash(jacked) ~= nil then
- local x = readfloat(0x69C2F8 + jacked*0x30, 0x1C)
- local y = readfloat(0x69C2F8 + jacked*0x30, 0x20)
- local z = readfloat(0x69C2F8 + jacked*0x30, 0x24)
- writefloat(0x69C2F8 + jacker*0x30, 0x1C, x)
- writefloat(0x69C2F8 + jacker*0x30, 0x20, y)
- writefloat(0x69C2F8 + jacker*0x30, 0x24, z)
- return 1
- else
- privateSay(jacker, "Sightjacked player no longer in server")
- return 0
- end
- end --]]--[[ Sightjack commands -- require client side modification
- function sjCommand(player, jacked)
- local response = 0
- local hash = gethash(player)
- jacked = jacked - 1
- if gethash(jacked) ~= nil then
- local jackedName = getname(jacked)
- if jacking[hash] == nil then
- jacking[hash] = registertimer(30, "sightjack", player, jacked)
- response = "You are now sightjacking " .. jackedName .. "."
- else
- removetimer(jacking[hash])
- jacking[hash] = nil
- jacking[hash] = registertimer(30, "sightjack", player, jacked)
- response = "You are now sightjacking " .. jackedName .. "."
- end
- else
- response = "Incorrect player number"
- end
- return response
- end
- function sightjack(id, count, jacker, jacked)
- if gethash(jacker) ~= nil and gethash(jacked) ~= nil then
- local x = readfloat(0x69C2F8 + jacked*0x30, 0x1C)
- local y = readfloat(0x69C2F8 + jacked*0x30, 0x20)
- local z = readfloat(0x69C2F8 + jacked*0x30, 0x24)
- writefloat(0x69C2F8 + jacker*0x30, 0x1C, x)
- writefloat(0x69C2F8 + jacker*0x30, 0x20, y)
- writefloat(0x69C2F8 + jacker*0x30, 0x24, z)
- return 1
- else
- privateSay(jacker, "Sightjacked player no longer in server")
- return 0
- end
- end --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement