View Single Post
shady101
Member
Join Date: Nov 2014
Location: USA
Old 08-23-2017 , 13:27   Re: Global Offensive Mod 2.15 Beta [LAST UPDATE: 08. 13] *BUG FIXED
Reply With Quote #217

Quote:
Originally Posted by RaZ_HU View Post
I would recommend to use defines or const instead of cvars for SQL information, since it is sensitive data and I doubt that someone would like to switch to another SQL server/login during uptime.

You can separate M4A4 and M4A1S type M4 weapons by forcing the silencer on or off.
For example:
PHP Code:
// To plugin_init()
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_m4a1" "CM4_SecondaryAttack_Pre" ,  0);


// To WeaponSkin(f) - aka weapon switching
    
if(wid == 22 && silencer[id] == false)
    {
        
cs_set_weapon_silen(iEnt0); // Removes silencer when switching to weapon
        
set_pdata_float(iEnt 47 9999.04); // Blocks attaching when switching to weapon
    
}
    else if(
wid == 22 && silencer[id] == true)
    {
        
cs_set_weapon_silen(iEnt10); // Attaches silencer when switching to weapon
        
return HAM_SUPERCEDE;
    }


// Code that keeps M4s act as they should (silenced or not)
public CM4_SecondaryAttack_PreiM4 )
{
    new 
id get_pdata_cbase(iM4414);
    if(
silencer[id] == false// For M4A4
    
{
        
cs_set_weapon_silen(iM400); // Keeps silencer off
        
set_pdata_float(iM4 47 9999.04); // Prevents attaching the silencer
        
return HAM_SUPERCEDE;
    }
    else if(
silencer[id] == true// For M4A1S
    
{
        
cs_set_weapon_silen(iM410); // Keeps silencer on
        
return HAM_SUPERCEDE;
    }

    return 
HAM_IGNORED;

Futhermore it would be clearer to store rank data like this than separated:
PHP Code:
new const Ranks[][] =
{
    { 
"Silver I"},
    { 
"Silver II"25 },
    { 
"Silver III"100 },
    { 
"Silver IV"250 },
    { 
"Silver Elite"750 },
    { 
"Silver Elite Master"1000 },
    { 
"Gold Nova I"1500 },
    { 
"Gold Nova II"2250 },
    { 
"Gold Nova III"3000 },
    { 
"Gold Nova Master"3900 },
    { 
"Master Guardian I"4900 },
    { 
"Master Guardian II"5900 },
    { 
"Master Guardian Elite"7000 },
    { 
"Distinguished Master Guardian"8500 },
    { 
"Legendary Eagle"10000 },
    { 
"Legendary Eagle Master"15000 },
    { 
"Supreme Master First Class"22000 },
    { 
"The Global Elite"30000 },
    { 
""40000 }
}; 
BTW, you can remove the empty rank with 0 kills since it is pointless if the Silver1 has the same value.


If I am wrong in something just tell me, since I am not an AMXX expert
would you happen to know anyway to fix the market? Whenever i try putting a key up, it just exits out of the menu and doesn't let me put anything on the market and/or when i cancel one of my items i think.
And possibly make chosen skins stay, no matter how many different types of weapons they are? I believe they don't save.
Is anyone able and willing to do this?

Last edited by shady101; 08-23-2017 at 13:29.
shady101 is offline