Raised This Month: $305 Target: $400
 76%   Almost there!

throw/remove weapons [help]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eim64
New Member
Join Date: Feb 2016
Old 02-14-2016 , 10:25   throw/remove weapons [help]
Reply With Quote #1

im currently making a gun plugin that gives the player some weapons on start, it gives the weapons but spawns new weapons next round. in round_end i have made for lopps that cycles thru all the players inventories, but i dont know how to make the player throw or just delete the weapons.
this is my code:
PHP Code:
for(new 050a++){
                new 
weapon GetPlayerWeaponSlot(ia);
                if (
IsValidEntity(weapon))
                {
                    
decl String:weapon_name[32];
                    
GetEntityClassname(weaponweapon_name32);
                    new 
String:stri[32];
                    
IntToString(a,stri,32);
                    
PrintToServer(stri);
                    
PrintToServer(weapon_name);
                }
        
                
            } 
eim64 is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 02-14-2016 , 10:51   Re: throw/remove weapons [help]
Reply With Quote #2

i believe that's source, wrong section.
EpicMonkey is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 02-20-2016 , 19:21   Re: throw/remove weapons [help]
Reply With Quote #3

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) == wId) ExecuteHamB(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;
}

ham_strip_weapon(id,"weapon_glock18")
EFFx is offline
Send a message via Skype™ to EFFx
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:19.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode