Raised This Month: $32 Target: $400
 8% 

Solved How to use multi variables with one enum !!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 10-30-2021 , 15:20   How to use multi variables with one enum !!
Reply With Quote #1

Is it possible to use multi variables with one enum ? Like this :

PHP Code:
enum pData
{
    
Health,
    
Armor,
    
Speed,
    
Gravity,
    
Knockback,
    
MultiJump
}

new 
g_iUser33 ][ pData ]
new 
g_iCvarpData ]

public 
plugin_init() 
{
    
g_iCvarKnockback ] = register_cvar("amx_knockback""300.0")
}

public 
OnTakeDamage(iVictimiInflictoriAttackerFloat:flDamagebitsDamageType)
{
    if (!
is_user_connectediVictim ) || !is_user_connectediAttacker ) )
        return 
HAM_IGNORED
    

    
new Float:fOrigin[3]
    
pev iAttackerpev_originfOrigin )
    
Set_KnockbackiVictimfOriging_iUser][ Knockback ] ? ( Float:g_iUseriVictim ][ Knockback ] ) : get_pcvar_numg_iCvarKnockback ] ), 2)
    return 
HAM_IGNORED

__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 10-31-2021 at 17:42.
Supremache is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-30-2021 , 16:23   Re: How to use multi variables with one enum !!
Reply With Quote #2

Yeah its possible.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-30-2021 , 16:26   Re: How to use multi variables with one enum !!
Reply With Quote #3

No problem with that
__________________
Bugsy is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 10-31-2021 , 17:29   Re: How to use multi variables with one enum !!
Reply With Quote #4

Well, thanks

I get warning message after change this code from:
PHP Code:
Set_KnockbackiVictimfOriginFloat:g_iUseriVictim ][ Knockback ] , 2
To:

PHP Code:
Set_KnockbackiVictimfOriging_iUsediVictim ][ Knockback ] ? ( Float:g_iUseriVictim ][ Knockback ] ) : get_pcvar_numg_iCvarKnockback ] ), 2
The warning message:

Quote:
Warning: Tag mismatch on line 196
The variables:
PHP Code:
new g_iUser33 ][ pData // get the data
new bool:g_iUsed33 ][ pData // check the data
new g_iCvarpData // cvars 
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 10-31-2021 at 17:33.
Supremache is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 10-31-2021 , 17:40   Re: How to use multi variables with one enum !!
Reply With Quote #5

Ops the wrong was in calling cvar by using get_pcvar_num :

Fixed:
PHP Code:
Set_KnockbackiVictimfOriging_iUsediVictim ][ Knockback ] ? ( Float:g_iUseriVictim ][ Knockback ] ) : get_pcvar_floatg_iCvarKnockback ] ), 2
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 10-31-2021 at 17:42.
Supremache is offline
Reply


Thread Tools
Display Modes

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 16:08.


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