Results 1 to 8 of 8
  1. #1
    Fr3d-'s Avatar
    Join Date
    May 2018
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    22

    Post MW2Lua v1.0.1 - Script your games. (Gungame & Roll the dice)

    Today I'm re-rereleasing a tool that I've been working on for some time.
    This tool allows you to write your own small scripts, for example giving everyone a certain weapon upon spawning, or killing everyone with a certain name. You can also create your own HUD's which there is an example of in the gungame and roll the dice script.

    NOTICE: This tool only works for private lobbies
    EXTRA NOTICE: Even though this tool is released it's still unstable, this means that you can crash the game, if you make mistakes in your scripts.

    Features:
    • Disable VAC for your private lobby
    • Crashes the game if the lobby is VAC anyways for some reason.
    • Removes the ability to join games where you aren't the host, so you don't risk joining a VAC protected game.
    • Create the scripts/mods that your heart desires.
    • Modify your scripts, and see them in action a second later by pressing F5, without having to restart the game or the map.
    • Batteries (Gungame/Roll the dice) included.



    Changelog:
    • Added roll the dice
    • Fixed DropClient not working.
    • Fixed error messages printing without newlines
    • Made sure it would actually get approved this time! (third time's a charm)



    Installation:
    Read the README.md

    Thanks to:
    Scoudem for making his Lobby Tools opensource, and for answering questions.

    Screenshots:





    Script information:
    These are the following callbacks, that your lua script can react upon.
    • onPlayerNotification(playerEntnum, notification)
    • onPlayerSay(fromEntnum, text)
    • onTick(hostEntnum)
    • onPlayerConnected(playerEntnum)
    • onPlayerDisconnected(playerEntnum)
    • onPlayerSpawned(playerEntnum)
    • onPlayerDeath(playerEntnum, inflictorEntnum, attackerEntnum, damage, meansOfDeath, iWeapon)



    Addresses to functions included:
    -- PlayerCmd
    • giveWeapon
    • getCurrentWeapon
    • takeAllWeapons
    • takeWeapon
    • switchToWeapon
    • setClientDvar
    • clearPerks
    • setPerk
    • unsetPerk
    • setSpreadOverride
    • setViewModel
    • freezeControl



    -- PlayerCmd #2
    • suicide
    • sayAll
    • iprintln
    • iprintlnbold
    • getGuid
    • showHudSplash



    -- GSCr
    • isAlive
    • newClientHudElem
    • exitLevel
    • kickPlayer
    • setDvar
    • getDvar
    • getDvarInt
    • getDvarFloat
    • setText
    • destroy
    • println
    • printlnbold


    -- ScrCmd
    • playLocalSound


    The following functions are exposed to your script from the MW2Lua.dll:
    • CALLREF(functionAddress, playerEntnum, ...)
    • CALL(functionAddress, ...)
    • SetHudElemField
    • GetName(playerEntnum)
    • DropClient(playerEntnum, reason)



    So if you want to give someone a golden desert eagle on spawn, you will have to write:
    Code:
    Code:
    function onPlayerSpawned(playerEntnum)
        CALLREF(giveWeapon, playerEntnum, "deserteaglegold_mp", 0, false);
    end
    Or to change the fov for anyone who writes "/fov", you will have to write:
    Code:
    Code:
    function onPlayerSay(fromEntnum, text)
    	cmd = string.match(text, "/(%w+)")
    	if cmd == "fov" then
    		CALLREF(setClientDvar, fromEntnum, "cg_fov", 80)
    	end
    end
    To give you an idea of how a gamemode can be made, here is the source code for roll the dice:
    Code:
    --[[
    	Simple roll the dice by Fr3d
    ]]--
    
    local rtdNames = {
    	"James Bond",
    	"AC130 Gunner",
    	"Riot Control",
    	"Golden Deagle",
    	"Pirate",
    	"Tube Noob",
    	"Sniper",
    	"Handguns"
    }
    
    function playerDeath(player, inflictor, attacker, damage, meansOfDeath, iWeapon)
    end
    
    function playerThink(player, tick)
    	if CALL(isAlive, toEntity(player)) == 1 then
    		checkWeapon(player)
    
    	end
    end
    
    function checkWeapon(player)
    	local wep = playerInfo[player].weapon
    
    	local currWep = CALLREF(getCurrentWeapon, player)
    
    	if currWep ~= wep and currWep ~= "none" then
    		CALLREF(takeWeapon, player, currWep);
    		CALLREF(giveWeapon, player, wep, 0, playerInfo[player].akimbo);
    		CALLREF(switchToWeapon, player, wep);
    	end
    	if currWep == "none" then
    		CALLREF(switchToWeapon, player, wep);
    	end
    end
    
    function createLevelHUD(player)
    	ref = createHUD(player, "Roll: ", "hudbig", 1, "left", "bottom", "left", "bottom", 20, -20)
    	playerInfo[player].levelHUD = ref
    end
    
    function setWeapon(player, weapon, akimbo)
    	playerInfo[player].weapon = weapon
    	
    	if akimbo ~= nil and akimbo then
    		playerInfo[player].akimbo = true
    	end
    end
    
    function rollTheDice(player)
    	playerInfo[player]****ll = math.random(#rtdNames)
    	local roll = playerInfo[player]****ll
    
    	if roll == 1 then
    		setWeapon(player, "usp_silencer_tactical_mp")
    		playerInfo[player].perks = {"specialty_extendedmelee"}
    	elseif roll == 2 then
    		setWeapon(player, "ac130_25mm_mp")
    	elseif roll == 3 then
    		setWeapon(player, "riotshield_mp")
    		playerInfo[player].perks = {"specialty_fastsprintrecovery", "specialty_quickdraw", "specialty_marathon", "specialty_extendedmelee"}
    	elseif roll == 4 then
    		setWeapon(player, "deserteaglegold_mp")
    	elseif roll == 5 then
    		setWeapon(player, "model1887_akimbo_fmj_mp", true)
    	elseif roll == 6 then
    		setWeapon(player, "m79_mp", true)
    		playerInfo[player].perks = {"specialty_explosivedamage"}	
    	elseif roll == 7 then
    		setWeapon(player, "cheytac_fmj_xmags_mp")
    		playerInfo[player].perks = {
    			"specialty_fastsnipe",
    			"specialty_fastreload",
    			"specialty_fastsprintrecovery",
    			"specialty_quickdraw",
    			"specialty_bulletdamage",
    			"specialty_marathon",
    			"specialty_improvedholdbreath"
    		}
    	elseif roll == 8 then
    		setWeapon(player, "defaultweapon_mp")
    		playerInfo[player].perks = {"specialty_bulletdamage"}
    	else
    		print("fuck")
    	end
    end
    
    function playerSpawned(player)
    	playerInfo[player]****ll = 0
    	playerInfo[player].weapon = ""
    	playerInfo[player].perks = {}
    	playerInfo[player].akimbo = false
    
    	rollTheDice(player)
    	setupPlayer(player)
    	CALLREF(setText, playerInfo[player].levelHUD, "Roll: " .. rtdNames[playerInfo[player]****ll])
    end
    
    function setupPlayer(player)
    	local wep = playerInfo[player].weapon
    
    	CALLREF(takeAllWeapons, player);
    	CALLREF(clearPerks, player);
    
    	CALLREF(giveWeapon, player, wep, 0, playerInfo[player].akimbo);
    	CALLREF(switchToWeapon, player, wep);
    
    	bad_perks = {"specialty_pistoldeath", "specialty_combathigh", "specialty_grenadepulldeath", "specialty_finalstand", "specialty_copycat", "specialty_localjammer"}
    	
    	for _, perk in pairs(bad_perks) do
    		CALLREF(unsetPerk, player, perk);
    	end
    
    	for _, perk in pairs(playerInfo[player].perks) do
    		CALLREF(setPerk, player, perk, true);
    	end
    end
    
    function playerConnected(player)
    	CALLREF(setClientDvar, player, "cg_fov", 80);
    	CALLREF(setClientDvar, player, "cg_fovScale", "1.125");
    
    	playerInfo[player]****ll = 0
    	playerInfo[player].weapon = ""
    	playerInfo[player].perks = {}
    	playerInfo[player].akimbo = false
    
    	createLevelHUD(player)
    end
    
    function playerDisconnected(player)
    	if playerInfo[player] then
    		CALLREF(IW4.HECmd.destroy, playerInfo[player].levelHUD)
    	end
    end
    Virusscan
    <b>Downloadable Files</b> Downloadable Files

  2. The Following 18 Users Say Thank You to Fr3d- For This Useful Post:

    ByAkuma (05-27-2018),CrypticMods (05-07-2018),dredyk (12-26-2018),dredyk3 (11-15-2019),gnarly44 (11-19-2018),helium13337 (08-01-2020),JOntemw3 (07-09-2018),Josh155 (07-05-2019),Kia Kitty Cat (06-19-2018),Killerzwerg47 (11-22-2018),klobobi (12-30-2018),minichibby (05-07-2018),MrTOKER (10-27-2019),rexlManu (07-04-2019),romychorlov (09-20-2018),T0NGi (08-12-2018),varesh007 (01-15-2019),xNjoy (09-16-2018)

  3. #2
    minichibby's Avatar
    Join Date
    Feb 2016
    Gender
    male
    Posts
    140
    Reputation
    10
    Thanks
    8
    My Mood
    Cynical
    Can't wait for this to be approved! I'm going to test if it works when Force-hosting pubs

  4. #3
    Silent's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    5,070
    Reputation
    2172
    Thanks
    8,474
    My Mood
    Bitchy
    Approved. Has not been tested, so post back results.
    Click Here to visit the official MPGH wiki! Keep up with the latest news and information on games and MPGH! To check out pages dedicated to games, see the links below!











    dd/mm/yyyy
    Member - 31/01/2015
    Premium - 12/09/2016
    Call of Duty minion - 05/11/2016 - 05/11/2019
    BattleOn minion - 28/02/2017 - 05/11/2019
    Battlefield minion - 30/05/2017 - 05/11/2019
    Other Semi-Popular First Person Shooter Hacks minion - 21/09/2017 - 17/09/2019
    Publicist - 07/11/2017 - 02/08/2018
    Cock Sucker - 01/12/2017 - Unknown
    Minion+ - 06/03/2018 - 05/11/2019
    Fortnite minion - 08/05/2018 - 05/11/2019
    Head Publicist - 08/10/2018 - 10/01/2020
    Developer Team - 26/10/2019 - 10/01/2020
    Former Staff - 10/01/2020



  5. #4
    minichibby's Avatar
    Join Date
    Feb 2016
    Gender
    male
    Posts
    140
    Reputation
    10
    Thanks
    8
    My Mood
    Cynical
    It only loads Roll The Dice and F5 just takes away all weapons. How do you tell the game which script you want to use?
    Last edited by minichibby; 05-07-2018 at 10:43 PM.

  6. #5
    Threadstarter
    New Member
    Fr3d-'s Avatar
    Join Date
    May 2018
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    22
    Quote Originally Posted by minichibby View Post
    It only loads Roll The Dice and F5 just takes away all weapons. How do you tell the game which script you want to use?
    It always loads game.lua, and not all scripts have same behaviour when reloading with F5. I setup game.lua in such a way, that if you change line 8 in game.lua from
    Code:
    require("rollthedice")
    to

    Code:
    require("gungame")
    game.lua would then call the appropriate functions in gungame, and thus load it.

  7. #6
    minichibby's Avatar
    Join Date
    Feb 2016
    Gender
    male
    Posts
    140
    Reputation
    10
    Thanks
    8
    My Mood
    Cynical
    Quote Originally Posted by Fr3d- View Post
    It always loads game.lua, and not all scripts have same behaviour when reloading with F5. I setup game.lua in such a way, that if you change line 8 in game.lua from
    Code:
    require("rollthedice")
    to

    Code:
    require("gungame")
    game.lua would then call the appropriate functions in gungame, and thus load it.
    Ah, okay. The help is appreciated

  8. #7
    PuRe_Flow's Avatar
    Join Date
    Feb 2016
    Gender
    male
    Posts
    3
    Reputation
    10
    Thanks
    0
    how to get forcehost, and does this work on online?

  9. #8
    minichibby's Avatar
    Join Date
    Feb 2016
    Gender
    male
    Posts
    140
    Reputation
    10
    Thanks
    8
    My Mood
    Cynical
    Quote Originally Posted by PuRe_Flow View Post
    how to get forcehost, and does this work on online?
    It literally says "This tool only works in private lobbies" in bold fucking letters

Similar Threads

  1. [SOLVED]gun game and roll the dice.
    By SofaKingH4rd in forum Call of Duty Modern Warfare 2 Help
    Replies: 3
    Last Post: 08-01-2010, 11:55 AM
  2. Gun game and roll the dice.
    By SofaKingH4rd in forum Call of Duty Modern Warfare 2 Help
    Replies: 14
    Last Post: 08-01-2010, 08:14 AM
  3. B day Bash Progs Speed up Your gaming
    By llvengancell in forum WarRock - International Hacks
    Replies: 36
    Last Post: 09-14-2007, 11:10 PM
  4. kana i found your game
    By Gourav2122 in forum General
    Replies: 17
    Last Post: 08-19-2007, 08:49 PM
  5. Post your game name here
    By styx23 in forum WarRock - International Hacks
    Replies: 49
    Last Post: 07-17-2007, 08:47 PM