Raised This Month: $ Target: $400
 0% 

put in the plugins <nvault> save system


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jar_09
Senior Member
Join Date: Feb 2011
Old 06-14-2012 , 10:26   put in the plugins <nvault> save system
Reply With Quote #1

...

Last edited by jar_09; 10-17-2012 at 15:25. Reason: .
jar_09 is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-14-2012 , 15:14   Re: put in the plugins <fvault> save system
Reply With Quote #2

Post in suggestions/requests.
Backstabnoob is offline
jar_09
Senior Member
Join Date: Feb 2011
Old 06-18-2012 , 19:05   Re: put in the plugins <fvault> save system
Reply With Quote #3

Quote:
Originally Posted by Backstabnoob View Post
Post in suggestions/requests.
ok

some moderator could move the post to suggestions / requests please.
jar_09 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 06-19-2012 , 09:04   Re: put in the plugins <nvault> save system
Reply With Quote #4

Just the define, or just the bool, floats and array? or both?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
jar_09
Senior Member
Join Date: Feb 2011
Old 06-19-2012 , 10:03   Re: put in the plugins <nvault> save system
Reply With Quote #5

Quote:
Originally Posted by Napoleon_be View Post
Just the define, or just the bool, floats and array? or both?
would both, I want to save is the adr (GetADR (id)) of each player
jar_09 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-19-2012 , 10:24   Re: put in the plugins <nvault> save system
Reply With Quote #6

PHP Code:
#include <amxmodx>
#include <engine>
#include <nvault>
#include <hamsandwich>

#define MAX_PLAYERS 32

new bool:gSpawned[MAX_PLAYERS 1];
new 
Float:gRoundDamage[MAX_PLAYERS 1];
new 
Float:gTotalDamage[MAX_PLAYERS 1];
new 
gRoundsPlayed[MAX_PLAYERS 1];

new 
gMaxPlayers;

#define GetADR(%1) (gTotalDamage[%1] / gRoundsPlayed[%1])

new gVault;

public 
plugin_init() {
    
register_clcmd("say /adr""CmdShowAverage");
    
    
register_event("HLTV""EventNewRound""a""1=0""2=0");
    
    
RegisterHam(Ham_Spawn"player""FwdPlayerSpawnPost"1);
    
RegisterHam(Ham_TakeDamage"player""FwdPlayerDamagePost"1);
    
    
gMaxPlayers get_maxplayers();
    
    
gVault nvault_open("adr_stats");
}

public 
plugin_end() {
    
nvault_close(gVault);
}

public 
client_authorized(id) {
    
    new 
steamID[35];
    
get_user_authid(idsteamIDcharsmax(steamID));
    
    new 
data[64], timestamp;
    if(
nvault_lookup(gVaultsteamIDdatacharsmax(data), timestamp)) {
        new 
roundsPlayed[12];
        
strbreak(dataroundsPlayedcharsmax(roundsPlayed), datacharsmax(data));
        
        
gRoundsPlayed[id] = str_to_num(roundsPlayed);
        
gTotalDamage[id] = str_to_float(data);
    }
}

public 
client_disconnect(id) {
    
gSpawned[id] = false;
    
    new 
steamID[35];
    
get_user_authid(idsteamIDcharsmax(steamID));
    
    new 
data[64];
    
formatex(datacharsmax(data), "%d %f"gRoundsPlayed[id], gTotalDamage[id]);
    
    
nvault_set(gVaultsteamIDdata);
    
    
gRoundDamage[id] = 0.0;
    
gTotalDamage[id] = 0.0;
    
gRoundsPlayed[id] = 0;
}

public 
CmdShowAverage(id) {
    
client_print(idprint_chat"* Your average damage per round is %.1f"GetADR(id));
}

public 
EventNewRound() {
    for(new 
id 1id <= gMaxPlayersid++) {
        if(
gRoundDamage[id] > 0.0) {
            
gTotalDamage[id] += gRoundDamage[id];
            
gRoundDamage[id] = 0.0;
            
            
gRoundsPlayed[id]++;
        }
        else if(
gSpawned[id]) {
            
gRoundsPlayed[id]++;
        }
        
        
gSpawned[id] = false;
    }
}

public 
FwdPlayerSpawnPost(id) {
    if(
is_user_alive(id)) {
        
gSpawned[id] = true;
    }
}

public 
FwdPlayerDamagePost(victiminflictorattackerFloat:damagedamageBits) {
    if(
<= attacker <= gMaxPlayers && attacker != victim) {
        
gRoundDamage[attacker] += entity_get_float(victimEV_FL_dmg_take);
    }

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Old 06-19-2012, 18:44
jar_09
This message has been deleted by jar_09. Reason: .
Old 06-20-2012, 19:52
jar_09
This message has been deleted by YamiKaitou. Reason: wait 14 days until you bump
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 06:08.


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