AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   A Few Questions (https://forums.alliedmods.net/showthread.php?t=6626)

twistedeuphoria 10-09-2004 01:38

A Few Questions
 
1) Is this correct to get a players weapons and check if they are all correct? (wep_ok does the checking)
Code:
public check_wep(id) {     new weapons[32]     new numWeapons,i,weapon,j     get_user_weapons(id,weapons,numWeapons)     for(i=0;i<numWeapons;i++)     {         new alright         alright = wep_ok(id,weapons[i],i)         if(alright != -1)         {             strip_user_weapons(id)             for(j=0;j<numWeapons;j++)             {                 if(alright != j)                     give_coitem(id,weapon[j])             }             check_wep(id)         }                         } }

2) Is there an event I can register which happens when a player picks up a defuse kit or nightvision?

3) How do I give a C4?

Thanks in advance.

karlos 10-09-2004 06:14

1) it looks right but i would rather suggest this:
Code:
public check_wep(id){     new weapons[32], alright[32]     new numWeapons,i     get_user_weapons(id,weapons,numWeapons)     for( i = 0; i < numWeapons; i++ ){         alright[i] = wep_ok(id,weapons[i],i)     }     strip_user_weapons(id)     for( i = 0; i < numWeapons; i++ ){         if(alright[i] != -1){             give_coitem(id,weapons[i])  // should not this be weapons[i] ?         }     } }
eg: if u have 15 weaps and 5 are not allowed
yours does
- gets weaps, first not allowed, stripp all weaps, give 14 weaps, call func again
- gets weaps, next is allowed
- next not allowed, stripp all weaps, give 13 weaps, call func again ...

the above does:
- gets weaps, check which are allowed, stripp all weaps, give only allowed weaps

with give_coitem(id,weapid) i think u pass the id of the weapon to this function check which weap it is and then use give_item(id,<weap name>) , right?

twistedeuphoria 10-09-2004 10:04

Oh yeah that's great, thanks. Yeah, give_coitem is just give_item with a few other little things.

Well #1 & #2 are taken care of but anyone know how to give the C4 with give_item? Also how do you give a knife?

One more, if I were to register Death event could I strip_user_weapons the dead one to prevent them from dropping weapons?

Da Bishop 10-09-2004 11:52

well, not to sure about the strip weapons of a dead guy.... testing would be a good option... anyways isn't C4 considered a weapon?

XxAvalanchexX 10-09-2004 12:43

weapon_knife is a knife
weapon_c4 is the C4
item_thighpack is a defusal kit

twistedeuphoria 10-09-2004 13:28

Thanks avalanche. Registering strip_user_weapons to Deathmsg doesn't seem to work.


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

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