Skip to content
  • 0 Unread 0
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. Add points at round start

Add points at round start

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
3 Posts 3 Posters 387 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • itsmeeenglundefined Offline
    itsmeeenglundefined Offline
    itsmeeengl
    wrote on last edited by
    #1

    Hi there!
    I am creating a script to add 2000 points to the player at the start of each round, but it is not working for me.
    Could you help me please.

    This is my code

    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\zombies\_zm;
    #include maps\mp\zombies\_zm_utility;
    #include maps\mp\gametypes_zm\_hud_util;
    #include maps\mp\gametypes_zm\_hud_message;
    
    init () {
    	level.perk_purchase_limit = 9;
    	level.start_weapon = "fiveseven_zm";
    
    	level thread onPlayerConnect();
    }
    
    onPlayerConnect() {
    	for (;;) {
    		level waittill("connecting", player);
    
    		player thread onPlayerSpawned();
    	}
    }
    
    onPlayerSpawned() {
    	level endon("game_ended");
    	self endon("disconnect");
    	
    	self.initial_spawn = true;
    
    	for (;;) {
    		self waittill("spawned_player");
    
    		if (self.initial_spawn) {
    			self.initial_spawn = false;
    
    			self.score = 5000;
    
    			self.maxhealth = 150;
    			self.health = self.maxhealth;
    
    			self IPrintLn("^5" + self.name + " ^3has been connected!");
    		}
    	}
    
    	if (level.round_number > 1) {
    		for (;;) {
    			self.score += 2000;
    			level waittill("start_of_round");
    			self.score += 2000;
    		}
    	}
    }
    
    JezuzLizardundefined 1 Reply Last reply
    0
    • Resxtundefined Offline
      Resxtundefined Offline
      Resxt
      Plutonium Staff
      wrote on last edited by
      #2

      The best solution is usually to debug and see where it's not working.
      Are you sure level waittill("start_of_round"); is a valid waittill? Can you print something before and after it?
      Also what are you trying to do exactly? Because from what I can see it only gives you 2000 points if you connect at round 2 or more

      1 Reply Last reply
      0
      • itsmeeenglundefined itsmeeengl

        Hi there!
        I am creating a script to add 2000 points to the player at the start of each round, but it is not working for me.
        Could you help me please.

        This is my code

        #include common_scripts\utility;
        #include maps\mp\_utility;
        #include maps\mp\zombies\_zm;
        #include maps\mp\zombies\_zm_utility;
        #include maps\mp\gametypes_zm\_hud_util;
        #include maps\mp\gametypes_zm\_hud_message;
        
        init () {
        	level.perk_purchase_limit = 9;
        	level.start_weapon = "fiveseven_zm";
        
        	level thread onPlayerConnect();
        }
        
        onPlayerConnect() {
        	for (;;) {
        		level waittill("connecting", player);
        
        		player thread onPlayerSpawned();
        	}
        }
        
        onPlayerSpawned() {
        	level endon("game_ended");
        	self endon("disconnect");
        	
        	self.initial_spawn = true;
        
        	for (;;) {
        		self waittill("spawned_player");
        
        		if (self.initial_spawn) {
        			self.initial_spawn = false;
        
        			self.score = 5000;
        
        			self.maxhealth = 150;
        			self.health = self.maxhealth;
        
        			self IPrintLn("^5" + self.name + " ^3has been connected!");
        		}
        	}
        
        	if (level.round_number > 1) {
        		for (;;) {
        			self.score += 2000;
        			level waittill("start_of_round");
        			self.score += 2000;
        		}
        	}
        }
        
        JezuzLizardundefined Offline
        JezuzLizardundefined Offline
        JezuzLizard
        Plutonium Staff
        wrote on last edited by
        #3

        @ElMalambito69 The second for loop in onplayerspawned() is unreachable, I recommend putting it in a different thread.

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

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