Raised This Month: $ Target: $400
 0% 

Plugin Fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phantom Warrior
BANNED
Join Date: Feb 2007
Location: hello, gaben
Old 02-11-2007 , 00:47   Re: Plugin Fix
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fakemeta>
 
#define AUTHOR "Chris"
#define VERSION "1.0"
#define PLUGIN "Permanent Kills/Deaths"

 
new const SAVE_FILE[] = "KillsDeaths";
new 
Vault;
 
public 
plugin_init()
{
    
register_plugin("Permanent Kills/Deaths"VERSION"Chris");
}
 
public 
client_putinserver(id)
{
    
LoadData(id);
    return 
PLUGIN_HANDLED;    
}
 
public 
client_disconnect(id)
{
    
SaveData(id);
    return 
PLUGIN_HANDLED;
}
 
GetSaveKey(idKey[])
{
static 
AuthId[32];
get_user_authid(id,AuthId,32);
format(Key63,"%s",AuthId);
}
 
public 
plugin_end()
{
new 
iPlayers[32],iNum;
for(new 
i=0;i<iNum;i++)
{
    
SaveData(iPlayers[i]);

 
return 
PLUGIN_HANDLED;
}
 
SaveData(id)
{
Vault nvault_open(SAVE_FILE);
 
if(
Vault == INVALID_HANDLE)
{
log_amx("Error opening nVault file: %s"SAVE_FILE);
return 
PLUGIN_HANDLED;
}
 
static 
Key[64], Data[30];
new 
sKills[15],sDeaths[15];
new 
TimeStamp;
 
if(
nvault_lookup(VaultKeyData29TimeStamp))
{
parse(Data,sKills,14,sDeaths,14);
}
 
new 
Kills str_to_num(sKills)
new 
Deaths str_to_num(sDeaths)
 
Kills += pev(idpev_frags); //problem
Deaths += get_user_deaths(id); //problem
 
GetSaveKey(id,Key);
 
format(Data29,"%i %i"KillsDeaths);
 
nvault_set(VaultKeyData);        
 
nvault_close(Vault);
 
return 
PLUGIN_HANDLED;
}
 
LoadData(id)
{
Vault nvault_open(SAVE_FILE);
 
if(
Vault == INVALID_HANDLE)
{
log_amx("Error opening nVault file: %s"SAVE_FILE);
return 
PLUGIN_HANDLED;
}
 
static 
Key[64], Data[30];
new 
TimeStamp;
 
GetSaveKey(id,Key);
 
if(
nvault_lookup(VaultKeyData29TimeStamp))
{
new 
sKills[15],sDeaths[15];
parse(Data,sKills,14,sDeaths,14);
 
set_pev(idpev_fragsstr_to_float(sKills));
set_pdata_int(id290str_to_num(sDeaths));
}
nvault_close(Vault);
 
return 
PLUGIN_HANDLED;

Phantom Warrior 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 00:37.


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