AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   strip weapons (https://forums.alliedmods.net/showthread.php?t=93392)

Debesėlis 05-28-2009 07:51

strip weapons
 
How do I get the other weapons removed once these are given? Because when a player has an M3 and is given new weapons on the next round, he still keeps the M3. I need the old weapons the player had removed and only the new ones (also the C4 for T's) given.

PHP Code:

public rifles(id)
{
    if(
rifles_active[id] == 1)
    {
        if(
cs_get_user_team(id) == CS_TEAM_T)
        {
            
cs_set_user_defuse(id0)
            
give_item(id"weapon_glock18")
            
give_item(id"weapon_deagle")
            
give_item(id"weapon_ak47")
            
give_item(id"weapon_awp")
        }

        if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
cs_set_user_defuse(id1)
            
give_item(id"weapon_usp")
            
give_item(id"weapon_deagle")
            
give_item(id"weapon_m4a1")
            
give_item(id"weapon_awp")
        }
    }



31m0_owns 05-28-2009 08:07

Re: strip weapons
 
PHP Code:

fm_strip_weapon(id); 

this strips all weapons from every player

for t's add

PHP Code:

fm_give_item(player"weapon_c4"

This should fix it. But put the
PHP Code:

fm_strip_weapon(id); 

before the people get the items

Debesėlis 05-28-2009 08:14

Re: strip weapons
 
and every round player has got c4? if all weapons are strippet and givet every round need buy ammo... :|

31m0_owns 05-28-2009 08:18

Re: strip weapons
 
My bad my friend...

PHP Code:

fm_strip_weapon(id);
 
public 
rifles(id)
{
    if(
rifles_active[id] == 1)
    {
        if(
cs_get_user_team(id) == CS_TEAM_T)
        {
            
cs_set_user_defuse(id0)
            
give_item(id"weapon_c4")
            
give_item(id"weapon_glock18")
            
give_item(id"weapon_deagle")
            
give_item(id"weapon_ak47")
            
give_item(id"weapon_awp")
        }
 
        if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
cs_set_user_defuse(id1)
            
give_item(id"weapon_usp")
            
give_item(id"weapon_deagle")
            
give_item(id"weapon_m4a1")
            
give_item(id"weapon_awp")
        }
    }


sorry if everything is miss colored i am at my school and they don't have pawn/amxx studio

Debesėlis 05-28-2009 08:49

Re: strip weapons
 
I need strip weapons not for all players! public rifes(id) this is menu item... when it aktive on next round gives some weapons... I want to next spawn from player removes weapons but stay only USP, deagle, m4, awp....

31m0_owns 05-28-2009 08:51

Re: strip weapons
 
Putting fm_strip_weapon does remove all weapons but as your code implies that it will give them a new set of guns at the beginning of every round so i see no problem, Thats why fm_strip_weapon is before the guns are distributed

DarkGod 05-28-2009 08:55

Re: strip weapons
 
If you don't want to use FakeMeta just for that then use strip_user_weapons. And also, his code would give all the Terrorists a c4. Is that what you want?

hleV 05-28-2009 08:56

Re: strip weapons
 
Code:
new CurrentlyHoldedWeaponID; // new CurrentlyHoldedWeaponName[32];   engclient_cmd(id, "slot1");   CurrentlyHoldedWeaponID = get_user_weapon(id); // get_weaponname(CurrentlyHoldedWeaponID, CurrentlyHoldedWeaponName, 31);   if (CurrentlyHoldedWeaponID != CSW_KNIFE) {         fm_strip_user_gun(id, CurrentlyHoldedWeaponID);         // ham_strip_user_weapon(id, CurrentlyHoldedWeaponName);         // engclient_cmd(id, "drop"); }   engclient_cmd(id, "slot2");   if (CurrentlyHoldedWeaponID != CSW_KNIFE) {         fm_strip_user_gun(id, CurrentlyHoldedWeaponID);         // ham_strip_user_weapon(id, CurrentlyHoldedWeaponName);         // engclient_cmd(id, "drop"); }
You could also use pdata with currently active item's offset.

Debesėlis 05-28-2009 09:07

Re: strip weapons
 
Quote:

Originally Posted by DarkGod (Post 836481)
If you don't want to use FakeMeta just for that then use strip_user_weapons. And also, his code would give all the Terrorists a c4. Is that what you want?

strip_user_weapons if use this on every round need buy for all weapons AMMO.

DarkGod 05-28-2009 09:12

Re: strip weapons
 
cs_set_user_bpammo(id, CSW_* #)


All times are GMT -4. The time now is 01:29.

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