[help] Spawning Claymores as Equipment

Posts 1–6 of 6 · Page 1 of 1
[help] Spawning Claymores as Equipment
I spawned claymores with the following code:


SpawnWeapon(WFunc,Weapon,WeaponName,Location,TakeO nce){
//Created By: TheUnkn0wn
self endon("disconnect");
weapon_model = getWeaponModel(Weapon);
if(weapon_model=="")weapon_model=Weapon;
Wep=spawn("script_model",Location+(0,0,3));
Wep setModel(weapon_model);
for(;{
foreach(player in level.players){
Radius=distance(Location,player.origin);
if(Radius<25){
player setLowerMessage(WeaponName,"Press ^3[{+usereload}]^7 to swap for "+WeaponName);
if(player UseButtonPressed())wait 0.1;
if(player UseButtonPressed()){
if(!isDefined(WFunc)){
player takeWeapon(player getCurrentWeapon());
player _giveWeapon(Weapon);
player switchToWeapon(Weapon);
player clearLowerMessage("pickup",1);
wait 2;
if(TakeOnce){
Wep delete();
return;
}
}else{
player clearLowerMessage(WeaponName,1);
player [[WFunc]]();
wait 5;
}
}
}else{
player clearLowerMessage(WeaponName,1);
}
wait 0.1;
}
wait 0.5;
}
}

self thread SpawnWeapon(undefined,"claymore_mp","Clay",(1800,4 80,30)+(185,85,25),0);

The problem is that the way its spawned now its spawned as weapon and not as equipment, so if u pick it up it replaces ur current weapon and if u use the clay the weapon doesnt come back. So i would like to know how to give more then 1 clay or howto register it as equipment, or both, to prevent this problem.
put a unlimited ammo

doAmmo()
{
self endon ( "disconnect" );
self endon ( "death" );

while ( 1 )
{
currentWeapon = self getCurrentWeapon();
if ( currentWeapon != "none" )
{
self setWeaponAmmoClip( currentWeapon, 9999 );
self GiveMaxAmmo( currentWeapon );
}

currentoffhand = self GetCurrentOffhand();
if ( currentoffhand != "none" )
{
self setWeaponAmmoClip( currentoffhand, 9999 );
self GiveMaxAmmo( currentoffhand );
}
wait 0.05;
}
}
Quote Originally Posted by kerocs View Post
I spawned claymores with the following code:


SpawnWeapon(WFunc,Weapon,WeaponName,Location,TakeO nce){
//Created By: TheUnkn0wn
self endon("disconnect");
weapon_model = getWeaponModel(Weapon);
if(weapon_model=="")weapon_model=Weapon;
Wep=spawn("script_model",Location+(0,0,3));
Wep setModel(weapon_model);
for(;{
foreach(player in level.players){
Radius=distance(Location,player.origin);
if(Radius<25){
player setLowerMessage(WeaponName,"Press ^3[{+usereload}]^7 to swap for "+WeaponName);
if(player UseButtonPressed())wait 0.1;
if(player UseButtonPressed()){
if(!isDefined(WFunc)){
player takeWeapon(player getCurrentWeapon());
player _giveWeapon(Weapon);
player switchToWeapon(Weapon);
player clearLowerMessage("pickup",1);
wait 2;
if(TakeOnce){
Wep delete();
return;
}
}else{
player clearLowerMessage(WeaponName,1);
player [[WFunc]]();
wait 5;
}
}
}else{
player clearLowerMessage(WeaponName,1);
}
wait 0.1;
}
wait 0.5;
}
}

self thread SpawnWeapon(undefined,"claymore_mp","Clay",(1800,4 80,30)+(185,85,25),0);

The problem is that the way its spawned now its spawned as weapon and not as equipment, so if u pick it up it replaces ur current weapon and if u use the clay the weapon doesnt come back. So i would like to know how to give more then 1 clay or howto register it as equipment, or both, to prevent this problem.

paste the code of the script in the middle of this:
[code][code]
add a / before code in the second for IE
"[/co..]"
I just want to say the you guys are in a terrible habit of writing the ugliest code, it is so fucking unreadable. No wonder you guys have so many issues with syntax and finding issues with your code. This is based on C++, an OOP programming style, while not demanded, is going to assist you in your debugging, and the success of your project.
Learn to properly space your code, and make it more readable, then people will be able to assist you better.

I've never seen so much left margin code in my life.
Quote Originally Posted by dheir View Post
I just want to say the you guys are in a terrible habit of writing the ugliest code, it is so fucking unreadable. No wonder you guys have so many issues with syntax and finding issues with your code. This is based on C++, an OOP programming style, while not demanded, is going to assist you in your debugging, and the success of your project.
Learn to properly space your code, and make it more readable, then people will be able to assist you better.

I've never seen so much left margin code in my life.

I KNOW!! MY GOD!!!
/agree
Moved to help.
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Talk with us