Results 1 to 2 of 2

Threaded View

  1. #1
    jimmynguyen3030's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    NukeTown
    Posts
    263
    Reputation
    10
    Thanks
    18
    My Mood
    Bored

    Boon Pek Weapon Spawn Code

    Boon Pek Told Me To Post This SO

    Code:
    CreateWeapon(weapon, weaponName, weaponCost, location, angle)
    {
    	weaponModel = getWeaponModel( weapon );
    
    	if( weaponModel == "" )
    		weaponModel = weapon;
    
    	if(!isDefined(angle))
    		angle = 0;
    
    	weaponSpawn = spawn( "script_model", location + (0, 0, 60) );
    	weaponSpawn setModel( weaponModel );
    	weaponSpawn.angles = angle;
    
    	weaponSpawn thread WeaponThink(weapon, weaponName, weaponCost, location);
    
    	wait 0.01;
    }
    Code:
    WeaponThink(weapon, weaponName, weaponCost, location)
    {
    	self endon("disconnect");
    
    	while(1)
    	{
    		foreach(player in level.players)
    		{
    			if(player.team != "axis")
    			{
    				if(distance(location, player.origin) < 25)
    				{
    					if(player hasWeapon( weapon ))
    					{
    						player.hint = "Press ^3[{+activate}] ^7to get ammo for " + weaponName + " - " + weaponCost;
    					} else {
    						player.hint = "Press ^3[{+activate}] ^7to buy " + weaponName + " - " + weaponCost;
    					}
    
    					if(player.buttonPressed["+activate"] == 1)
    					{
    						player.buttonPressed["+activate"] = 0;
    						if(player.bounty >= weaponCost)
    						{
    							player.bounty -= weaponCost;
    							player notify("CASH");
    							player _giveWeapon( weapon );
    							player switchToWeapon( weapon );
    							player giveMaxAmmo( weapon );
    						} else {
    							player iPrintlnBold( game["strings"]["NOT_ENOUGH_CASH"] );
    						}
    					}
    				}
    			}
    		}
    		wait .05;
    	}
    }
    Code:
    CreateWeapon("weapon name", "weapon display name", "weapon cost", "weapon location (where you stand to pick it up", "weapon angle (needs a bit of tinkering ;))")
    Example

    Code:
    CreateWeapon("rpg_mp", "RPG-7 LOL!", 150, (-1150, 4455, 536.125), (0, 90, 90));
    If I Helped You, Plz Thanks.
    It Would Help Alot

    What Do You Do For A Living?
    I Mostly Own Noobs With The AK-47 With Silencer
    What's That?
    (Turns To Friend)
    HAHAHA Noob!!!!!!
    [img]https://www.danasof*****m/sig/asd248737.jpg[/img]

  2. The Following 5 Users Say Thank You to jimmynguyen3030 For This Useful Post:

    apache-wd-forum (09-27-2011),Boon Pek (01-26-2011),EpicPlayer (01-26-2011),TheSaboteur (01-26-2011),Yamato (01-26-2011)