Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

TheHiddenHourundefined

TheHiddenHour

@TheHiddenHour
Contributor
About
Posts
55
Topics
1
Shares
0
Groups
1
Followers
6
Following
4

Posts

Recent Best Controversial

  • question on making a simple gsc code for "reserved slots"
    TheHiddenHourundefined TheHiddenHour

    mikzy Untested, but I left some comments that should make it easy to figure out.

    hasVipStatus() {
    	/*
    		Conduct your VIP status check here 
    	*/
    	
    	return status;
    }
    
    /*
    	Returns bool on whether room was made for the VIP player
    	
    	vip_slots - The amount of VIP slots on the server 
    */
    makeVipRoom(vip_slots) {
    	room_made = false;
    	
    	if(level.players.size >= vip_slots) { // If there's as many or more players as there are vip slots, we need to kick someone who isn't vip 
    		for(i = 0; i < level.players.size; i++) { // Iterate over each player in the server 
    			player = level.players[i];
    			if(!player isHost() && !player hasVipStatus()) { // If the player isn't host and isn't vip 
    				// The iterator index should be the same as the entity number in this case (I think) 
    				kick(i); // Kick the non-vip player 
    				room_made = true;
    				break;
    			}
    		}
    	}
    	
    	return room_made;
    }
    

    makeVipRoom() returns a boolean on whether room was made or not. Maybe you could use it to send an error or something to the player that there's no room available.

    BO2 Modding Support & Discussion

  • [Support] Can you set DVAR so players have VIP when map changes?
    TheHiddenHourundefined TheHiddenHour

    mikzy Restart

    BO2 Modding Support & Discussion

  • Respawn on Saved Position Code?
    TheHiddenHourundefined TheHiddenHour

    Vulgar

    toggleSaveAndLoad() {
    	if(!isDefined(self.saveAndLoad) || !self.saveAndLoad) {
    		self.saveAndLoad = true;
    		self thread saveAndLoad();
    	}
    	else {
    		self.saveAndLoad = false;
    		self notify("endSaveAndLoad");
    	}
    	msg = "Save and Load [" + (self.saveAndLoad) ? "^2ON" : "^1OFF" + "^7]";
    	self iprintln(msg);
    }
    
    saveAndLoad() {
    	self endon("disconnect");
    	self endon("endSaveAndLoad")
    	
    	for(;;) {
    		if(self getStance() == "crouch") {
    			if(self actionSlotTwoButtonPressed()) { // Save location 
    				self.savedOrigin = self.origin;
    				self.savedAngles = self.angles;
    				self iprintln("^5Position saved");
    			}
    			else if(self actionSlotOneButtonPressed()) { // Load location 
    				self setPlayerAngles(self.savedAngles);
    				self setOrigin(self.savedOrigin);
    				self iprintln("^6Position loaded");
    			}
    		}
    		
    		wait .01;
    	}
    }
    

    Untested.

    BO2 Modding Support & Discussion

  • [Release] MW3 Style Infection Gamemode *UPDATED 10/20/2020*
    TheHiddenHourundefined TheHiddenHour

    You might want to store player XUIDs instead of names. Very nice 👍 .

    BO2 Modding Releases & Resources

  • [Support] How do I implement Overflow Fix in my code? ! Help
    TheHiddenHourundefined TheHiddenHour

    Kalitos A bit off topic, but you should know that you can utilize a HUD element's label attribute in order to prevent unnecessary unique string usage. Here's an example of your code converted:

    healthPlayer ()
    {
    	self endon ("disconnect");
    
    	self.healthText = createFontString ("Objective", 1.7);
    	self.healthText setPoint ("CENTER", "TOP", 300, "CENTER");
    	self.healthText.label = &"^2 HEALTH: ^7";
    	
    	while (true)
    	{
    		self.healthText setValue(self.health);
    		wait 0.25;
    	}
    }
    

    As you can see, I assigned some text to your HUDs label attribute and replaced setText() with setValue(). This can be done because you only ever need to update the health value and not the text before it. Using this method, you're only using one unique string rather than a new one every time the player's health changes.

    BO2 Modding Support & Discussion

  • [Resource] Weapons and attachments restriction !Code
    TheHiddenHourundefined TheHiddenHour

    Look into level.givecustomloadout. It's a better method than rigging up your own class monitor.

    BO2 Modding Support & Discussion

  • How do you create a hud element?
    TheHiddenHourundefined TheHiddenHour

    Vulture Aid createFontString(font, fontScale), setPoint(point, relativePoint, x, y).

    font has a few different options like "default", and "objective". fontScale is self explanatory, it's the scale of the font lol.

    point and relativePoint are a bit different though. There's "CENTER", "TOP", "BOTTOM", "LEFT", "RIGHT", "TOPRIGHT", "TOP_RIGHT", "TOPLEFT", "TOP_LEFT", "TOPCENTER", "BOTTOM RIGHT", "BOTTOM_RIGHT", "BOTTOM LEFT", "BOTTOM_LEFT".
    You can kind of think of these as anchors. If I made a HUD with points "RIGHT", "RIGHT" and I appended text to it constantly, the HUD would grow to the left to maintain its position on the right.

    BO2 Client Support

  • [Support] Get weapon category from weapon array
    TheHiddenHourundefined TheHiddenHour

    Kalitos You might want to do some testing with getWeaponClass() though, I don't know the exact strings it returns. Do a test with an AR, an SMG, a shotgun, etc and see what it returns.

    BO2 Modding Support & Discussion

  • [Support] Get weapon category from weapon array
    TheHiddenHourundefined TheHiddenHour

    Kalitos You could get the weapon name and check over each item in the array to see if it contains that weapon, but that's not very efficient lol. If I were to write a system where I needed to know what category a weapon was using strings like "Assault Rifle" or "Shotgun", I would do something like this:

    getWeaponClass(weapon) is a function that does what the name says, it gets the class of a weapon. It returns strings like "weapon_sniper", or "weapon_smg" iirc.

    Instead of writing out an array of weapons, I would just make a function like this:

    getWeaponCategory(weapon) {
    	weap_class = getWeaponClass(weapon);
    	switch(weap_class) {
    		case "weapon_sniper":
    			return "Sniper";
    		case "weapon_smg":
    			return "SMG";
    		case "weapon_rifle":
    			return "Assault Rifle";
    		// etc, etc, etc...
    	}
    }
    

    The other method I mentioned would allow you to have your own custom categories however, which is one of the downfalls of this approach.

    Just for shits and giggles, here's how I'd do the first method:

    getWeaponCategory(weapon) {
    	weapon_arrs = strTok("Assault Rifle;Shotgun;LMG;SMG;Sniper;Pistol;Launcher;Special;Lethal;Tactical", ";");
    	foreach(arr in weapon_arrs) {
    		if(isInArray(level.WeaponArray[arr], weapon)) {
    			return arr;
    		}
    	}
    	
    	return "unknown_category";
    }
    
    BO2 Modding Support & Discussion

  • [Support] Get weapon category from weapon array
    TheHiddenHourundefined TheHiddenHour

    Kalitos For example, getWeaponCategory("tar21_mp") would return "Assault Rifle"?

    BO2 Modding Support & Discussion

  • [Support] Split function for handling text strings
    TheHiddenHourundefined TheHiddenHour

    Kalitos The second one is correct.

    BO2 Modding Support & Discussion

  • [Support] Split function for handling text strings
    TheHiddenHourundefined TheHiddenHour

    Kalitos Can you be a bit more specific? If you want to know if an array contains a value, isInArray(array, value) should be able to do it.

    BO2 Modding Support & Discussion

  • [Support] Split function for handling text strings
    TheHiddenHourundefined TheHiddenHour

    Kalitos strTok(string, token) is what you're looking for. It returns an array of strings.

    For ex.
    strTok("test,string,here", ",") will return ["test", "string, here"]

    strTok("test;string;here", ";") will return ["test", "string", "here"]

    BO2 Modding Support & Discussion

  • [Support] Server Side Support
    TheHiddenHourundefined TheHiddenHour

    Farzad I test on a CFW PS3 lol. Anyways, I wrote you something

    init() {
    	level.botsSpawned = false; // Whether bots have been spawned yet 
    	level.botsAmount = 1; // Amount of bots to spawn 
    }
    
    onPlayerSpawned() {
    	for(;;) {
    		self waittill("spawned_player");
    		
    		self thread switchTeam("axis"); // Move all players to axis team 
    		
    		if(!level.botsSpawned) {
    			// Kick existing bots 
    			foreach(player in level.players) {
    				if(isAI(player)) { // Player is a bot 
    					ent_num = player getEntityNumber(); // Get bot entity number 
    					kick(ent_num); // Kick bot 
    				}
    			}
    			
    			// Spawn new bots 
    			for(i = 0; i < level.botsAmount; i++) {
    				level thread maps/mp/bots/_bot::spawn_bot("allies");
    			}
    			
    			level.botsSpawned = true;
    		}
    	}
    }
    
    switchTeam(team) {
    	if ( self.sessionstate != "dead" ) {
    		self.switching_teams = 1;
    		self.joining_team = team;
    		self.leaving_team = self.pers[ "team" ];
    		// self suicide();
    	}
    	self.pers[ "team" ] = team;
    	self.team = team;
    	self.sessionteam = self.pers[ "team" ];
    	if ( !level.teambased ) {
    		self.ffateam = team;
    	}
    	self maps/mp/gametypes/_globallogic_ui::updateobjectivetext();
    	self maps/mp/gametypes/_spectating::setspectatepermissions();
    	// self setclientscriptmainmenu( game[ "menu_class" ] );
    	// self openmenu( game[ "menu_class" ] );
    	self notify( "end_respawn" );
    }
    

    Give this a whack. Again, I didn't test, and if there's any problems then you're on your own since I really can't test atm. Sorry.

    BO2 Modding Support & Discussion

  • [Support] Server Side Support
    TheHiddenHourundefined TheHiddenHour

    Farzad Ahh, that's probably from the bot check fucking up. Again, I didn't test it or anything. Just remove it for now, I'll help you in a little while.

    BO2 Modding Support & Discussion

  • [Support] Server Side Support
    TheHiddenHourundefined TheHiddenHour

    Farzad I don't know, what errors are you receiving? I'm almost done for the night so I'll be able to help you more in a bit.

    BO2 Modding Support & Discussion

  • [Support] Server Side Support
    TheHiddenHourundefined TheHiddenHour

    Farzad isPlayer(player); This will check if the player is a bot or not.
    Basically, you're going to want to follow these steps:

    • Iterate over every player when the round starts
    • Check if they're a bot
    • If they are, kick them
    • Spawn another bot to replace them
    foreach(player in level.players) {
    	if(!isPlayer(player)) { // Player is a bot
    		player kickPlayer();
    		// Spawn bot line here 
    	}
    }
    

    Something like this. You'll have to play around and experiment as I haven't tested it ofc.

    BO2 Modding Support & Discussion

  • [Support] Server Side Support
    TheHiddenHourundefined TheHiddenHour

    Farzad So you can kick the bot and spawn another one in. Again, no clue why it doesn't spawn in.

    BO2 Modding Support & Discussion

  • [Support] Server Side Support
    TheHiddenHourundefined TheHiddenHour

    Farzad You're going to need to know some scripting knowledge mate. I've given you the means to switch a players team and get the amount of players on a team, now you need to write the logic. I'll even write you a function real quick that can kick players:

    kickPlayer() {
    	ent_num = self getEntityNumber();
    	kick(ent_num);
    }
    

    You can call it like self kickPlayer(); // Will kick the player who called the function
    I won't be writing something that you can C+P as that'd take a while. Hopefully a mod or someone else will help flesh it out for you.

    BO2 Modding Support & Discussion

  • [Support] Server Side Support
    TheHiddenHourundefined TheHiddenHour

    Farzad I'm playing some Warzone with my buds rn, sorry chief lol. I hope that admin comes soon though 👍 .

    EDIT: I can write this for you though.

    getTeamCount(team) {
    	count = 0;
    	foreach(player in level.players) {
    		if(player.team == team) {
    			count++;
    		}
    	}
    	
    	return count;
    }
    
    BO2 Modding Support & Discussion
  • 1
  • 2
  • 3
  • 2 / 3
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate