Senior Member
|
03-17-2024
, 10:50
Re: Dollar Weapon menu
|
#25
|
Quote:
Originally Posted by Yanez98
I also tried this solution that you just described, but it wasn't perfect!
I think that you deleted all the weapons in this case, + I could also list the things you have, grenade, defuseki, c4 and more, so I want to find another solution, the drop solution that is currently included in the sma is also not good, it can be bugged , right, you open the menu, your weapon is thrown, after that, if you pick it up and buy, you already have two!
And at the strip, he removed everything.
So I only need something for shopping that erases the gun and the pistol as well!
|
Code:
// gives a player a weapon efficiently
stock ham_give_weapon(id,weapon[])
{
if(!equal(weapon,"weapon_",7)) return 0;
new wEnt = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,weapon));
if(!pev_valid(wEnt)) return 0;
set_pev(wEnt,pev_spawnflags,SF_NORESPAWN);
dllfunc(DLLFunc_Spawn,wEnt);
if(!ExecuteHamB(Ham_AddPlayerItem,id,wEnt))
{
if(pev_valid(wEnt)) set_pev(wEnt,pev_flags,pev(wEnt,pev_flags) | FL_KILLME);
return 0;
}
ExecuteHamB(Ham_Item_AttachToPlayer,wEnt,id)
return 1;
}
// takes a weapon from a player efficiently
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));
// this block should be used for Counter-Strike:
/*if(wId == CSW_C4)
{
cs_set_user_plant(id,0,0);
cs_set_user_bpammo(id,CSW_C4,0);
}
else if(wId == CSW_SMOKEGRENADE || wId == CSW_FLASHBANG || wId == CSW_HEGRENADE)
cs_set_user_bpammo(id,wId,0);*/
return 1;
}
u can use this
|
|