Raised This Month: $ Target: $400
 0% 

array GetConVarInt()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 08-28-2012 , 11:56   array GetConVarInt()
Reply With Quote #1

A stupid question again if this array is accepted or not:

PHP Code:
new const Float:weaponClipSize[][] = {
    {
GetConVarInt(smgClip)}, {GetConVarInt(smgSilencedClip)}, {GetConVarInt(smgMp5Clip)}, {GetConVarInt(pumpClip)}, {GetConVarInt(chromeClip)}, {GetConVarInt(huntClip)},
    {
GetConVarInt(rifleClip)}, {GetConVarInt(rifleAk47Clip)}, {GetConVarInt(rifleDesertClip)}, {GetConVarInt(rifleSg552Clip)}, {GetConVarInt(militaryClip)},
    {
GetConVarInt(scoutClip)}, {GetConVarInt(awpClip)}, {GetConVarInt(granedeClip)}, {GetConVarInt(m60Clip)}
}; 
when i compile it, it giving me warning Invalid function declaration?
any tought?
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 08-28-2012 , 13:06   Re: array GetConVarInt()
Reply With Quote #2

i change to

PHP Code:
new weaponClipSize[15] = {};
weaponClipSize[0] = GetConVarInt(smgClip);
weaponClipSize[1] = GetConVarInt(smgSilencedClip);
weaponClipSize[2] = GetConVarInt(smgMp5Clip);
weaponClipSize[3] = GetConVarInt(pumpClip);
weaponClipSize[4] = GetConVarInt(chromeClip);
weaponClipSize[5] = GetConVarInt(huntClip);
weaponClipSize[6] = GetConVarInt(rifleClip);
weaponClipSize[7] = GetConVarInt(rifleAk47Clip);
weaponClipSize[8] = GetConVarInt(rifleDesertClip);
weaponClipSize[9] = GetConVarInt(rifleSg552Clip);
weaponClipSize[10] = GetConVarInt(militaryClip);
weaponClipSize[11] = GetConVarInt(scoutClip);
weaponClipSize[12] = GetConVarInt(awpClip);
weaponClipSize[13] = GetConVarInt(granedeClip);
weaponClipSize[14] = GetConVarInt(m60Clip); 
i can compile this but seem the array have a problem. Is anyone can point out someting?
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
miniman
Senior Member
Join Date: Aug 2009
Location: Israel
Old 08-28-2012 , 13:32   Re: array GetConVarInt()
Reply With Quote #3

Quote:
Originally Posted by GsiX View Post
i change to

PHP Code:
new weaponClipSize[15] = {};
weaponClipSize[0] = GetConVarInt(smgClip);
weaponClipSize[1] = GetConVarInt(smgSilencedClip);
weaponClipSize[2] = GetConVarInt(smgMp5Clip);
weaponClipSize[3] = GetConVarInt(pumpClip);
weaponClipSize[4] = GetConVarInt(chromeClip);
weaponClipSize[5] = GetConVarInt(huntClip);
weaponClipSize[6] = GetConVarInt(rifleClip);
weaponClipSize[7] = GetConVarInt(rifleAk47Clip);
weaponClipSize[8] = GetConVarInt(rifleDesertClip);
weaponClipSize[9] = GetConVarInt(rifleSg552Clip);
weaponClipSize[10] = GetConVarInt(militaryClip);
weaponClipSize[11] = GetConVarInt(scoutClip);
weaponClipSize[12] = GetConVarInt(awpClip);
weaponClipSize[13] = GetConVarInt(granedeClip);
weaponClipSize[14] = GetConVarInt(m60Clip); 
i can compile this but seem the array have a problem. Is anyone can point out someting?
where do you set the array? because you can't set it outside of a function
miniman is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 08-28-2012 , 13:48   Re: array GetConVarInt()
Reply With Quote #4

sorry for late replay since i keep trying here, well i put that inside function. The first post used to be outside but i cant work it out so i move it inside and change the array structure.
Is the okay?

EDIT:
To avoid confusion so i post the whole idea of what i try to do

PHP Code:
new ValueNewClip[MAXPLAYERS+1];
new const 
String:weaponsClass[][] = {
    {
"weapon_smg"}, {"weapon_smg_silenced"}, {"weapon_smg_mp5"}, {"weapon_pumpshotgun"}, {"weapon_shotgun_chrome"}, {"weapon_hunting_rifle"},
    {
"weapon_rifle"}, {"weapon_rifle_ak47"}, {"weapon_rifle_desert"}, {"weapon_rifle_sg552"}, {"weapon_sniper_military"},
    {
"weapon_sniper_scout"}, {"weapon_sniper_awp"}, {"weapon_granede_launcher"}, {"weapon_rifle_m60"}
    {
"weapon_autoshotgun"}, {"weapon_shotgun_spas"}
};

public 
Event_Weapon_Reload(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
weaponClipSize[17] = {};
    
weaponClipSize[0] = GetConVarInt(smgClip);
    
weaponClipSize[1] = GetConVarInt(smgSilencedClip);
    
weaponClipSize[2] = GetConVarInt(smgMp5Clip);
    
weaponClipSize[3] = GetConVarInt(pumpClip);
    
weaponClipSize[4] = GetConVarInt(chromeClip);
    
weaponClipSize[5] = GetConVarInt(huntClip);
    
weaponClipSize[6] = GetConVarInt(rifleClip);
    
weaponClipSize[7] = GetConVarInt(rifleAk47Clip);
    
weaponClipSize[8] = GetConVarInt(rifleDesertClip);
    
weaponClipSize[9] = GetConVarInt(rifleSg552Clip);
    
weaponClipSize[10] = GetConVarInt(militaryClip);
    
weaponClipSize[11] = GetConVarInt(scoutClip);
    
weaponClipSize[12] = GetConVarInt(awpClip);
    
weaponClipSize[13] = GetConVarInt(granedeClip);
    
weaponClipSize[14] = GetConVarInt(m60Clip);
    
weaponClipSize[15] = GetConVarInt(autoClip);
    
weaponClipSize[16] = GetConVarInt(spasClip);

    new 
String:classname[256];
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    new 
ActiveWeapon GetPlayerWeaponSlot(client0);
    
GetEntityClassname(ActiveWeaponclassnamesizeof(classname));

    for(new 
i=0sizeof(weaponsClass); i++)
    {
        if((
StrContains(classnameweaponsClass[i], false) != -1))
        {
            
ValueNewClip[client] = weaponClipSize[i];
        }
    }

__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 08-28-2012 at 13:56.
GsiX is offline
miniman
Senior Member
Join Date: Aug 2009
Location: Israel
Old 08-28-2012 , 13:53   Re: array GetConVarInt()
Reply With Quote #5

Quote:
Originally Posted by GsiX View Post
sorry for late replay since i keep trying here, well i put that inside function. The first post used to be outside but i cant work it out so i move it inside and change the array structure.
Is the okay?
not sure what do you mean but if you want this array global you declare it outside and if you want to change it you just set it inside of a function
miniman is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 08-28-2012 , 13:58   Re: array GetConVarInt()
Reply With Quote #6

Quote:
Originally Posted by miniman View Post
not sure what do you mean but if you want this array global you declare it outside and if you want to change it you just set it inside of a function
well as u posting i just edit the last post.
As u can see at the first post, what i rely wan is global array but seem no luck
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
miniman
Senior Member
Join Date: Aug 2009
Location: Israel
Old 08-28-2012 , 14:10   Re: array GetConVarInt()
Reply With Quote #7

seems fine to me ,try adding some logs.
miniman is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 08-28-2012 , 14:20   Re: array GetConVarInt()
Reply With Quote #8

Well, thanks for the comment.. since u are Senior Member and u said "seem fine to me", i consider that there is no way to make the array look better, shorter or something? assume that what i did was all right.

i try it out and there is no log error on compiler and in game.

Thanks
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
miniman
Senior Member
Join Date: Aug 2009
Location: Israel
Old 08-28-2012 , 15:45   Re: array GetConVarInt()
Reply With Quote #9

Quote:
Originally Posted by GsiX View Post
Well, thanks for the comment.. since u are Senior Member and u said "seem fine to me", i consider that there is no way to make the array look better, shorter or something? assume that what i did was all right.

i try it out and there is no log error on compiler and in game.

Thanks
The code that you gave me looks fine but there's probably something else that is wrong here, since you don't add debugging information alot of stuff could go wrong .Try to log actions like "Reload event triggered" ,"found a String match with values x y z ..." to actually verify that this part is wrong ...
miniman is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 08-28-2012 , 16:17   Re: array GetConVarInt()
Reply With Quote #10

Actual i m absolute beginner. When u say value x y z, are u refer to the global array?
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 08-28-2012 at 16:17.
GsiX 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 19:58.


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