AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Delete a weapon (https://forums.alliedmods.net/showthread.php?t=29970)

wonsae 06-19-2006 16:44

Delete a weapon
 
How would I delete a weapon while it's in someone's hands or when it's dropped?

Hawk552 06-19-2006 16:49

remove_ent if it's on the ground

Or client_cmd(id,"drop",weapon) then do a set task to remove the gun.

wonsae 06-19-2006 17:07

This seems to give me an error :X
Code:
remove_entity("ts_groundweapon")

Code:

Error: Number of arguments does not match definition on line 160

Hawk552 06-19-2006 17:19

It should give you an argument type mismatch.

First, scan for the weapon using find_ent_by_class, or find_sphere_class. Use the return from that and then do remove_entity(iEnt)

wonsae 06-19-2006 17:30

Code:
public remove(id){     new ent = find_ent_by_class(id,"ts_groundweapon")     if(ent == 1){         remove_entity(ent)     }     return PLUGIN_HANDLED }

woudl that work?

Hawk552 06-19-2006 17:35

Quote:

Originally Posted by wonsae
Code:
public remove(id){     new ent = find_ent_by_class(id,"ts_groundweapon")     if(ent == 1){         remove_entity(ent)     }     return PLUGIN_HANDLED }

woudl that work?

No.

Code:
public fnRemove(id) {     static iEnt[1]     find_sphere_class(id,"ts_groundweapon",20.0,iEnt,1)     if(iEnt[0])         remove_entity(iEnt[0]) }

wonsae 06-19-2006 17:40

Thanks, but what is a static?

Hawk552 06-19-2006 17:41

Quote:

Originally Posted by wonsae
Thanks, but what is a static?

YOU'LL NEVER KNOW

wonsae 06-19-2006 17:51

:(


All times are GMT -4. The time now is 07:56.

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