- Messages
- 5,121
- Reaction score
- 2,886
- Points
- 1,103
- Thread starter
- #101
This is very nice Cabcon good jobHello, this will be continue when the Mod Tools are available. You will find here anything you need to develop a Bo3 Mod.
God Mode
PHP:function func_godmode() { if(!isDefined(self.gamevars["godmode"])) { self.gamevars["godmode"] = true; self enableInvulnerability(); self iprintln("God Mode ^2ON"); } else { self.gamevars["godmode"] = undefined; self disableInvulnerability(); self iprintln("God Mode ^1OFF"); } }
Unlimited Ammo
PHP:function func_unlimitedAmmo() { if(!isDefined(self.gamevars["ammo_weap"])) { self notify("stop_ammo"); self thread func_ammo(); S("Unlimited Ammo ^2ON"); self.gamevars["ammo_weap"] = true; } else { self notify("stop_ammo"); self.gamevars["ammo_weap"] = undefined; S("Unlimited Ammo ^1OFF"); } } function func_ammo() { self endon("stop_ammo"); for(;;) { if(self.gamevars["ammo_weap"]==true) { if ( self getcurrentweapon() != "none" ) { self setweaponammostock( self getcurrentweapon(), 1337 ); self setweaponammoclip( self getcurrentweapon(), 1337 ); } } wait .1; } }
Ufo Mode
PHP:function func_ufomode() { if(!isDefined(self.gamevars["ufomode"])) { self thread func_activeUfo(); self.gamevars["ufomode"] = true; self iPrintln("UFO Mode ^2ON"); self iPrintln("Press [{+frag}] To Fly"); } else { self notify("func_ufomode_stop"); self.gamevars["ufomode"] = undefined; self iPrintln("UFO Mode ^1OFF"); } } function func_activeUfo() { self endon("func_ufomode_stop"); self.Fly = 0; UFO = spawn("script_model",self.origin); for(;;) { if(self FragButtonPressed()) { self playerLinkTo(UFO); self.Fly = 1; } else { self unlink(); self.Fly = 0; } if(self.Fly == 1) { Fly = self.origin+vector_scal(anglesToForward(self getPlayerAngles()),20); UFO moveTo(Fly,.01); } wait .001; } } function vector_scal(vec, scale) { vec = (vec[0] * scale, vec[1] * scale, vec[2] * scale); return vec; }
Third Person
PHP:function func_thirdPerson() { if(!isDefined(self.gamevars["thirdPerson"])) { self SetClientThirdPerson( 1 ); self SetClientThirdPersonAngle( 354 ); self setDepthOfField( 0, 128, 512, 4000, 6, 1.8 ); self.gamevars["thirdPerson"] = true; } else { self SetClientThirdPerson( 0 ); self SetClientThirdPersonAngle( 0 ); self setDepthOfField( 0, 0, 512, 4000, 4, 0 ); self.gamevars["thirdPerson"] = undefined; } self resetFov(); }
Magicbullet
List of inputs:PHP://example: func_magicbullettest("launcher_standard"); function func_magicbullettest(i) { if(!isDefined(self.gamevars["magicbullet"]) || self.gamevars["magicbullet"] == false) { self.gamevars["magicbullet"] = true; self iprintln("Magic Bullets ^2ON"); while(self.gamevars["magicbullet"]) { self waittill( "weapon_fired" ); if(self.gamevars["magicbullet"] == false) continue; MagicBullet( GetWeapon( i ), self GetEye(), BulletTrace(self GetEye(), self GetEye() + AnglesToForward(self GetPlayerAngles()) * 100000, false, self)["position"], self); wait .025; } } else { self.gamevars["magicbullet"] = false; self iprintln("Magic Bullets ^1OFF"); } }
Code:remote_missile_bomblet flak_drone_rocket remote_missile_missile straferun_rockets launcher_standard minigun
Give Random Weapon
Put this into the #using list:
Code:#using scripts\shared\weapons_shared; #using scripts\shared\array_shared;
Add this function somewhere:
Code:function func_giveRandomWeapon() { weaponsList_array = strTok("pistol_standard ar_standard sniper_fastbolt sniper_powerbolt ar_marksman lmg_heavy "," "); // fill this with random weapons from the game, I tried to search a array whichs stores all weapons from the game but I didn't find one! for(;;) { weaponPick = array::random(weaponsList_array); weaponPick = getWeapon(weaponPick); if( self hasWeapon( weaponPick ) ) continue; else if ( weapons::is_primary_weapon( weaponPick ) ) break; else if ( weapons::is_side_arm( weaponPick ) ) break; else continue; } self iprintln(weaponPick.displayName); self iprintln(weaponPick.name); self TakeWeapon(self GetCurrentWeapon()); self giveWeapon(weaponPick); self GiveMaxAmmo(weaponPick); self SwitchToWeapon(weaponPick); }
You can call now ::func_giveRandomWeapon and you will get one weapon of the weaponsList_array array!
Change classes
Code:#using scripts\mp\gametypes\_globallogic_ui; #using scripts\mp\gametypes\_loadout; function changeClass() { self endon("disconnect"); self endon("death"); self globallogic_ui::beginClassChoice(); for(;;) { if(self.pers["changed_class"]) self loadout::giveLoadout(self.team, self.class); wait 0.05; } }
hintMessage on every player in the lobby
PHP:#using scripts\shared\hud_message_shared; function TW(message) { foreach(player in level.players) player hud_message::hintMessage(message); } //example: TW("^2Hello everyone!");
Hide Weapon
Code:function func_togglehideWeapon() { if(getDvarint("cg_drawGun") == 0) setDvar("cg_drawGun", "1"); else setDvar("cg_drawGun", "0"); self iprintln("Hide Gun " + ((getDvarint("cg_drawGun") == 0) ? "^2ON" : "^1OFF")); }
Print Origin
Code:function func_getOrigin() { self IPrintLn("Your Origin ^2"+self GetOrigin()); }
Invisible
Code:function func_invisible() { if(!self.gamevars["invisible"] || !isDefined(self.gamevars["invisible"])) { self hide(); self.gamevars["invisible"] = true; self IPrintLn("You are ^2Invisible"); } else { self show(); self.gamevars["invisible"] = false; self IPrintLn("You are ^1Visible"); } }
Zombie Give Perk
Code:#using scripts\zm\_zm_perks; function func_doGivePerk(perk) { if (!(self hasperk(perk) || self zm_perks::has_perk_paused(perk))) { self zm_perks::vending_trigger_post_think( self, perk ); } else { self notify(perk + "_stop"); self iprintln("Perk [" + perk + "] ^1Removed"); } }
Credits
CabCon
CraigChrist8239
xTwinkyModz
Forget that code's a wreck lol give me some time and I'll work on italso i tested the Teleporter and it doesn´t work. Please fix, because i don´t find the probkem in the code.
Code://might need to get fixed #using scripts\shared\util_shared; self setOrigin(&locationSelector); //use it like this function locationSelector() { self endon("disconnect"); self endon("death"); self BeginLocationSelection("map_mortar_selector"); self DisableOffhandWeapons(); self GiveWeapon("killstreak_remote_turret_mp", 0, false); // or planemortar self SwitchToWeapon("killstreak_remote_turret_mp"); //killstreak_remote_turret_mp was bo2's and it exists in bo3 again so I'm not sure self.selectingLocation = 1; self waittill("confirm_location", location); newLocation = BulletTrace(location+( 0, 0, 100000 ), location, false, self)["position"]; self EndLocationSelection(); self EnableOffhandWeapons(); self SwitchToWeapon(self util::getlastweapon()); self.selectingLocation = undefined; return newLocation; } Copied from above
if self.class is wrong try self.pers["class"]changeClass is not working! self.class is wrong.
U mean youve had the script for 2 weeks? ok, I was the first one to publicly release it. I found it myself and thought "Hey, why not let others have it who dont." Not trying to be "the original" Just tryin to help those who dont know how to make their own scripts
From 2 weeks ago.. And even then I had it for about a week
I also have problems with this code, I started to code a completely new BO3 Teleport function:also i tested the Teleporter and it doesn´t work. Please fix, because i don´t find the probkem in the code.
Code://might need to get fixed #using scripts\shared\util_shared; self setOrigin(&locationSelector); //use it like this function locationSelector() { self endon("disconnect"); self endon("death"); self BeginLocationSelection("map_mortar_selector"); self DisableOffhandWeapons(); self GiveWeapon("killstreak_remote_turret_mp", 0, false); // or planemortar self SwitchToWeapon("killstreak_remote_turret_mp"); //killstreak_remote_turret_mp was bo2's and it exists in bo3 again so I'm not sure self.selectingLocation = 1; self waittill("confirm_location", location); newLocation = BulletTrace(location+( 0, 0, 100000 ), location, false, self)["position"]; self EndLocationSelection(); self EnableOffhandWeapons(); self SwitchToWeapon(self util::getlastweapon()); self.selectingLocation = undefined; return newLocation; } Copied from above
//includes:
#using scripts\mp\killstreaks\_airsupport;
#precache( "locationselector", "compass_objpoint_helicopter" );
//Function
function func_teleportWithSelector(player)
{
self beginLocationComlinkSelection( "compass_objpoint_helicopter", 1500 );
self.selectingLocation = true;
self thread airsupport::endSelectionThink();
location = self func_waittill_confirm_location();
if ( !isdefined( location ) )
{
return false;
}
player SetOrigin( location );
self endLocationSelection();
self.selectingLocation = undefined;
self iprintln("You teleported ^2"+player.name);
}
function func_waittill_confirm_location()
{
self endon( "emp_jammed" );
self endon( "emp_grenaded" );
self waittill( "confirm_location", location );
return location;
}
I also have problems with this code, I started to code a completely new BO3 Teleport function:
I also do not get the function fully working. The selector map don't display to me....Code://includes: #using scripts\mp\killstreaks\_airsupport; #precache( "locationselector", "compass_objpoint_helicopter" ); //Function function func_teleportWithSelector(player) { self beginLocationComlinkSelection( "compass_objpoint_helicopter", 1500 ); self.selectingLocation = true; self thread airsupport::endSelectionThink(); location = self func_waittill_confirm_location(); if ( !isdefined( location ) ) { return false; } player SetOrigin( location ); self endLocationSelection(); self.selectingLocation = undefined; self iprintln("You teleported ^2"+player.name); } function func_waittill_confirm_location() { self endon( "emp_jammed" ); self endon( "emp_grenaded" ); self waittill( "confirm_location", location ); return location; }
function location_selector() {
currentWeapon = self GetCurrentWeapon();
self beginLocationSelection("map_mortar_selector");
self DisableOffhandWeapons();
pad = GetWeapon("killstreak_remote_turret");
self GiveWeapon(pad);
self SwitchToWeapon(pad);
self.selectingLocation = 1;
self waittill("confirm_location", location);
newLocation = BulletTrace(location + (0, 0, 100000), location, false, self)["position"];
self EndLocationSelection();
self EnableOffhandWeapons();
self SwitchToWeapon(currentWeapon);
self.selectingLocation = undefined;
return newLocation;
}
function teleport()
{
location = location_selector();
self SetOrigin(location);
}
Thank you very much! You're right, I forgot to give the weapon.There is a small difference between BO2 and BO3, in BO2 you can use the map_mortar_selector without giving
killstreak_remote_turret_mp. However, in BO3 you must give that weapon because it is where the map is displayed.
Code:function location_selector() { currentWeapon = self GetCurrentWeapon(); self beginLocationSelection("map_mortar_selector"); self DisableOffhandWeapons(); pad = GetWeapon("killstreak_remote_turret"); self GiveWeapon(pad); self SwitchToWeapon(pad); self.selectingLocation = 1; self waittill("confirm_location", location); newLocation = BulletTrace(location + (0, 0, 100000), location, false, self)["position"]; self EndLocationSelection(); self EnableOffhandWeapons(); self SwitchToWeapon(currentWeapon); self.selectingLocation = undefined; return newLocation; } function teleport() { location = location_selector(); self SetOrigin(location); }
Proof:
Also @Sergiosvdev, I'm currently trying to find out how the bots system work.There is a small difference between BO2 and BO3, in BO2 you can use the map_mortar_selector without giving
killstreak_remote_turret_mp. However, in BO3 you must give that weapon because it is where the map is displayed.
Code:function location_selector() { currentWeapon = self GetCurrentWeapon(); self beginLocationSelection("map_mortar_selector"); self DisableOffhandWeapons(); pad = GetWeapon("killstreak_remote_turret"); self GiveWeapon(pad); self SwitchToWeapon(pad); self.selectingLocation = 1; self waittill("confirm_location", location); newLocation = BulletTrace(location + (0, 0, 100000), location, false, self)["position"]; self EndLocationSelection(); self EnableOffhandWeapons(); self SwitchToWeapon(currentWeapon); self.selectingLocation = undefined; return newLocation; } function teleport() { location = location_selector(); self SetOrigin(location); }
Proof:
//includes:
#using scripts\shared\bots\_bot;
//functions
function func_addBot(count)
{
bot::add_bots(count);
self IPrintLn("You added ^2"+count+"^7 Bots");
}
function func_kickBot(count)
{
bot::remove_bots(count);
self IPrintLn("You removed ^2"+count+"^7 Bots");
}
function func_killBots()
{
players = GetPlayers();
foreach( player in players )
{
if ( !player IsTestClient() )
{
continue;
}
player bot::kill_bot();
}
}
I will test it in a few minutes.Also @Sergiosvdev, I'm currently trying to find out how the bots system work.
Code://includes: #using scripts\shared\bots\_bot; //functions function func_addBot(count) { bot::add_bots(count); self IPrintLn("You added ^2"+count+"^7 Bots"); } function func_kickBot(count) { bot::remove_bots(count); self IPrintLn("You removed ^2"+count+"^7 Bots"); } function func_killBots() { players = GetPlayers(); foreach( player in players ) { if ( !player IsTestClient() ) { continue; } player bot::kill_bot(); } }
When I use &func_kickBot from the game, it will work with the first bot. When one got kicked and I do it again the game will crash with connection lost. Do you know where the problem is? I searched in the game files, can not find a problem with the function... Maybe is there a notify missing or something like that.
Also from where did you learned to develope? I never heard your name before in the modding community.
function remove_bots( count, team )
{
players = GetPlayers();
foreach( player in players )
{
if ( !player IsTestClient() )
{
continue;
}
if ( isdefined( team ) && player.team != team )
{
continue;
}
remove_bot( player );
if ( isdefined( count ) )
{
count--;
if ( count <= 0 )
{
break;
}
}
}
}
function remove_bot( bot )
{
if ( !bot IsTestClient() )
{
return;
}
bot [[level.onBotRemove]]();
bot BotDropClient();
}
Yes, I know the function and it is not working... like I said.This are the functions from the _bot.gsc file in bo3.Code:function remove_bots( count, team ) { players = GetPlayers(); foreach( player in players ) { if ( !player IsTestClient() ) { continue; } if ( isdefined( team ) && player.team != team ) { continue; } remove_bot( player ); if ( isdefined( count ) ) { count--; if ( count <= 0 ) { break; } } } } function remove_bot( bot ) { if ( !bot IsTestClient() ) { return; } bot [[level.onBotRemove]](); bot BotDropClient(); }
//includes:
#using scripts\mp\killstreaks\_airsupport;
#precache( "locationselector", "compass_objpoint_helicopter" );
//Function
function func_teleportWithSelector(player)
{
currentWeapon = self GetCurrentWeapon();
self beginLocationSelection("map_mortar_selector");
self DisableOffhandWeapons();
self GiveWeapon(GetWeapon("killstreak_remote_turret"));
self SwitchToWeapon(GetWeapon("killstreak_remote_turret"));
self.selectingLocation = true;
location = self func_waittill_confirm_location();
if ( !isdefined( location ) )
{
self IPrintLn("^1Not able to get any origin!");
return false;
}
player SetOrigin( location );
self EndLocationSelection();
self EnableOffhandWeapons();
self SwitchToWeapon(currentWeapon);
self.selectingLocation = undefined;
self iprintln("You teleported ^2"+player.name);
}
function func_waittill_confirm_location()
{
self endon( "emp_jammed" );
self endon( "emp_grenaded" );
self waittill( "confirm_location", location );
return location;
}
Also @Sergiosvdev, I'm currently trying to find out how the bots system work.
Code://includes: #using scripts\shared\bots\_bot; //functions function func_addBot(count) { bot::add_bots(count); self IPrintLn("You added ^2"+count+"^7 Bots"); } function func_kickBot(count) { bot::remove_bots(count); self IPrintLn("You removed ^2"+count+"^7 Bots"); } function func_killBots() { players = GetPlayers(); foreach( player in players ) { if ( !player IsTestClient() ) { continue; } player bot::kill_bot(); } }
When I use &func_kickBot from the game, it will work with the first bot. When one got kicked and I do it again the game will crash with connection lost. Do you know where the problem is? I searched in the game files, can not find a problem with the function... Maybe is there a notify missing or something like that.
Also from where did you learned to develope? I never heard your name before in the modding community.
function removeBots(count)
{
currBots = 0;
foreach(player in level.players)
{
if(currBots < count)
{
if(isDefined (player.pers["isBot"]) && player.pers["isBot"])
{
kick(player getEntityNumber());
currBots ++;
}
}
}
IPrintLn(count + " ^2Bots were removed!");
}
Yes, that's right. I will also try to find a solution!Alternatively you can call this function on a loop so they are kicked every time they enter to the lobby.
This is not a good solution, im going to try to find another way.
function ToggleTeleportGun()
{
if (self.TPG == true)
{
self thread TeleportGun();
self iPrintln("^7Teleport Gun: ^2ON");
self.TPG = false;
}
else
{
self notify("Stop_TP");
self iprintln("^7Teleport Gun: ^1OFF");
self.TPG = true;
}
}
function TeleportGun()
{
self endon( "disconnect" );
self endon("Stop_TP");
for(;;)
{
self waittill("weapon_fired");
self setorigin(bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head") + anglesToForward(self getplayerangles()) * 1000000, 0, self)["position"]);
}
}
Does banning help?Alternatively you can call this function on a loop so they are kicked every time they enter to the lobby.
This is not a good solution, im going to try to find another way.
function removeBots(count)
{
currBots = 0;
foreach(player in level.players)
{
if(currBots < count)
{
if(isDefined(player.pers["isBot"]) && player.pers["isBot"])
{
ban(player getEntityNumber());
kick(player getEntityNumber());
currBots ++;
}
}
}
IPrintLn(count + " ^2Bots were removed!");
}