Raised This Month: $ Target: $400
 0% 

Fvault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tripaloski
Member
Join Date: Jul 2017
Old 07-26-2017 , 16:28   Fvault
Reply With Quote #1

How can I load the total data in fvault?
For example in this plugins:
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < csx >
#include < hamsandwich >
#include < fvault >

#define PLUGIN        "Basic SkillPoints Special Edition (FVault)"
#define VERSION        "2.0.2"
#define AUTHOR        "guipatinador"

#define g_VaultSkillPoints    "skillpoints_v2"
#define g_VaultNames        "skillpoints_names"
#define PREFIX            "[SkillPoints]"

#define MAX_PLAYERS    32
#define ADMIN        ADMIN_RCON

#define EXPIREDAYS    30
#define MAX_CLASSES    5
#define MAX_LEVELS    5
#define MAX_PONTUATION    10000 // max skillpoints per player

#define IsPlayer(%1)        ( 1 <= %1 <= g_iMaxPlayers )

new const CLASSESMAX_CLASSES ][ ] = {
    
"BOT",
    
"NOOB",
    
"GAMER",
    
"LEET",
    
"TOP"
}

new const 
LEVELSMAX_LEVELS ] = {
    
500,
    
1200,
    
1800,
    
2500,
    
100000 /* high value (not reachable) */
}

enum _:FvaultData {
    
szSteamID35 ],
    
szSkillP_Data128 ]
}

new 
g_iK
new const g_ChatAdvertise[ ][ ] = {
    
"!g%s!n Write!t /myskill!n to see your SkillPoints",
    
"!g%s!n Write!t /restartskill!n to restart your SkillPoints and level",
    
"!g%s!n Write!t /rankskill!n to see your rank",
    
"!g%s!n Write!t /topskill!n to see the top SkillPointers"
}

new 
g_iMaxPlayers
new g_szAuthIDMAX_PLAYERS ][ 35 ]
new 
g_szNameMAX_PLAYERS ][ 32 ]
new 
g_iCurrentKillsMAX_PLAYERS ]
new 
g_szMotd1536 ]

new 
g_iPointsMAX_PLAYERS ]
new 
g_iLevelsMAX_PLAYERS ]
new 
g_iClassesMAX_PLAYERS ]

new 
g_iKillsMAX_PLAYERS ]
new 
g_iDeathsMAX_PLAYERS ]
new 
g_iHeadShotsMAX_PLAYERS ]
new 
g_iKnifeKillsMAX_PLAYERS ]
new 
g_iKnifeDeathsMAX_PLAYERS ]
new 
g_iGrenadeKillsMAX_PLAYERS ]
new 
g_iGrenadeDeathsMAX_PLAYERS ]
new 
g_iBombExplosionsMAX_PLAYERS ]
new 
g_iDefusedBombsMAX_PLAYERS ]
new 
g_iWonRoundsMAX_PLAYERS ]

new 
g_TimeBetweenAds

new bool:g_bRoundEnded

new g_iAdsOnChat
new g_iEnableAnnounceOnChat
new g_iEnableShowSkillPointsOnNick
new g_iHideChangeNickNotification
new g_iEnableSkillPointsCmd
new g_iEnableSkillPointsRestart
new g_iEnableSkillPointsCmdRank
new g_iEnableSkillPointsTop15
new g_iHideCmds
new g_iEnableWonPointsHour
new g_iWonPointsHour
new g_iLostPointsTK
new g_iLostPointsSuicide
new g_iWonPointsKill
new g_iLostPointsDeath
new g_iWonPointsHeadshot
new g_iLostPointsHeadshot
new g_iWonPointsKnife
new g_iLostPointsKnife
new g_iWonPointsGrenade
new g_iLostPointsGrenade
new g_iWonPointsTerrorists
new g_iWonPointsCounterTerrorists
new g_iLostPointsTerrorists
new g_iLostPointsCounterTerrorists
new g_iWonPointsPlanter
new g_iWonPointsPlanterExplode
new g_iWonPointsDefuser
new g_iWonPoints4k
new g_iWonPoints5k
new g_iNegativePoints

public plugin_init( )
{
    
register_pluginPLUGINVERSIONAUTHOR )
    
    
register_clcmd"say""ClCmd_Say" )
    
register_clcmd"say_team""ClCmd_Say" )
    
    
register_concmd("bps_give""CmdGivePoints"ADMIN"<target> <skillpoints to give>" )
    
register_concmd("bps_take""CmdTakePoints"ADMIN"<target> <skillpoints to take>" )
    
    
RegisterHamHam_Spawn"player""FwdPlayerSpawnPost")
    
    
register_messageget_user_msgid"SayText" ), "MessageSayText" )
    
    
register_event"SendAudio""TerroristsWin""a""2&%!MRAD_terwin" )
    
register_event"SendAudio""CounterTerroristsWin""a""2&%!MRAD_ctwin" )
    
    
register_event"HLTV""EventNewRound""a""1=0""2=0" )
    
register_logevent"RoundEnd"2"1=Round_End" )
    
    
g_iMaxPlayers get_maxplayers( )
    
    
RegisterCvars( )
}

public 
plugin_natives( )
{
    
register_library"skillpoints" )
    
    
register_native"skillpoints""_skillpoints" )
}

public 
_skillpointspluginparams )
{
    if( 
params != )
    {
        return 
0
    
}
    
    new 
id get_param)
    if( !
id )
    {
        return 
0
    
}
    
    return 
g_iPointsid ]
}

public 
RegisterCvars( )
{
    
g_iAdsOnChat register_cvar"bps_ads""1" )
    
g_TimeBetweenAds register_cvar"bps_time_between_ads""300.0" )
    
g_iEnableAnnounceOnChat register_cvar"bps_announce_on_chat""1" )
    
g_iEnableShowSkillPointsOnNick register_cvar"bps_skillpoints_on_nick""1" )
    
g_iHideChangeNickNotification register_cvar"bps_hide_change_nick_notification""1" )
    
g_iEnableSkillPointsCmd register_cvar"bps_skillpoints_cmd""1" )
    
g_iEnableSkillPointsRestart register_cvar"bps_skillpoints_cmd_restart""1" )
    
g_iEnableSkillPointsCmdRank register_cvar"bps_skillpoints_cmd_rank""1" )
    
g_iEnableSkillPointsTop15 register_cvar"bps_skillpoints_cmd_top15""1" )
    
g_iHideCmds register_cvar"bps_hide_cmd""0" )
    
g_iEnableWonPointsHour register_cvar"bps_enable_win_per_hour""1" )
    
g_iWonPointsHour register_cvar"bps_won_points_hour""5" )
    
g_iLostPointsTK register_cvar"bps_lost_points_tk""5" )
    
g_iLostPointsSuicide register_cvar"bps_lost_points_suicide""1" )
    
g_iWonPointsKill register_cvar"bps_won_points_kill""1" )
    
g_iLostPointsDeath register_cvar"bps_lost_points_kill""1" )
    
g_iWonPointsHeadshot register_cvar"bps_won_points_headshot""2" )
    
g_iLostPointsHeadshot register_cvar"bps_lost_points_headshot""2" )
    
g_iWonPointsKnife register_cvar"bps_won_points_knife""3" )
    
g_iLostPointsKnife register_cvar"bps_lost_points_knife""3" )
    
g_iWonPointsGrenade register_cvar"bps_won_points_grenade""3" )
    
g_iLostPointsGrenade register_cvar"bps_lost_points_grenade""3" )
    
g_iWonPointsTerrorists register_cvar"bps_won_points_ts""1" )
    
g_iWonPointsCounterTerrorists register_cvar"bps_won_points_cts""1" )
    
g_iLostPointsTerrorists register_cvar"bps_lost_points_ts""1" )
    
g_iLostPointsCounterTerrorists register_cvar"bps_lost_points_cts""1" )
    
g_iWonPointsPlanter register_cvar"bps_won_points_planter""1" )
    
g_iWonPointsPlanterExplode register_cvar"bps_won_points_planter_explode""2" 
    
g_iWonPointsDefuser register_cvar"bps_won_points_defuser""3" )
    
g_iWonPoints4k register_cvar"bps_won_points_4k""4" )
    
g_iWonPoints5k register_cvar"bps_won_points_5k""5" )
    
g_iNegativePoints register_cvar"bps_negative_points""0" )
    
    if( 
get_pcvar_numg_iAdsOnChat ) )
    {
        
set_taskget_pcvar_floatg_TimeBetweenAds ), "ChatAdvertisements"___"b" )
    }
    
    
fvault_pruneg_VaultSkillPoints_get_systime( ) - ( 86400 EXPIREDAYS ) )
    
    
MakeTop15( )
}

public 
client_authorizedid )
{
    
get_user_authidid g_szAuthIDid ], charsmaxg_szAuthID[ ] ) )
    
get_user_infoid"name"g_szNameid ], charsmaxg_szName[ ] ) )
    
    
fvault_set_datag_VaultNamesg_szAuthIDid ], g_szNameid ] )
    
    
g_iPointsid ] = 0
    g_iLevels
id ] = 0
    g_iClasses
id ] = 0
    
    g_iKills
id ] = 0
    g_iDeaths
id ] = 0
    g_iHeadShots
id ] = 0
    g_iKnifeKills
id ] = 0
    g_iKnifeDeaths
id ] = 0
    g_iGrenadeKills
id ] = 0
    g_iGrenadeDeaths
id ] = 0
    g_iBombExplosions
id ] = 0
    g_iDefusedBombs
id ] = 0
    g_iWonRounds
id ] = 0
    
    g_iCurrentKills
id ] = 0
    
    LoadPoints
id )
    
    if( 
get_pcvar_numg_iEnableWonPointsHour ) && get_pcvar_numg_iWonPointsHour ) )
    {
        
set_task3600.0"GiveSkillPointsHour"id__"b" )
    }
}

public 
client_infochangedid )
{
    if( 
is_user_connectedid ) )
    {
        new 
szNewName32 ]
        
get_user_infoid"name"szNewNamecharsmaxszNewName ) ) 
        
        new 
iLen strlenszNewName )
        
        new 
iPos iLen 1
        
        
if( szNewNameiPos ] == '>' )
        {    
            new 
i
            
for( 17i++ )
            {    
                if( 
szNewNameiPos ] == '<' )
                {    
                    
iLen iPos i
                    szNewName
iLen ] = EOS
                    
break
                }
            }
        }
        
        
trimszNewName )
        
        if( !
equalg_szNameid ], szNewName ) )   
        {     
            
copyg_szNameid ], charsmaxg_szName[ ] ), szNewName )
            
            
fvault_set_datag_VaultNamesg_szAuthIDid ], g_szNameid ] )
        }    
    }
}

public 
client_disconnectid )
{
    if( 
task_existsid ) )
    {
        
remove_taskid )
    }
    
    
CheckLevelAndSaveid )
}

public 
ClCmd_Sayid )
{    
    new 
szCmd12 ]
    
read_argv1szCmdcharsmaxszCmd ) )
    
    if( 
equaliszCmd], "myskill" ) )
    {
        
GetSkillPointsid )
    }
    
    else if( 
equaliszCmd], "restartskill" ) )
    {
        
RestartSkillPointsid )
    }
    
    else if( 
equaliszCmd], "rankskill" ) )
    {
        
SkillRankid )
    }
    
    else if( 
equaliszCmd], "topskill" ) )
    {
        
TopSkillid )
    }
}

public 
GiveSkillPointsHourid )
{
    
g_iPointsid ] += get_pcvar_numg_iWonPointsHour )
    
    if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
    {
        
ClientPrintColorid"!g%s!n You earned!t %i!n point%s for playing more one hour"PREFIXget_pcvar_numg_iWonPointsHour ), get_pcvar_numg_iWonPointsHour ) > "s" "" )
    }
}

public 
client_deathiKilleriVictimiWpnIndexiHitPlaceiTK )
{    
    if( !
IsPlayeriKiller ) || !IsPlayeriVictim ) )
    {
        return 
PLUGIN_CONTINUE
    
}
    
    if( 
iTK )
    {
        
g_iPointsiKiller ] -= get_pcvar_numg_iLostPointsTK )
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) && get_pcvar_numg_iLostPointsTK ) )
        {
            
ClientPrintColoriKiller"!g%s!n You have lost!t %i!n point%s by killing a teammate"PREFIXget_pcvar_numg_iLostPointsTK ), get_pcvar_numg_iLostPointsTK ) > "s" ""  )
        }
        
        return 
PLUGIN_CONTINUE
    
}
    
    if( 
iKiller == iVictim )
    {
        
g_iPointsiKiller ] -= get_pcvar_numg_iLostPointsSuicide )
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) && get_pcvar_numg_iLostPointsSuicide ) )
        {
            
ClientPrintColoriKiller"!g%s!n You have lost!t %i!n point%s for committing suicide"PREFIXget_pcvar_numg_iLostPointsSuicide ), get_pcvar_numg_iLostPointsSuicide ) > "s" ""  )
        }
        
        
g_iDeathsiKiller ]++
        
        return 
PLUGIN_CONTINUE
    
}
    
    
g_iCurrentKillsiKiller ]++
    
g_iKillsiKiller ]++
    
    
g_iDeathsiVictim ]++
    
    if( 
iWpnIndex == CSW_HEGRENADE )
    {
        
g_iPointsiKiller ] += get_pcvar_numg_iWonPointsGrenade )
        
g_iGrenadeKillsiKiller]++
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) && get_pcvar_numg_iWonPointsGrenade ) )
        {
            
ClientPrintColoriKiller"!g%s!n You earned!t %i!n point%s by killing %s with a grenade"PREFIXget_pcvar_numg_iWonPointsGrenade ), get_pcvar_numg_iWonPointsGrenade ) > "s" "" ,g_szNameiVictim ] )
        }
        
        
g_iPointsiVictim ] -= get_pcvar_numg_iLostPointsGrenade )
        
g_iGrenadeDeathsiVictim ]++
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) && get_pcvar_numg_iLostPointsGrenade ) )
        {
            
ClientPrintColoriVictim"!g%s!n You have lost!t %i!n point%s for dying with a grenade"PREFIXget_pcvar_numg_iLostPointsGrenade ), get_pcvar_numg_iLostPointsGrenade ) > "s" "" )
        }
        
        return 
PLUGIN_CONTINUE
    
}
    
    if( 
iWpnIndex == CSW_KNIFE )
    {
        
g_iPointsiKiller ] += get_pcvar_numg_iWonPointsKnife )
        
g_iKnifeKillsiKiller ]++
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) && get_pcvar_numg_iWonPointsKnife ) )
        {
            
ClientPrintColoriKiller"!g%s!n You earned!t %i!n point%s by killing %s with knife"PREFIXget_pcvar_numg_iWonPointsKnife ), get_pcvar_numg_iWonPointsKnife ) > "s" "" ,g_szNameiVictim ] )
        }
        
        
g_iPointsiVictim ] -= get_pcvar_numg_iLostPointsKnife )
        
g_iKnifeDeathsiVictim ]++
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) && get_pcvar_numg_iLostPointsKnife ) )
        {
            
ClientPrintColoriVictim"!g%s!n You have lost!t %i!n point%s for dying with knife"PREFIXget_pcvar_numg_iLostPointsKnife ), get_pcvar_numg_iLostPointsKnife ) > "s" "" )
        }
        
        return 
PLUGIN_CONTINUE
    
}
    
    if( 
iHitPlace == HIT_HEAD )
    {
        
g_iPointsiKiller ] += get_pcvar_numg_iWonPointsHeadshot )
        
g_iHeadShotsiKiller ]++
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) && get_pcvar_numg_iWonPointsHeadshot ) )
        {
            
ClientPrintColoriKiller"!g%s!n You earned!t %i!n point%s by killing %s with a headshot"PREFIXget_pcvar_numg_iWonPointsHeadshot ), get_pcvar_numg_iWonPointsHeadshot ) > "s" "" ,g_szNameiVictim ] )
        }
        
        
g_iPointsiVictim ] -= get_pcvar_numg_iLostPointsHeadshot )
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) && get_pcvar_numg_iLostPointsHeadshot ) )
        {
            
ClientPrintColoriVictim"!g%s!n You have lost!t %i!n point%s for dying with a headshot"PREFIXget_pcvar_numg_iLostPointsHeadshot ), get_pcvar_numg_iLostPointsHeadshot ) > "s" "" )
        }
        
        return 
PLUGIN_CONTINUE
    
}
    
    
g_iPointsiKiller ] += get_pcvar_numg_iWonPointsKill )
    
    if( 
get_pcvar_numg_iEnableAnnounceOnChat ) && get_pcvar_numg_iWonPointsKill ) )
    {
        
ClientPrintColoriKiller"!g%s!n You earned!t %i!n point%s by killing %s"PREFIXget_pcvar_numg_iWonPointsKill ), get_pcvar_numg_iWonPointsKill ) > "s" ""g_szNameiVictim ] )
    }
    
    
g_iPointsiVictim ] -= get_pcvar_numg_iLostPointsDeath )
    
    if( 
get_pcvar_numg_iEnableAnnounceOnChat ) && get_pcvar_numg_iLostPointsDeath ) )
    {
        
ClientPrintColoriVictim"!g%s!n You have lost!t %i!n point%s for dying"PREFIXget_pcvar_numg_iLostPointsDeath ), get_pcvar_numg_iLostPointsDeath ) > "s" "" )
    }
    
    return 
PLUGIN_CONTINUE    
}

public 
TerroristsWin( )
{
    if( 
g_bRoundEnded )
    {
        return 
PLUGIN_CONTINUE
    
}
    
    new 
PlayersMAX_PLAYERS ]
    new 
iNum
    
new i
    
    get_players
PlayersiNum"ch" )
    
    for( --
iNumiNum >= 0iNum-- )
    {
        
PlayersiNum ]
        
        switch( 
cs_get_user_team) )
        {
            case( 
CS_TEAM_T ):
            {
                if( 
get_pcvar_numg_iWonPointsTerrorists ) )
                {
                    
g_iPoints] += get_pcvar_numg_iWonPointsTerrorists )
                    
g_iWonRounds]++
                    
                    if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
                    {
                        
ClientPrintColori"!g%s!n Your team!t (T)!n have won!t %i!n point%s for winning the round"PREFIXget_pcvar_numg_iWonPointsTerrorists ), get_pcvar_numg_iWonPointsTerrorists ) > "s" "" )
                    }
                }
            }
            
            case( 
CS_TEAM_CT ):
            {
                if( 
get_pcvar_numg_iLostPointsCounterTerrorists ) )
                {
                    
g_iPoints] -= get_pcvar_numg_iLostPointsCounterTerrorists )
                    
                    if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
                    {
                        
ClientPrintColori"!g%s!n Your team!t (CT)!n have lost!t %i!n point%s for losing the round"PREFIXget_pcvar_numg_iLostPointsCounterTerrorists ), get_pcvar_numg_iLostPointsCounterTerrorists ) > "s" "" )
                    }
                }
            }
        }
    }
    
    
g_bRoundEnded true
    
    
return PLUGIN_CONTINUE
}

public 
CounterTerroristsWin( )
{
    if( 
g_bRoundEnded )
    {
        return 
PLUGIN_CONTINUE
    
}
    
    new 
PlayersMAX_PLAYERS ]
    new 
iNum
    
new i
    
    get_players
PlayersiNum"ch" )
    
    for( --
iNumiNum >= 0iNum-- )
    {
        
PlayersiNum ]
        
        switch( 
cs_get_user_team) )
        {
            case( 
CS_TEAM_T ):
            {
                if( 
get_pcvar_numg_iLostPointsTerrorists ) )
                {
                    
g_iPoints] -= get_pcvar_numg_iLostPointsTerrorists )
                    
                    if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
                    {
                        
ClientPrintColori"!g%s!n Your team!t (T)!n have lost!t %i!n point%s for losing the round"PREFIXget_pcvar_numg_iLostPointsTerrorists ), get_pcvar_numg_iLostPointsTerrorists ) > "s" "" )
                    }
                }
            }
            
            case( 
CS_TEAM_CT ):
            {
                if( 
get_pcvar_numg_iWonPointsCounterTerrorists ) )
                {
                    
g_iPoints] += get_pcvar_numg_iWonPointsCounterTerrorists )
                    
g_iWonRounds]++
                    
                    if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
                    {
                        
ClientPrintColori"!g%s!n Your team!t (CT)!n have won!t %i!n point%s for winning the round"PREFIXget_pcvar_numg_iWonPointsCounterTerrorists ), get_pcvar_numg_iWonPointsCounterTerrorists ) > "s" "" )
                    }
                }
            }
        }
    }
    
    
g_bRoundEnded true
    
    
return PLUGIN_CONTINUE
}

public 
bomb_plantedplanter )
{
    if( 
get_pcvar_numg_iWonPointsPlanter ) )
    {
        
g_iPointsplanter ] += get_pcvar_numg_iWonPointsPlanter )
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
        {
            
ClientPrintColorplanter"!g%s!n You earned!t %i!n point%s for planting the bomb"PREFIXget_pcvar_numg_iWonPointsPlanter ), get_pcvar_numg_iWonPointsPlanter ) > "s" "" )
        }
    }
}

public 
bomb_explodeplanterdefuser )
{
    if( 
get_pcvar_numg_iWonPointsPlanterExplode ) )
    {
        
g_iPointsplanter ] += get_pcvar_numg_iWonPointsPlanterExplode )
        
g_iBombExplosionsplanter ]++
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
        {
            
ClientPrintColorplanter"!g%s!n You earned!t %i!n point%s with the bomb explosion"PREFIXget_pcvar_numg_iWonPointsPlanterExplode ), get_pcvar_numg_iWonPointsPlanterExplode ) > "s" "" )
        }
    }
}

public 
bomb_defuseddefuser )
{
    if( 
get_pcvar_numg_iWonPointsDefuser ) )
    {
        
g_iPointsdefuser ] += get_pcvar_numg_iWonPointsDefuser )
        
g_iDefusedBombsdefuser ]++
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
        {
            
ClientPrintColordefuser"!g%s!n You earned!t %i!n point%s for disarming the bomb"PREFIXget_pcvar_numg_iWonPointsDefuser ), get_pcvar_numg_iWonPointsDefuser ) > "s" "" )
        }
    }
}

public 
EventNewRound( )
{
    
g_bRoundEnded false
    
    MakeTop15
( )
}


public 
RoundEnd( )
{
    
set_task0.5"SavePointsAtRoundEnd" )
}

public 
SavePointsAtRoundEnd( )
{
    new 
PlayersMAX_PLAYERS ]
    new 
iNum
    
new i
    
    get_players
PlayersiNum"ch" )
    
    for( --
iNumiNum >= 0iNum-- )
    {
        
PlayersiNum ]
        
        if( 
g_iCurrentKills] == && get_pcvar_numg_iWonPoints4k ) )
        {
            
g_iPoints] += get_pcvar_numg_iWonPoints4k )
            
            if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
            {
                
ClientPrintColori"!g%s!n You earned!t %i!n point%s for killing 4 in a round"PREFIXget_pcvar_numg_iWonPoints4k ), get_pcvar_numg_iWonPoints4k ) > "s" "" )
            }
        }
        
        if( 
g_iCurrentKills] >= && get_pcvar_numg_iWonPoints5k ) )
        {
            
g_iPoints] += get_pcvar_numg_iWonPoints5k )
            
            if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
            {
                
ClientPrintColori"!g%s!n You earned!t %i!n point%s for killing 5 in a round"PREFIXget_pcvar_numg_iWonPoints5k ), get_pcvar_numg_iWonPoints5k ) > "s" "" )
            }
        }
        
        
CheckLevelAndSave)
    }
}

public 
CheckLevelAndSaveid )
{
    if( !
get_pcvar_numg_iNegativePoints) )
    {
        if( 
g_iPointsid ] < )
        {
            
g_iPointsid ] = 0
        
}
        
        if( 
g_iLevelsid ] < )
        {
            
g_iLevelsid ] = 0
        
}
    }
    
    while( 
g_iPointsid ] >= LEVELSg_iLevelsid ] ] )
    {
        
g_iLevelsid ]++
        
g_iClassesid ]++
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
        {            
            
ClientPrintColor0"!g%s!n %s increased one level! Level:!t %s!n Total points:!t %d"PREFIXg_szNameid ], CLASSESg_iLevelsid ] ], g_iPointsid ] )
        }
    }
    
    new 
szFormattedData128 ]
    
formatexszFormattedDatacharsmaxszFormattedData ),
    
"%i %i %i %i %i %i %i %i %i %i %i %i",
    
    
g_iPointsid ],
    
g_iLevelsid ],
    
    
g_iKillsid ],
    
g_iDeathsid ],
    
g_iHeadShotsid ],
    
g_iKnifeKillsid ],
    
g_iKnifeDeathsid ],
    
g_iGrenadeKillsid ],
    
g_iGrenadeDeathsid ],
    
g_iBombExplosionsid ],
    
g_iDefusedBombsid ],
    
g_iWonRoundsid ] )
    
    
fvault_set_datag_VaultSkillPointsg_szAuthIDid ], szFormattedData )
    
    if( 
g_iPointsid ] >= MAX_PONTUATION )
    {        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
        {
            
ClientPrintColorid"!g%s!n You have reached the maximum SkillPoints! Your SkillPoints and level will start again"PREFIX )
        }
        
        
g_iPointsid ] = 0
        g_iLevels
id ] = 0
        g_iClasses
id ] = 0
        
        g_iKills
id ] = 0
        g_iDeaths
id ] = 0
        g_iHeadShots
id ] = 0
        g_iKnifeKills
id ] = 0
        g_iKnifeDeaths
id ] = 0
        g_iGrenadeKills
id ] = 0
        g_iGrenadeDeaths
id ] = 0
        g_iBombExplosions
id ] = 0
        g_iDefusedBombs
id ] = 0
        g_iWonRounds
id ] = 0
        
        CheckLevelAndSave
id )
    }
}

public 
LoadPointsid )
{
    new 
szFormattedData128 ]
    if( 
fvault_get_datag_VaultSkillPointsg_szAuthIDid ], szFormattedDatacharsmaxszFormattedData ) ) )
    {
        new 
szPlayerPoints]
        new 
szPlayerLevel]
        
        new 
szPlayerKills]
        new 
szPlayerDeahts]
        new 
szPlayerHeadShots]
        new 
szPlayerKnifeKills]
        new 
szPlayerKnifeDeaths]
        new 
szPlayerGrenadeKills]
        new 
szPlayerGrenadeDeaths]
        new 
szPlayerBombExplosions]
        new 
szPlayerDefusedBombs]
        new 
szPlayerWonRounds]
        
        
parseszFormattedData,
        
szPlayerPointscharsmaxszPlayerPoints ),
        
szPlayerLevelcharsmaxszPlayerLevel ),
        
        
szPlayerKillscharsmaxszPlayerKills ),
        
szPlayerDeahtscharsmaxszPlayerDeahts ),
        
szPlayerHeadShotscharsmaxszPlayerHeadShots ),
        
szPlayerKnifeKillscharsmaxszPlayerKnifeKills ),
        
szPlayerKnifeDeathscharsmaxszPlayerKnifeDeaths ),
        
szPlayerGrenadeKillscharsmaxszPlayerGrenadeKills ),
        
szPlayerGrenadeDeathscharsmaxszPlayerGrenadeDeaths ),
        
szPlayerBombExplosionscharsmaxszPlayerBombExplosions ),
        
szPlayerDefusedBombscharsmaxszPlayerDefusedBombs ),
        
szPlayerWonRoundscharsmaxszPlayerWonRounds ) )
        
        
g_iPointsid ] = str_to_numszPlayerPoints )
        
g_iLevelsid ] = str_to_numszPlayerLevel )
        
        
g_iKillsid ] = str_to_numszPlayerKills )
        
g_iDeathsid ] = str_to_numszPlayerDeahts )
        
g_iHeadShotsid ] = str_to_numszPlayerHeadShots )
        
g_iKnifeKillsid ] = str_to_numszPlayerKnifeKills )
        
g_iKnifeDeathsid ] = str_to_numszPlayerKnifeDeaths )
        
g_iGrenadeKillsid ] = str_to_numszPlayerGrenadeKills )
        
g_iGrenadeDeathsid ] = str_to_numszPlayerGrenadeDeaths )
        
g_iBombExplosionsid ] = str_to_numszPlayerBombExplosions )
        
g_iDefusedBombsid ] = str_to_numszPlayerDefusedBombs )
        
g_iWonRoundsid ] = str_to_numszPlayerWonRounds )
        
    }
}

public 
GetSkillPointsid )
{
    if( !
get_pcvar_numg_iEnableSkillPointsCmd ) )
    {
        
ClientPrintColorid"!g%s!n Command disabled"PREFIX )
    }
    
    else
    {        
        if( 
g_iLevelsid ] < ( MAX_LEVELS ) )
        {
            
ClientPrintColorid"!g%s!n Total points:!t %d!n Level:!t %s!n Points to the next level:!t %d"PREFIXg_iPointsid ], CLASSESg_iLevelsid ] ], ( LEVELSg_iLevelsid ] ] - g_iPointsid ] ) )
        }
        
        else
        {
            
ClientPrintColorid"!g%s!n Total points:!t %d!n Level:!t %s!n (last level)"PREFIXg_iPointsid ], CLASSESg_iLevelsid ] ] )
        }
    }
    
    return ( 
get_pcvar_numg_iHideCmds ) == ) ? PLUGIN_CONTINUE PLUGIN_HANDLED_MAIN
}

public 
ChatAdvertisements( )
{
    new 
PlayersMAX_PLAYERS ]
    new 
iNum
    
new i
    
    get_players
PlayersiNum"ch" )
    
    for( --
iNumiNum >= 0iNum-- )
    {
        
PlayersiNum ]
        
        
ClientPrintColorig_ChatAdvertiseg_iK ], PREFIX )
    }
    
    
g_iK++
    
    if( 
g_iK >= sizeof g_ChatAdvertise )
    {
        
g_iK 0
    
}
}

public 
CmdGivePointsidlevelcid )
{
    if ( !
cmd_accessidlevelcid) )
    {
        return 
PLUGIN_HANDLED
    
}
    
    new 
Arg132 ]
    new 
Arg2]
    
    
read_argv1Arg1charsmaxArg1 ) )
    
read_argv2Arg2charsmaxArg2 ) )
    
    new 
iPlayer cmd_targetidArg1)
    new 
iPoints str_to_numArg2 )
    
    if ( !
iPlayer )
    {
        
console_printid"Sorry, player %s could not be found or targetted!"Arg1 )
        return 
PLUGIN_HANDLED
    
}
    
    if( 
iPoints )
    {
        
g_iPointsiPlayer ] += iPoints
        CheckLevelAndSave
iPlayer )
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
        {
            
ClientPrintColor0"!g%s!n %s gave!t %i!n SkillPoint%s to %s"PREFIXg_szNameid ], iPointsiPoints "s" ""g_szNameiPlayer ] )
        }
    }
    
    return 
PLUGIN_HANDLED
}

public 
CmdTakePointsidlevelcid )
{
    if ( !
cmd_accessidlevelcid) )
    {
        return 
PLUGIN_HANDLED
    
}
    
    new 
Arg132 ]
    new 
Arg2]
    
    
read_argv1Arg1charsmaxArg1 ) )
    
read_argv2Arg2charsmaxArg2 ) )
    
    new 
iPlayer cmd_targetidArg1)
    new 
iPoints str_to_numArg2 )
    
    if ( !
iPlayer )
    {
        
console_printid"Sorry, player %s could not be found or targetted!"Arg1 )
        return 
PLUGIN_HANDLED
    
}
    
    if( 
iPoints )
    {
        
g_iPointsiPlayer ] -= iPoints
        CheckLevelAndSave
iPlayer )
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
        {
            
ClientPrintColor0"!g%s!n %s take!t %i!n SkillPoint%s from %s"PREFIXg_szNameid ], iPointsiPoints "s" ""g_szNameiPlayer ] )
        }
    }
    
    return 
PLUGIN_HANDLED
}

public 
RestartSkillPointsid )
{
    if( !
get_pcvar_numg_iEnableSkillPointsRestart ) )
    {
        
ClientPrintColorid"!g%s!n Command disabled"PREFIX )
    }
    
    else
    {
        
g_iPointsid ] = 0
        g_iLevels
id ] = 0
        g_iClasses
id ] = 0
        
        g_iKills
id ] = 0
        g_iDeaths
id ] = 0
        g_iHeadShots
id ] = 0
        g_iKnifeKills
id ] = 0
        g_iKnifeDeaths
id ] = 0
        g_iGrenadeKills
id ] = 0
        g_iGrenadeDeaths
id ] = 0
        g_iBombExplosions
id ] = 0
        g_iDefusedBombs
id ] = 0
        g_iWonRounds
id ] = 0
        
        CheckLevelAndSave
id )
        
        if( 
get_pcvar_numg_iEnableAnnounceOnChat ) )
        {
            
ClientPrintColorid"!g%s!n Your SkillPoints and level will start again"PREFIX )
        }
    }
    
    return ( 
get_pcvar_numg_iHideCmds ) == ) ? PLUGIN_CONTINUE PLUGIN_HANDLED_MAIN
}

public 
SkillRankid )
{
    if( !
get_pcvar_numg_iEnableSkillPointsCmdRank ) )
    {
        
ClientPrintColorid"!g%s!n Command disabled"PREFIX )
    }
    
    else
    {
        new Array:
aKey ArrayCreate35 )
        new Array:
aData ArrayCreate128 )
        new Array:
aAll ArrayCreateFvaultData )
        
        
fvault_loadg_VaultSkillPointsaKeyaData )
        
        new 
iArraySize ArraySizeaKey )
        
        new 
DataFvaultData ]
        
        new 
i
        
for( 0iArraySizei++ )
        {
            
ArrayGetStringaKeyiDataszSteamID ], sizeof DataszSteamID ] - )
            
ArrayGetStringaDataiDataszSkillP_Data ], sizeof DataszSkillP_Data ] - )
            
            
ArrayPushArrayaAllData )
        }
        
        
ArraySortaAll"SortData" )
        
        new 
szAuthIdFromArray35 ]
        
        new 
j
        
for( 0iArraySizej++ )
        {
            
ArrayGetStringaAlljszAuthIdFromArraycharsmaxszAuthIdFromArray ) )
            
            if( 
equalszAuthIdFromArrayg_szAuthIDid ] ) )
            {
                break
            }    
        }
        
        
ArrayDestroyaKey )
        
ArrayDestroyaData )
        
ArrayDestroyaAll )
        
        
ClientPrintColorid"!g%s!n Your rank is!t %i!n of!t %i!n players with!t %i!n points "PREFIX1iArraySizeg_iPointsid ] )
    }
    
    return ( 
get_pcvar_numg_iHideCmds ) == ) ? PLUGIN_CONTINUE PLUGIN_HANDLED_MAIN
}

public 
TopSkillid )
{
    if( !
get_pcvar_numg_iEnableSkillPointsTop15 ) )
    {
        
ClientPrintColorid"!g%s!n Command disabled"PREFIX )
    }
    
    else
    {
        
show_motdidg_szMotd"Top SkillPointers" )
    }
    
    return ( 
get_pcvar_numg_iHideCmds ) == ) ? PLUGIN_CONTINUE PLUGIN_HANDLED_MAIN
}

public 
MakeTop15( )
{
    new 
iLen
    iLen 
formatexg_szMotdcharsmaxg_szMotd ),
    
"<body bgcolor=#A4BED6>\
    <table width=100%% cellpadding=2 cellspacing=0 border=0>\
    <tr align=center bgcolor=#52697B>\
    <th width=4%%>#\
    <th width=30%% align=left>Player\
    <th width=8%%>Kills\
    <th width=8%%>Deaths\
    <th width=8%%>HS\
    <th width=8%%>Knife\
    <th width=8%%>Grenade\
    <th width=8%%>Bombs\
    <th width=8%%>Defuses\
    <th width=10%>SkillPoints" 
)
    
    new Array:
aKey ArrayCreate35 )
    new Array:
aData ArrayCreate128 )
    new Array:
aAll ArrayCreateFvaultData )
    
    
fvault_loadg_VaultSkillPointsaKeyaData )
    
    new 
iArraySize ArraySizeaKey )
    
    new 
DataFvaultData ]
    
    new 
i
    
for( 0iArraySizei++ )
    {
        
ArrayGetStringaKeyiDataszSteamID ], sizeof DataszSteamID ] - )
        
ArrayGetStringaDataiDataszSkillP_Data ], sizeof DataszSkillP_Data ] - )
        
        
ArrayPushArrayaAllData )
    }
    
    
ArraySortaAll"SortData" )
    
    new 
szPlayerPoints]
    new 
szPlayerLevel]
    
    new 
szPlayerKills]
    new 
szPlayerDeahts]
    new 
szPlayerHeadShots]
    new 
szPlayerKnifeKills]
    new 
szPlayerKnifeDeaths]
    new 
szPlayerGrenadeKills]
    new 
szPlayerGrenadeDeaths]
    new 
szPlayerBombExplosions]
    new 
szPlayerDefusedBombs]
    new 
szPlayerWonRounds]
    
    new 
szName22 ]
    new 
iSize clampiArraySize010 )
    
    new 
j
    
for( 0iSizej++ )
    {
        
ArrayGetArrayaAlljData )
        
        
fvault_get_datag_VaultNamesDataszSteamID ], szNamecharsmaxszName ) )
        
        
replace_allszNamecharsmaxszName ), "<""[" )
        
replace_allszNamecharsmaxszName ), ">""]" )
        
        
parseDataszSkillP_Data ],
        
szPlayerPointscharsmaxszPlayerPoints ),
        
szPlayerLevelcharsmaxszPlayerLevel ),
        
        
szPlayerKillscharsmaxszPlayerKills ),
        
szPlayerDeahtscharsmaxszPlayerDeahts ),
        
szPlayerHeadShotscharsmaxszPlayerHeadShots ),
        
szPlayerKnifeKillscharsmaxszPlayerKnifeKills ),
        
szPlayerKnifeDeathscharsmaxszPlayerKnifeDeaths ),
        
szPlayerGrenadeKillscharsmaxszPlayerGrenadeKills ),
        
szPlayerGrenadeDeathscharsmaxszPlayerGrenadeDeaths ),
        
szPlayerBombExplosionscharsmaxszPlayerBombExplosions ),
        
szPlayerDefusedBombscharsmaxszPlayerDefusedBombs ),
        
szPlayerWonRoundscharsmaxszPlayerWonRounds ) )
        
        
iLen += formatexg_szMotdiLen ], charsmaxg_szMotd ) - iLen"<tr align=center>" )
        
iLen += formatexg_szMotdiLen ], charsmaxg_szMotd ) - iLen"<td>%i")
        
iLen += formatexg_szMotdiLen ], charsmaxg_szMotd ) - iLen"<td align=left>%s"szName )
        
iLen += formatexg_szMotdiLen ], charsmaxg_szMotd ) - iLen"<td>%s"szPlayerKills )
        
iLen += formatexg_szMotdiLen ], charsmaxg_szMotd ) - iLen"<td>%s"szPlayerDeahts )
        
iLen += formatexg_szMotdiLen ], charsmaxg_szMotd ) - iLen"<td>%s"szPlayerHeadShots )
        
iLen += formatexg_szMotdiLen ], charsmaxg_szMotd ) - iLen"<td>%s"szPlayerKnifeKills )
        
iLen += formatexg_szMotdiLen ], charsmaxg_szMotd ) - iLen"<td>%s"szPlayerGrenadeKills )
        
iLen += formatexg_szMotdiLen ], charsmaxg_szMotd ) - iLen"<td>%s"szPlayerBombExplosions )
        
iLen += formatexg_szMotdiLen ], charsmaxg_szMotd ) - iLen"<td>%s"szPlayerDefusedBombs )
        
iLen += formatexg_szMotdiLen ], charsmaxg_szMotd ) - iLen"<td>%s"szPlayerPoints )
    }
    
    
iLen += formatexg_szMotdiLen ], charsmaxg_szMotd ) - iLen"</table></body>" )
    
    
ArrayDestroyaKey )
    
ArrayDestroyaData )
    
ArrayDestroyaAll )
}

public 
SortData( Array:aArrayiItem1iItem2iData[ ], iDataSize )
{
    new 
Data1FvaultData ]
    new 
Data2FvaultData ]
    
    
ArrayGetArrayaArrayiItem1Data1 )
    
ArrayGetArrayaArrayiItem2Data2 )
    
    new 
szPoints_1]
    
parseData1szSkillP_Data ], szPoints_1charsmaxszPoints_1 ) )
    
    new 
szPoints_2]
    
parseData2szSkillP_Data ], szPoints_2charsmaxszPoints_2 ) )
    
    new 
iCount1 str_to_numszPoints_1 )
    new 
iCount2 str_to_numszPoints_2 )
    
    return ( 
iCount1 iCount2 ) ? -: ( ( iCount1 iCount2 ) ? )
}

public 
FwdPlayerSpawnPostid )
{    
    if( 
is_user_aliveid ) )
    {
        
g_iCurrentKillsid ] = 0
        
        
if( get_pcvar_numg_iEnableShowSkillPointsOnNick ) )
        {
            new 
szName32 ]
            
get_user_infoid"name"szNamecharsmaxszName ) )
            
            new 
iLen strlenszName )
            
            new 
iPos iLen 1
            
            
if( szNameiPos ] == '>' )
            {    
                new 
i
                
for( 17i++ )
                {    
                    if( 
szNameiPos ] == '<' )
                    {    
                        
iLen iPos i
                        szName
iLen ] = '^0'
                        
break
                    }
                }
            }
            
            
formatszNameiLen ], charsmaxszName ) - iLenszNameiLen-] == ' ' "<%d>" " <%d>"g_iPointsid ] )    
            
set_user_infoid"name"szName )
        }    
    }
}

public 
MessageSayTextiMsgIDiDestiReceiver )
{
    if( 
get_pcvar_numg_iHideChangeNickNotification ) )
    {    
        new const 
Cstrike_Name_Change[ ] = "#Cstrike_Name_Change"
        
        
new szMessagesizeofCstrike_Name_Change ) + ]
        
get_msg_arg_string2szMessagecharsmaxszMessage ) )
        
        if( 
equalszMessageCstrike_Name_Change ) )
        {
            return 
PLUGIN_HANDLED
        
}
    }
    
    return 
PLUGIN_CONTINUE
}

ClientPrintColoridString[ ], any:... )
{
    new 
szMsg190 ]
    
vformatszMsgcharsmaxszMsg ), String)
    
    
replace_allszMsgcharsmaxszMsg ), "!n""^1" )
    
replace_allszMsgcharsmaxszMsg ), "!t""^3" )
    
replace_allszMsgcharsmaxszMsg ), "!g""^4" )
    
    static 
msgSayText 0
    
static fake_user
    
    
if( !msgSayText )
    {
        
msgSayText get_user_msgid"SayText" )
        
fake_user get_maxplayers( ) + 1
    
}
    
    
message_beginid MSG_ONE_UNRELIABLE MSG_BROADCASTmsgSayText_id )
    
write_byteid id fake_user )
    
write_stringszMsg )
    
message_end( )

Fonte: https://forums.alliedmods.net/showthread.php?t=191708

How can I calculate the total kills (g_iKills)?
Tripaloski is offline
leonardo121
Member
Join Date: Sep 2013
Old 07-26-2017 , 16:43   Re: Fvault
Reply With Quote #2

what do you mean with "calculate" ?
few information!
leonardo121 is offline
Tripaloski
Member
Join Date: Jul 2017
Old 07-26-2017 , 16:49   Re: Fvault
Reply With Quote #3

Collect all data from g_iKills.
For example:
Player1 has 8 g_iKills
Player2 has 35 g_iKills
Player3 has 300 g_iKills
Player4 has 55 g_iKills
Player5 has 78 g_iKills
Total g_iKills = 476
I wanted to calculate the sum total of all g_iKills records
Tripaloski is offline
Tripaloski
Member
Join Date: Jul 2017
Old 07-26-2017 , 16:52   Re: Fvault
Reply With Quote #4

-----------------------------------------

Last edited by Tripaloski; 07-26-2017 at 17:01.
Tripaloski is offline
leonardo121
Member
Join Date: Sep 2013
Old 07-26-2017 , 17:05   Re: Fvault
Reply With Quote #5

this ?

PHP Code:
new sum;

// sizeof(g_iKills) ??
for(new xMAX_PLAYERSx++)
{
    for(new 
isizeof(g_iKills); i++)
    {
         
sum += g_iKills][ ];
    }


Last edited by leonardo121; 07-26-2017 at 17:08.
leonardo121 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 17:45.


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