AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ham_strip_weapon.Won't strip. (https://forums.alliedmods.net/showthread.php?t=89368)

xbatista 04-05-2009 13:49

ham_strip_weapon.Won't strip.
 
When I give a weapon(ham_give_weapon) ,yes it gives, but won't be stripped by Level, what the problem???

P.S. fm_strip_user_weapons works,but I don't want strip all weapons.

PHP Code:

new const WEAPONCONST[MAXLEVEL][] = {"weapon_glock18""weapon_usp""weapon_p228""weapon_fiveseven""weapon_deagle""weapon_elite""weapon_tmp"
"weapon_mac10""weapon_ump45""weapon_mp5navy""weapon_p90""weapon_scout""weapon_awp""weapon_famas""weapon_galil""weapon_m3""weapon_xm1014"
"weapon_ak47""weapon_m4a1""weapon_aug""weapon_sg552""weapon_sg550""weapon_g3sg1""weapon_m249" 
}; // Give Weapons

ham_strip_weapon(idWEAPONCONST[PlayerLevel[id]]);
ham_give_weapon(idWEAPONCONST[PlayerLevel[id]]); 


Bugsy 04-05-2009 13:51

Re: ham_strip_weapon.Won't strip.
 
Quote:

Originally Posted by xbatista (Post 798124)
When I give a weapon(ham_give_weapon) ,yes it gives, but won't be stripped first(ham_strip_weapon), what the problem???

P.S. fm_strip_user_weapons works,but I don't want strip all weapons.

PHP Code:

new const WEAPONCONST[MAXLEVEL][] = {"weapon_glock18""weapon_usp""weapon_p228""weapon_fiveseven""weapon_deagle""weapon_elite""weapon_tmp"
"weapon_mac10""weapon_ump45""weapon_mp5navy""weapon_p90""weapon_scout""weapon_awp""weapon_famas""weapon_galil""weapon_m3""weapon_xm1014"
"weapon_ak47""weapon_m4a1""weapon_aug""weapon_sg552""weapon_sg550""weapon_g3sg1""weapon_m249" 
}; // Give Weapons

ham_strip_weapon(idWEAPONCONST[PlayerLevel[id]]);
ham_give_weapon(idWEAPONCONST[PlayerLevel[id]]); 


Strip weapons is going to strip all weapons. If you want to drop a single weapon, use

PHP Code:

engclient_cmdid "drop" WEAPONCONSTPlayerLevel[id] ] ); 


xbatista 04-05-2009 13:53

Re: ham_strip_weapon.Won't strip.
 
I don't wanna drop it ^^ I need strip it.
P.S. It strips by level.

Why ham_strip won't strip?
And why fm_strip_user_weapons works fine(it strips,but I need not all weapons.)

Bugsy 04-05-2009 14:04

Re: ham_strip_weapon.Won't strip.
 
What does strip mean to you?

1. Drop a single weapon and leave it on the ground.
2. Drop a single weapon and delete it from the map.
3. Remove all of a players weapons and leave on ground.
4. Remove all of a players weapons and delete from map.

xbatista 04-05-2009 14:08

Re: ham_strip_weapon.Won't strip.
 
Quote:

What does strip mean to you?

1. Drop a single weapon and leave it on the ground.
2. Drop a single weapon and delete it from the map.
3. Remove all of a players weapons and leave on ground.
4. Remove all of a players weapons and delete from map.

PHP Code:

stock ham_strip_weapon(id,weapon[])
{
    if(!
equal(weapon,"weapon_",7)) return 0;

    new 
wId get_weaponid(weapon);
    if(!
wId) return 0;

    new 
wEnt;
    while((
wEnt engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
    if(!
wEnt) return 0;

    if(
get_user_weapon(id) == wIdExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);

    if(!
ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0;
    
ExecuteHamB(Ham_Item_Kill,wEnt);

    
set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId));

    return 
1;


When player holding weapon,it dissapears.

ConnorMcLeod 04-05-2009 14:08

Re: ham_strip_weapon.Won't strip.
 
Quote:

Originally Posted by Bugsy (Post 798128)
Strip weapons is going to strip all weapons. If you want to drop a single weapon, use

Wrong.
http://forums.alliedmods.net/showthread.php?t=56377

Bugsy 04-05-2009 14:18

Re: ham_strip_weapon.Won't strip.
 
Quote:

Originally Posted by ConnorMcLeod (Post 798140)

Oops, I was getting ham_strip_weapon confused with fm_strip_user_weapons().

ConnorMcLeod 04-05-2009 14:20

Re: ham_strip_weapon.Won't strip.
 
To strip all weapons, fun native is better.
To strip 1 weapon, use the ham stock or fm_strip_user_gun.

xbatista 04-05-2009 14:21

Re: ham_strip_weapon.Won't strip.
 
ham_strip_weapon - not working with WEAPONCONST[PlayerLevel[id]] - won't strip.
ham_give_weapon - works with WEAPONCONST[PlayerLevel[id]].
fm_strip_user_weapons(id) - just works,but I don't want strip all weapons :/.

P.S. Tryied : fm_strip_user_gun , same thing like ham_strip.

ConnorMcLeod 04-05-2009 14:25

Re: ham_strip_weapon.Won't strip.
 
From what i've seen (1st post), the player level doesn't change after you try to strip and before you try to give, so i think this is the problem.

You would have to strip the weapon, then update the level, then give the new weapon.


All times are GMT -4. The time now is 02:26.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.