AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   converting CSW_ to weapon_ (https://forums.alliedmods.net/showthread.php?t=184848)

striker07 05-09-2012 11:47

converting CSW_ to weapon_
 
hey how can i convert a CSW_ weapon name into a weapon_ weapon name?

i'd like to set unlimited ammo for a weapon but then I first need to find what weapon the player is carrying,
so id have to use the native get_user_weapon first and then cs_set_weapon_ammo.
but the result of get_user_weapon is in CSW_ format and the set_user_ammo is in weapon_ format.

<VeCo> 05-09-2012 12:06

Re: converting CSW_ to weapon_
 
PHP Code:

/* Returns weapon name. */
native get_weaponname(id,weapon[],len); 


ConnorMcLeod 05-09-2012 12:12

Re: converting CSW_ to weapon_
 
PHP Code:

/*
 #include <fakemeta>
#include <hamsandwich>
*/

#define XO_PLAYER 5
#define m_pActiveItem 373

#define XO_WEAPON 4
#define m_iPrimaryAmmoType 49
#define m_iClip 51

SetUserActiveWeaponAmmo(idiAmmo)
{
    if( 
iAmmo )
    {
        
iAmmo 0
    
}
    new 
entWeapon get_pdata_cbase(idm_pActiveItemXO_PLAYER)
    if( 
entWeapon && get_pdata_int(entWeaponm_iPrimaryAmmoTypeXO_WEAPON) != -)
    {
        
set_pdata_int(entWeaponm_iClipiAmmoXO_WEAPON)
    }



striker07 05-09-2012 12:18

Re: converting CSW_ to weapon_
 
something like this then?
PHP Code:

weapon_csw get_user_weapon(id)
weapon get_weaponnameweapon_csw )
cs_set_weapon_ammoweapon999 


ConnorMcLeod 05-09-2012 12:23

Re: converting CSW_ to weapon_
 
SetUserActiveWeaponAmmo(id, 999)

striker07 05-09-2012 12:26

Re: converting CSW_ to weapon_
 
lol connor :p,
I'm afraid your way is a bit to complicated/hard for me to understand.
the way I wanna use it is just for an amount of time so after the time is up im gonna set the clip ammo back to the standard clip ammo depending on the weapon he has, but thats probably not gonna be so efficient i guess

edit: from what i know that is a stock so how can i set the ammo on an efficient way (without checking what weapon he is holding) back to the standart clip depending on what weapon the player is currently holding? SetUserActiveWeaponAmmo(id, _) ?

dFF 05-09-2012 12:39

Re: converting CSW_ to weapon_
 
@ConnorMcLeod

PHP Code:

set_pdata_int(entWeaponm_iClipiAmmoXO_CBDELAY

XO_CBDELAY should be XO_WEAPON ?


All times are GMT -4. The time now is 00:27.

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