AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Weapon Time (https://forums.alliedmods.net/showthread.php?t=75994)

AntiBots 08-16-2008 12:20

Weapon Time
 
Hi friends, How I can know the most time that a player have a Usp, or a Knife?

Example: Is player have 5 minutes a Usp, But 7 minutes a Knife == a Knife?

It is posible a code :D

EDIT: In a period of time, check_weapon_start, check_weapon_end.

anakin_cstrike 08-18-2008 19:45

Re: Weapon Time
 
PHP Code:

new g_UspCount[33];
public 
plugin_init() register_event("CurWeapon","event","be","1=1");
public 
event(id)
{
      
// Then, get the weapon id and check
     
new clipammo
     
new iwpn get_user_weapon(id,clip,ammo)
     
// If weapon is usp:
     
if(iwpn == CSW_USP)
     {
           
g_UspCount[id]++;
           if(
g_UspCount[id] >= 300)
           {
                    
// something
           
}
     }


PHP Code:

new Weapons[32];
new 
numWeaponsiweapon;
get_user_weapons(idWeaponsnumWeapons);
for (
i=0i<numWeaponsi++) 

   
weapon Weapons[i];
   if(
weapon == CSW_USP) { /*smth */ }




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

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