PHP- Kodu:
  /* 
/////////////////////////////////////////////////////////////////////// 
//-------------------- CUSTOM SPRAY MANAGEMENT ----------------------// 
/////////////////////////////////////////////////////////////////////// 
//------------------------- BY -=_|R0CK|_=- -------------------------// 
/////////////////////////////////////////////////////////////////////// 
cspray_customtype <0, 1 ,2, 3, 4> 
0 = Block All Sprays for Everyone 
1 = Custom Sprays Enabled For Everyone 
2 = Custom Sprays Enabled For Admins Disabled for others 
3 = Custom Sprays Enabled For Chosen Ones Disabled for others(amx_allowspray <name>) 
4 = Custom Sprays Disabled For Everyone (Same Logo) 
cspray_distannouce <0, 1> 
0 = Distance Checker + AnnounceType Disabled 
1 = Distance Checker + AnnounceType Enabled 
cspray_distannoucetype <0, 1> 
0 = All Will able to see distance between spray and ground if any one sprays 
1 = Only sprayer will be able to see distance of its own spray 
cspray_timeinterval <time> 
time = Will set time interval between two sprays by a user 
cspray_disallowtype <1, 0> (when amx_disallowspray has been used on a user) 
0 = the users custom spray is blocked only 
1 = the users spray is fully blocked 
Admin Commands :-  
amx_allowspray <name> <time> (will allow the person to use his own spray When Spray_CustomType = 2, 3, 4) 
amx_disallowspray <name> (will block the person's spray When Spray_CustomType = 1, 3) 
*/ 
//////////////////////////////////////////////////////// 
//-------------------- INCLUDES ----------------------// 
//////////////////////////////////////////////////////// 
#include <amxmodx> 
#include <amxmisc> 
#include <engine> 
#include <fakemeta> 
#include <hamsandwich> 
#include <xs> 
/////////////////////////////////////////////////////// 
//-------------------- DEFINES ----------------------// 
/////////////////////////////////////////////////////// 
#define PLUGIN             "Custom Spray Management" 
#define VERSION         "1.7" 
#define AUTHOR             "-=_|R0CK|_=-" 
#define PREFIX             "^x03[CS Management]^x04" 
#define FLAGS_SPRAY         ADMIN_RCON 
#define SetCustomSpray(%1)    (set_pdata_int(%1, 485, 1)) //m_nCustomFrames = 485 
#define ClearCustomSpray(%1)    (set_pdata_int(%1, 485, -1)) //m_nCustomFrames = 485 
#define CustomSprayTime(%1,%2)    (set_pdata_int(%1, 486, %2)) // m_flNextDecalTime (time interval for a single user) = 486 
/////////////////////////////////////////////////////// 
//--------------------CONSTANTS----------------------// 
/////////////////////////////////////////////////////// 
new bool: gp_IsSprayAllowed[33] 
new bool: gp_IsSprayBlocked[33] 
new gp_LastSpray[33] 
new gp_SprayTime[33] 
new gp_ConfigFile[128] 
new gp_CustomSpray 
new gp_SprayDistType 
new gp_SprayDist 
new gp_SprayInterval 
new gp_BlockType 
new Trie:gp_SprayBanned 
/////////////////////////////////////////////////////// 
//--------------------- BRAIN -----------------------// 
/////////////////////////////////////////////////////// 
public plugin_init()  
{ 
    register_plugin(PLUGIN, VERSION, AUTHOR) 
    
    gp_CustomSpray = register_cvar("cspray_customtype","1") 
    gp_SprayDist = register_cvar("cspray_distannouce","0") 
    gp_SprayDistType = register_cvar("cspray_distannouceType","0") 
    gp_SprayInterval = register_cvar("cspray_timeinterval", "30") 
    gp_BlockType = register_cvar("cspray_disallowtype", "0") 
    
    register_clcmd("amx_allowspray", "Admin_AllowSpray", FLAGS_SPRAY) 
    register_clcmd("amx_disallowspray", "Admin_DisallowSpray", FLAGS_SPRAY) 
    
    register_logevent("FirstRound", 2, "0=World triggered", "1&Restart_Round_") 
    register_logevent("FirstRound", 2, "0=World triggered", "1=Game_Commencing") 
    register_logevent("RoundStart", 2, "0=World triggered", "1=Round_Start") 
    
    RegisterHam(Ham_Spawn, "player", "Ham_Playerspawn", 1) 
    RegisterHam(Ham_Killed, "player", "Ham_PlayerKilled", 1) 
    register_event("23", "Event_Spray", "a", "1=112" ) 
    register_impulse(201, "impulse_201") 
} 
public FirstRound() 
{ 
    server_cmd("sv_allowupload 1") 
    server_cmd("sv_allowdownload 1") 
} 
public RoundStart() {
    new players[32],inum;
    get_players(players,inum)
    for(new i = 0;i < inum; i++) {
        gp_LastSpray[i] = get_systime() - get_pcvar_num(gp_SprayInterval);
        CustomSprayTime(i, gp_SprayTime[i])
    }
}
public client_authorized(id) 
{ 
    new gp_AuthId[35] 
    get_user_authid(id, gp_AuthId, charsmax(gp_AuthId)) 
    
    
    if(TrieKeyExists(gp_SprayBanned, gp_AuthId)) 
        gp_IsSprayBlocked[id] = true 
} 
public Ham_Playerspawn(id) 
{ 
    if(!is_user_connected(id)) 
        return HAM_IGNORED 
    
    gp_SprayTime[id] = get_pcvar_num(gp_SprayInterval) ;
    
    if(gp_IsSprayBlocked[id]) 
    { 
        ClearCustomSpray(id) 
        
    }     
    else 
    { 
        switch(get_pcvar_num(gp_CustomSpray)) 
        { 
            case 0: 
            { 
                SetCustomSpray(id) 
                
            }             
            case 2:  
            { 
                if(access(id, FLAGS_SPRAY)) 
                { 
                    SetCustomSpray(id) 
                    
                }     
                else 
                { 
                    ClearCustomSpray(id) 
                    
                } 
            } 
            
            case 3:  
            { 
                if(gp_IsSprayAllowed[id]) 
                { 
                    SetCustomSpray(id) 
                    
                }     
                else 
                { 
                    ClearCustomSpray(id) 
                    
                } 
            } 
            
            case 4:  
            { 
                ClearCustomSpray(id) 
                
            } 
            
            default: 
            {     
                SetCustomSpray(id) 
            
            } 
        } 
    } 
    if(!gp_IsSprayAllowed[id]) {
        gp_LastSpray[id] = get_systime() - get_pcvar_num(gp_SprayInterval);
        CustomSprayTime(id, gp_SprayTime[id])
    }
        
        
    return HAM_IGNORED 
} 
public Ham_PlayerKilled(victim, attacker, shouldgib) {
    if(is_user_connected(attacker)) {
        gp_LastSpray[attacker] = get_systime() - get_pcvar_num(gp_SprayInterval);
        CustomSprayTime(attacker, gp_SprayTime[attacker])
    }
}
public Admin_AllowSpray(id) 
{ 
    static player, user[32], Utime[21], TotalTime 
    
    if(!access(id, FLAGS_SPRAY)) 
        return PLUGIN_HANDLED 
    
    read_argv(1, user, charsmax(user)) 
    read_argv(2, Utime, charsmax(Utime)) 
    
    player = cmd_target(id, user, 2) 
    TotalTime = str_to_num(Utime) 
    
    if(!is_user_connected(player)) 
        return PLUGIN_HANDLED 
    
    if(!access(player, FLAGS_SPRAY) || id == player) 
    { 
        SetCustomSpray(player) 
        gp_IsSprayAllowed[player] = true 
        gp_IsSprayBlocked[player] = false 
        Remove_SprayBan(player) 
        
        if(TotalTime > 0) 
            gp_SprayTime[player] = TotalTime 
    } 
    return PLUGIN_HANDLED 
} 
public Admin_DisallowSpray(id) 
{ 
    static player, user[32] 
    
    if(!access(id, FLAGS_SPRAY)) 
        return PLUGIN_HANDLED 
    
    read_argv(1, user, charsmax(user)) 
    
    player = cmd_target(id, user, 2) 
    
    if(!is_user_connected(player)) 
        return PLUGIN_HANDLED 
    
    if(!access(player, FLAGS_SPRAY) || id == player) 
    { 
        ClearCustomSpray(player) 
        gp_IsSprayAllowed[player] = false 
        gp_IsSprayBlocked[player] = true 
        Save_SprayBan(player) 
        gp_SprayTime[player] = get_pcvar_num(gp_SprayInterval) 
        
    } 
    return PLUGIN_HANDLED 
} 
public impulse_201(id)  
{  
    if(!get_pcvar_num(gp_CustomSpray) || (get_pcvar_num(gp_BlockType) && gp_IsSprayBlocked[id])) 
    { 
        
        return PLUGIN_HANDLED 
    } 
    else 
    { 
        if(get_systime() - gp_LastSpray[id] < gp_SprayTime[id]) 
        { 
            
            return PLUGIN_HANDLED 
        } 
        gp_LastSpray[id] = get_systime() 
        CustomSprayTime(id, gp_SprayTime[id]) 
    } 
    return PLUGIN_CONTINUE 
} 
public Event_Spray() 
{ 
    if(!get_pcvar_num(gp_SprayDist)) 
        return PLUGIN_CONTINUE 
    
    new iOrigin[3] 
    iOrigin[0] = read_data(3) 
    iOrigin[1] = read_data(4) 
    iOrigin[2] = read_data(5) 
    
    new Float:vecSprayOrigin[3] 
    IVecFVec(iOrigin, vecSprayOrigin) 
    
    new iPlayer = read_data(2) 
    
    new Float:vecPlayerOrigin[3] 
    get_user_origin( iPlayer, iOrigin, 1) 
    IVecFVec( iOrigin, vecPlayerOrigin ) 
    
    new Float:vecDirection[3] 
    xs_vec_sub( vecSprayOrigin, vecPlayerOrigin, vecDirection) 
    xs_vec_mul_scalar( vecDirection, 10.0 / vector_length(vecDirection), vecDirection) 
    
    new Float:vecStop[3] 
    xs_vec_add( vecSprayOrigin, vecDirection, vecStop ) 
    xs_vec_mul_scalar( vecDirection, -1.0, vecDirection ) 
    
    new Float:vecStart[3] 
    xs_vec_add( vecSprayOrigin, vecDirection, vecStart ) 
    engfunc( EngFunc_TraceLine, vecStart, vecStop, IGNORE_MONSTERS, -1, 0 ) 
    get_tr2( 0, TR_vecPlaneNormal, vecDirection ) 
    vecDirection[2] = 0.0 
    
    xs_vec_mul_scalar( vecDirection, 5.0 / vector_length(vecDirection), vecDirection) 
    xs_vec_add( vecSprayOrigin, vecDirection, vecStart ) 
    xs_vec_copy( vecStart, vecStop ) 
    vecStop[2] -= 9999.0 
    
    engfunc( EngFunc_TraceLine, vecStart, vecStop, IGNORE_MONSTERS, -1, 0 ) 
    get_tr2( 0, TR_vecEndPos, vecStop ) 
    
    
    return PLUGIN_CONTINUE 
} 
public Save_SprayBan(id) 
{ 
    new gp_BannedName[33], gp_BannedId[35], gp_Saveline[128], iFile = fopen(gp_ConfigFile, "a+") 
    
    if(!iFile) return 
    
    get_user_name(id, gp_BannedName, charsmax(gp_BannedName)) 
    get_user_authid(id, gp_BannedId, charsmax(gp_BannedId)) 
    
    formatex(gp_Saveline, charsmax(gp_Saveline), "^"%s^" ^"%s^"^n", gp_BannedId, gp_BannedName) 
    fprintf(iFile, gp_Saveline) 
    
    fclose(iFile) 
} 
public Remove_SprayBan(id) 
{ 
    new gp_BannedId[35], iFile = fopen(gp_ConfigFile, "a+") 
    
    if(!iFile) return 
    
    new szData[128], line 
    get_user_authid(id, gp_BannedId, charsmax(gp_BannedId)) 
    
    while(!feof(iFile)) 
    { 
        fgets(iFile, szData, charsmax(szData)) 
        parse(szData, szData, charsmax(szData)) 
        
        if(equal(szData, gp_BannedId)) 
        { 
            write_file(gp_ConfigFile, "", line) 
        } 
        line++ 
    } 
    fclose(iFile) 
} 
public plugin_precache() 
{ 
    new gp_Config[128] 
    get_localinfo("amxx_configsdir", gp_Config, charsmax(gp_Config)) 
    formatex(gp_ConfigFile, charsmax(gp_ConfigFile), "%s/CS_BannedUsers.ini", gp_Config) 
    
    if(!file_exists(gp_ConfigFile)) 
    { 
        write_file(gp_ConfigFile, ";Custom Spray Management", 0) 
        write_file(gp_ConfigFile, ";Credits to Shakespeare ^n", 1) 
        return 
    } 
    
    new iFile = fopen(gp_ConfigFile, "rt") 
    if(!iFile) return 
    
    new szData[128], szKey[35] 
    gp_SprayBanned = TrieCreate() 
    
    while(!feof(iFile)) 
    { 
        fgets(iFile, szData, charsmax(szData)) 
        trim(szData) 
        
        if(!szData[0] || szData[0] == ';' || szData[0] == ' ' ) continue 
        
        parse(szData, szKey, charsmax(szKey)) 
        TrieSetCell(gp_SprayBanned, szKey, 1) 
    } 
    fclose(iFile) 
}