AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   removing gun on ground (https://forums.alliedmods.net/showthread.php?t=25853)

Locks 03-21-2006 20:48

removing gun on ground
 
What's the code for removing a weapon on the ground like after a person drops it?

v3x 03-21-2006 21:08

Code:
new g_Ents; public plugin_init() {     g_Ents = get_global_int(GL_maxEntities); } public pfn_touch(ptr, ptd) {     if(is_valid_ent(ptr) && is_valid_ent(ptd)) {         new classname[32]         if(is_valid_ent(ptr))             entity_get_string(ptr,EV_SZ_classname,classname,31)         if(equali(classname,"weaponbox")) {                 for(new inum=0;inum<=g_Ents;inum++) {                 if(!is_valid_ent(inum)) continue                 new class[51]                 entity_get_string(inum,EV_SZ_classname,class,50)                 if(containi(class,"weapon_") == -1) continue                 new owner = entity_get_edict(inum,EV_ENT_owner)                 if(ptr == owner)                     remove_entity(inum)             }             remove_entity(ptr)         }         else if(containi(classname,"weapon_") != -1)             remove_entity(ptr)     }     return PLUGIN_CONTINUE }
Edited from twisty's TDM plugin, I believe.

Locks 03-21-2006 21:21

Oh, forgot to mention, how do I make it so that it will only remove a certain weapon ONLY for a certain player

v3x 03-21-2006 21:27

Use global variables and check the models.

Locks 03-21-2006 21:31

Examples??..

Like after a player being hit

v3x 03-21-2006 22:40

Not sure what you mean.

You can check the model like so:

Code:
new model[64]; entity_get_string(ptr , EV_SZ_model , model , 63); if(equal(model , "models/w_m4a1.mdl")) {   // dropped/touched m4a1 }

Locks 03-21-2006 22:58

i meant, how do you make it so then it will only remove a dropped gun on that one person

Like how do you make it only work for that one person except for everyone else

VEN 03-22-2006 08:28

On which action you want to remove weapon?
Drop, touch, event, console command, time delay or what?

Locks 03-22-2006 18:13

drop

VEN 03-23-2006 10:39

So you want to remove weapon right after manual drop?
Or any drop: manual and automatic (on death)?
Or on auto drop only?


All times are GMT -4. The time now is 16:39.

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