Raised This Month: $ Target: $400
 0% 

converting CSW_ to weapon_


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 05-09-2012 , 11:47   converting CSW_ to weapon_
Reply With Quote #1

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.
striker07 is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-09-2012 , 12:06   Re: converting CSW_ to weapon_
Reply With Quote #2

PHP Code:
/* Returns weapon name. */
native get_weaponname(id,weapon[],len); 
__________________
<VeCo> is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-09-2012 , 12:12   Re: converting CSW_ to weapon_
Reply With Quote #3

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)
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 05-09-2012 at 13:11.
ConnorMcLeod is offline
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 05-09-2012 , 12:39   Re: converting CSW_ to weapon_
Reply With Quote #4

@ConnorMcLeod

PHP Code:
set_pdata_int(entWeaponm_iClipiAmmoXO_CBDELAY
XO_CBDELAY should be XO_WEAPON ?
dFF is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 05-09-2012 , 12:18   Re: converting CSW_ to weapon_
Reply With Quote #5

something like this then?
PHP Code:
weapon_csw get_user_weapon(id)
weapon get_weaponnameweapon_csw )
cs_set_weapon_ammoweapon999 
striker07 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-09-2012 , 12:23   Re: converting CSW_ to weapon_
Reply With Quote #6

SetUserActiveWeaponAmmo(id, 999)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 05-09-2012 , 12:26   Re: converting CSW_ to weapon_
Reply With Quote #7

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, _) ?

Last edited by striker07; 05-09-2012 at 13:47.
striker07 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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