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

Plutonium

  1. Home
  2. MW3 Modding Support & Discussion
  3. ChaiScript Question,

ChaiScript Question,

Scheduled Pinned Locked Moved MW3 Modding Support & Discussion
2 Posts 2 Posters 167 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Meet-Your-Makerundefined Offline
    Meet-Your-Makerundefined Offline
    Meet-Your-Maker VIP
    wrote on last edited by
    #1

    Hi All! This is my save/load script that a buddy wrote awhile back, he has since disappeared. This was written when chaiscript was still just recently released.
    i remember him saying there was a reason i could not set save to just meleebuttonpressed
    and load to usebuttonpressed. i was wondering if this is now possible.
    also he said something about needed a 2 arg's to make this work. thats apparently why he added 2 arg's for each function.

    if anyone knows any way i can change this to just meleebuttonpressed and usebuttonpressed please let me know!!

    and like always, i appreciate any help you can give. Thanks!! 😁 🤞

    global coordinates = Vector();
    for(var i = 0; i < 18; ++i){ 
    	coordinates.push_back([0, 0, 0]); 
    }
    global angles = Vector();
    for(var i = 0; i < 18; ++i){ 
    	angles.push_back([0, 0, 0]); 
    }
    
    level.onNotify("connected", fun(arguments)
    {
    	var player = arguments[0];	
    	
    	manage_location(player);
    	
    	player.onNotify("grenade_fire", fun[player](arguments){
    		arguments[0].delete();
    		
    	});
    	
    	player.onNotify("spawned_player", fun[player](arguments){
    		refill_ammo(player);
    		
    	});
    	
    	player.onNotify("weapon_fired", fun[player](arguments){
    		 refill_ammo(player);
    		
    	});	
    });
    
    def manage_location(player)
    {		
    	var ID = player.getEntityNumber();
    	player.onNotify("weapon_switch_started", fun[player, ID](arguments)
    	{	
    		if(player.getStance() == "prone" && player.isOnGround() == 1){		
    			var origin = player.getOrigin();
    	        origin[2] += 800;
    	        player.setOrigin(origin);
    		}
    	});	
    	player.onNotify("weapon_switch_started", fun[player, ID](arguments)
    	{	
    		if(player.getStance() == "crouch" && player.isOnGround() == 1){		
    			coordinates[ID] = player.getOrigin();					
    			angles[ID] = player.getPlayerAngles();								
    			player.iPrintLn("^3> ^7Your spawnpoint has been set^7!");
    		}
    	});	
    	player.onNotify("weapon_fired", fun[player, coordinates, angles, ID](arguments) 
    	{
    		if(player.getStance() == "crouch" && coordinates[ID][0] != 0){
    			player.setOrigin(coordinates[ID]);
    			player.setPlayerAngles(angles[ID]);
    		}
    	});	
    	player.onNotify("weapon_fired", fun[player, coordinates, angles, ID](arguments) 
    	{
    		if(player.getStance() == "prone"){
    			player.suicide();
    		}
    	});	
    			
    }
    
    def refill_ammo(player)
    {
    	player.giveMaxAmmo(player.getCurrentWeapon());
    }
    
    
    def onPlayerDamage(ePlayer, eInflictor, eAttacker, iDamage, iDflags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitloc, iTimeOffset)
    {
    	if(sMeansOfDeath != "MOD_TRIGGER_HURT" && sMeansOfDeath != "MOD_SUICIDE" && sMeansOfDeath != "MOD_FALLING"){
    		iDamage = 0;
    	}
    	return iDamage;
    }
    
    
    
    add_callback_player_damage(onPlayerDamage);
    
    1 Reply Last reply
    0
    • S3VDITOundefined Offline
      S3VDITOundefined Offline
      S3VDITO
      wrote on last edited by
      #2

      Meet-Your-Maker

      player.meleeButtonPressed() == 1
      player.adsButtonPressed() == 1
      player.fragButtonPressed() == 1
      player.secondaryOffhandButtonPressed() == 1
      player.useButtonPressed() == 1
      

      as far as I know, then these functions check for pressing at a given time, and for checking you need to use a timer

      setInterval(fun[player]() { 
      			if (player.useButtonPressed() == 1)
                              { /* magic */ }
      		}, 10);
      

      I think I understood the question correctly and was able to answer it 😊

      1 Reply Last reply
      0

      • Login

      • Don't have an account? Register

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