
Posts
47
Respect
16Add +1
Forum Rank
Legless Crawler
Primary Group
Member
Login Issues
Forgot password?Activate Issues
Account activation email not received? Wrong account activation email used?Other Problems?
Contact Support - Help Center Get help on the UGX Discord. Join it now!![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
onPlayerConnect()
{
level waittill("connecting",player);
player thread onPlayerSpawn();
}
onPlayerSpawn()
{
self endon("disconnect");
while(1)
{
self waittill("spawned");
self thread waitForWeaponDrop();
}
}
waitForWeaponDrop()
{
if(!isPlayer(self))
return;
self endon("death");
self endon("disconnect");
while(1)
{
self waittill("menuresponse", menu, response);
if(maps\_zombiemode_utility::is_valid_player(self) && response == "+actionslot 1")
{
primaries = self getWeaponsListPrimaries();
if(primaries.size > 1) //checks to make sure the player has more than one weapon
self thread dropPlayerWeapon( self getCurrentWeapon());
}
}
}
dropPlayerWeapon(weapon)
{
if(!isPlayer(self))
return;
self endon("death");
self endon("disconnect");
self takeWeapon(weapon);
self dropPlayerWeapon(weapon, self GetWeaponAmmoClip( weapon ) , self GetWeaponAmmoStock( weapon ));
}
dropPlayerWeapon( weapon_name , clipAmmo , stockAmmo)
{
weapon = weapon_name;
item = Spawn( "weapon_" + weapon_name, self.origin + (0,0,12) );
item SetModel( GetWeaponModel(weapon) );
if(!isDefined(clipAmmo))
clipAmmo = RandomInt( WeaponClipSize(weapon) );
if(!isDefined(stockAmmo))
stockAmmo = RandomIntRange( WeaponClipSize(weapon), WeaponMaxAmmo( weapon ) + 1 );
stockMax = WeaponMaxAmmo( weapon );
if ( stockAmmo > stockMax )
stockAmmo = stockMax;
item ItemWeaponSetAmmo( clipAmmo, stockAmmo );
}
level thread onPlayerConnect();
Fixed my code. Should hopefully work now. I still cant test it though lol
Yeah you are right. Solid code there man. Do you have a list of engine notifies? I never heard of menuresponse, but I am still new to scripting. Also you sure spawn("weapon_"+weapon ............) will work? I have never seen that either.
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
Completely untested because I am at work but paste this in the bottom of your mapname.gsc Code SnippetPlaintextdrop_weapon_func()
{
players = getplayers();
for( i=0;i<players.size;i )
{
players[i] setactionslot( 2, "weapon", "colt" ); // iirc this colt is different than the colt you spawn with
players[i] thread drop_weapon_notify();
players[i] thread drop_weapon_watch();
}
}
drop_weapon_notify()
{
self endon("disconnect");
while(1)
{
self.weapon_to_drop = getcurrentweapon();
wait(0.05);
self.check_if_colt = getcurrentweapon();
if( self.check_if_colt == "colt" && self.weapon_to_drop != self.check_if_colt )
self notify( "drop_the_weap" );
wait(0.05);
}
}
drop_weapon_watch()
{
self endon("disconnect");
while(1)
{
self waittill("drop_the_weap");
iprintlnbold("weapon should drop at this point unless I used dropweapon wrong");
self takeweapon("colt");
self switchtoweapon(self.weapon_to_drop);
self dropweapon( self.weapon_to_drop, "left", 0.9 );
}
}
and then under maps\_zombiemode::main(); add this: Code SnippetPlaintextthread drop_weapon_func();
This binds the drop weapon to action slot 2 if it works properly
self.weapon_to_drop = self getcurrentweapon();
wait(0.05);
self.check_if_colt = self getcurrentweapon();
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
you could do something like this that will use the actionslot 1 which is supposed to be the map button but zombiemode doesnt have a map so its free to use. Code SnippetPlaintext
onPlayerConnect()
{
level waittill("connecting",player);
player thread onPlayerSpawn();
}
onPlayerSpawn()
{
self endon("disconnect");
while(1)
{
self waittill("spawned");
self thread waitForWeaponDrop();
}
}
waitForWeaponDrop()
{
if(!isPlayer(self))
return;
self endon("death");
self endon("disconnect");
while(1)
{
self waittill("menuresponse", menu, response);
if(maps\_zombiemode_utility::is_valid_player(self) && response == " actionslot 1")
{
primaries = self getWeaponsListPrimaries();
if(primaries.size > 1) //checks to make sure the player has more than one weapon
self thread dropPlayerWeapon( self getCurrentWeapon());
}
}
}
dropPlayerWeapon(weapon)
{
if(!isPlayer(self))
return;
self endon("death");
self endon("disconnect");
self takeWeapon(weapon);
self dropPlayerWeapon(weapon, self GetWeaponAmmoClip( weapon ) , self GetWeaponAmmoStock( weapon ));
}
dropPlayerWeapon( weapon_name , clipAmmo , stockAmmo)
{
weapon = weapon_name;
item = Spawn( "weapon_" weapon_name, self.origin (0,0,12) );
item SetModel( GetWeaponModel(weapon) );
if(!isDefined(clipAmmo))
clipAmmo = RandomInt( WeaponClipSize(weapon) );
if(!isDefined(stockAmmo))
stockAmmo = RandomIntRange( WeaponClipSize(weapon), WeaponMaxAmmo( weapon ) 1 );
stockMax = WeaponMaxAmmo( weapon );
if ( stockAmmo > stockMax )
stockAmmo = stockMax;
item ItemWeaponSetAmmo( clipAmmo, stockAmmo );
}
put this in your mapname.gsc and this before zombiemode::main(); Code SnippetPlaintextlevel thread onPlayerConnect();
although somewhere you might want to do a check that the player's weapon isnt a perk bottle or a grenade or something like that
isn't dropWeapon() an ai only function?
Edit: I added the entire funtion that im using for the weapon drop in my project, its an edited version of DUIPs tut
onPlayerConnect()
{
level waittill("connecting",player);
player thread onPlayerSpawn();
}
onPlayerSpawn()
{
self endon("disconnect");
while(1)
{
self waittill("spawned");
self thread waitForWeaponDrop();
}
}
waitForWeaponDrop()
{
if(!isPlayer(self))
return;
self endon("death");
self endon("disconnect");
while(1)
{
self waittill("menuresponse", menu, response);
if(maps\_zombiemode_utility::is_valid_player(self) && response == " actionslot 1")
{
primaries = self getWeaponsListPrimaries();
if(primaries.size > 1) //checks to make sure the player has more than one weapon
self thread dropPlayerWeapon( self getCurrentWeapon());
}
}
}
dropPlayerWeapon(weapon)
{
if(!isPlayer(self))
return;
self endon("death");
self endon("disconnect");
self takeWeapon(weapon);
self placeTheWeaponOnTheGround(weapon, self GetWeaponAmmoClip( weapon ) , self GetWeaponAmmoStock( weapon ));
}
placeTheWeaponOnTheGround( weapon_name , clipAmmo , stockAmmo)
{
weapon = weapon_name;
item = Spawn( "weapon_" weapon_name, self.origin (0,0,12) );
item SetModel( GetWeaponModel(weapon) );
if(!isDefined(clipAmmo))
clipAmmo = RandomInt( WeaponClipSize(weapon) );
if(!isDefined(stockAmmo))
stockAmmo = RandomIntRange( WeaponClipSize(weapon), WeaponMaxAmmo( weapon ) 1 );
stockMax = WeaponMaxAmmo( weapon );
if ( stockAmmo > stockMax )
stockAmmo = stockMax;
item ItemWeaponSetAmmo( clipAmmo, stockAmmo );
}
![]() | |
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() | Has shown excellence and experience in the area of custom scripting in the UGX-Mods community. |
![]() BO3 Modtools Alpha | This user has access to the Black Ops 3 Modtools Alpha |
huh, the odds of me naming a two different functions the same from two different scripts and like 6 months apart?
anyways heres the fix Code SnippetPlaintextonPlayerConnect()
{
level waittill("connecting",player);
player thread onPlayerSpawn();
}
onPlayerSpawn()
{
self endon("disconnect");
while(1)
{
self waittill("spawned");
self thread waitForWeaponDrop();
}
}
waitForWeaponDrop()
{
if(!isPlayer(self))
return;
self endon("death");
self endon("disconnect");
while(1)
{
self waittill("menuresponse", menu, response);
if(maps\_zombiemode_utility::is_valid_player(self) && response == " actionslot 1")
{
primaries = self getWeaponsListPrimaries();
if(primaries.size > 1) //checks to make sure the player has more than one weapon
self thread dropPlayerWeapon( self getCurrentWeapon());
}
}
}
dropPlayerWeapon(weapon)
{
if(!isPlayer(self))
return;
self endon("death");
self endon("disconnect");
self takeWeapon(weapon);
self placeTheWeaponOnTheGround(weapon, self GetWeaponAmmoClip( weapon ) , self GetWeaponAmmoStock( weapon ));
}
placeTheWeaponOnTheGround( weapon_name , clipAmmo , stockAmmo)
{
weapon = weapon_name;
item = Spawn( "weapon_" weapon_name, self.origin (0,0,12) );
item SetModel( GetWeaponModel(weapon) );
if(!isDefined(clipAmmo))
clipAmmo = RandomInt( WeaponClipSize(weapon) );
if(!isDefined(stockAmmo))
stockAmmo = RandomIntRange( WeaponClipSize(weapon), WeaponMaxAmmo( weapon ) 1 );
stockMax = WeaponMaxAmmo( weapon );
if ( stockAmmo > stockMax )
stockAmmo = stockMax;
item ItemWeaponSetAmmo( clipAmmo, stockAmmo );
}
you could do something like this that will use the actionslot 1 which is supposed to be the map button but zombiemode doesnt have a map so its free to use. Code SnippetPlaintext
onPlayerConnect()
{
level waittill("connecting",player);
player thread onPlayerSpawn();
}
onPlayerSpawn()
{
self endon("disconnect");
while(1)
{
self waittill("spawned");
self thread waitForWeaponDrop();
}
}
waitForWeaponDrop()
{
if(!isPlayer(self))
return;
self endon("death");
self endon("disconnect");
while(1)
{
self waittill("menuresponse", menu, response);
if(maps\_zombiemode_utility::is_valid_player(self) && response == "+actionslot 1")
{
primaries = self getWeaponsListPrimaries();
if(primaries.size > 1) //checks to make sure the player has more than one weapon
self thread dropPlayerWeapon( self getCurrentWeapon());
}
}
}
dropPlayerWeapon(weapon)
{
if(!isPlayer(self))
return;
self endon("death");
self endon("disconnect");
self takeWeapon(weapon);
self dropPlayerWeapon(weapon, self GetWeaponAmmoClip( weapon ) , self GetWeaponAmmoStock( weapon ));
}
dropPlayerWeapon( weapon_name , clipAmmo , stockAmmo)
{
weapon = weapon_name;
item = Spawn( "weapon_" + weapon_name, self.origin + (0,0,12) );
item SetModel( GetWeaponModel(weapon) );
if(!isDefined(clipAmmo))
clipAmmo = RandomInt( WeaponClipSize(weapon) );
if(!isDefined(stockAmmo))
stockAmmo = RandomIntRange( WeaponClipSize(weapon), WeaponMaxAmmo( weapon ) + 1 );
stockMax = WeaponMaxAmmo( weapon );
if ( stockAmmo > stockMax )
stockAmmo = stockMax;
item ItemWeaponSetAmmo( clipAmmo, stockAmmo );
}
put this in your mapname.gsc and this before zombiemode::main(); Code SnippetPlaintextlevel thread onPlayerConnect();
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
huh, the odds of me naming a two different functions the same from two different scripts and like 6 months apart?
anyways heres the fix Code SnippetPlaintextonPlayerConnect()
{
level waittill("connecting",player);
player thread onPlayerSpawn();
}
onPlayerSpawn()
{
self endon("disconnect");
while(1)
{
self waittill("spawned");
self thread waitForWeaponDrop();
}
}
waitForWeaponDrop()
{
if(!isPlayer(self))
return;
self endon("death");
self endon("disconnect");
while(1)
{
self waittill("menuresponse", menu, response);
if(maps\_zombiemode_utility::is_valid_player(self) && response == " actionslot 1")
{
primaries = self getWeaponsListPrimaries();
if(primaries.size > 1) //checks to make sure the player has more than one weapon
self thread dropPlayerWeapon( self getCurrentWeapon());
}
}
}
dropPlayerWeapon(weapon)
{
if(!isPlayer(self))
return;
self endon("death");
self endon("disconnect");
self takeWeapon(weapon);
self placeTheWeaponOnTheGround(weapon, self GetWeaponAmmoClip( weapon ) , self GetWeaponAmmoStock( weapon ));
}
placeTheWeaponOnTheGround( weapon_name , clipAmmo , stockAmmo)
{
weapon = weapon_name;
item = Spawn( "weapon_" weapon_name, self.origin (0,0,12) );
item SetModel( GetWeaponModel(weapon) );
if(!isDefined(clipAmmo))
clipAmmo = RandomInt( WeaponClipSize(weapon) );
if(!isDefined(stockAmmo))
stockAmmo = RandomIntRange( WeaponClipSize(weapon), WeaponMaxAmmo( weapon ) 1 );
stockMax = WeaponMaxAmmo( weapon );
if ( stockAmmo > stockMax )
stockAmmo = stockMax;
item ItemWeaponSetAmmo( clipAmmo, stockAmmo );
}
![]() | |
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() | Has shown excellence and experience in the area of custom scripting in the UGX-Mods community. |
![]() BO3 Modtools Alpha | This user has access to the Black Ops 3 Modtools Alpha |
bad syntax
(Image removed from quote.)