Raised This Month: $ Target: $400
 0% 

Plugin Fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kmal2t
BANNED
Join Date: Apr 2006
Old 02-09-2007 , 00:00   Plugin Fix
Reply With Quote #1

See last post

Last edited by kmal2t; 02-14-2007 at 22:22.
kmal2t is offline
Old 02-10-2007, 21:25
kmal2t
This message has been deleted by kmal2t.
Phantom Warrior
BANNED
Join Date: Feb 2007
Location: hello, gaben
Old 02-11-2007 , 00:47   Re: Plugin Fix
Reply With Quote #3

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
Old 02-11-2007, 00:58
kmal2t
This message has been deleted by kmal2t.
Phantom Warrior
BANNED
Join Date: Feb 2007
Location: hello, gaben
Old 02-11-2007 , 09:49   Re: Plugin Fix
Reply With Quote #5

Pffh, learn to read? And yeah thanks for -Karma.

I did change stuff.
You needed amxmisc.
You needed [32] not [31]
You needed a } not a {
You needed space not a ).
Thank you.
Phantom Warrior is offline
kmal2t
BANNED
Join Date: Apr 2006
Old 02-11-2007 , 23:31   Re: Plugin Fix
Reply With Quote #6

I didn't give you -karma.

Last edited by kmal2t; 02-14-2007 at 22:21.
kmal2t is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 02-12-2007 , 00:01   Re: Plugin Fix
Reply With Quote #7

The code below will save every time a client kills another client. That should simplify things for you.

Code:
/* Permanent Kills/Deaths v.1.0 by Chris/Unbonami <[email protected]> 17 Jan. 2007 This plugin saves the Kills and Deaths for each user(by steamid and mapname) When he gets on the same map again his Kills and Deaths are loaded. Possibles bugs: Kills or Deaths larger than an integer/float ? */ #include <amxmodx> #include <nvault> #include <fakemeta> #define VERSION "1.0" new const SAVE_FILE[] = "KillsDeaths"; new Vault; public plugin_init() {     register_plugin("Permanent Kills/Deaths", VERSION, "Chris");     register_event("DeathMsg", "Event_DeathMsg", "a", "1>0") } public Event_DeathMsg() {     new Killer = read_data(1)     new Victim = read_data(2)         SaveData(Killer)         if(Killer != Victim)     {         SaveData(Victim)     } } public client_putinserver(id) {     LoadData(id);     return PLUGIN_HANDLED;     } public client_disconnect(id) {     SaveData(id);     return PLUGIN_HANDLED; } stock GetSaveKey(id, Key[64]) {     static AuthId[33];     get_user_authid(id,AuthId,32);     format(Key, 63,"%s",AuthId); } public plugin_end() {     new iPlayers[32],iNum;     for(new i=0;i<iNum;i++)     {         SaveData(iPlayers[i]);     }         return PLUGIN_HANDLED; } public 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 Kills = pev(id, pev_frags)     new Deaths = get_user_deaths(id)         GetSaveKey(id,Key);         format(Data, 29,"%i %i", Kills, Deaths);         nvault_set(Vault, Key, Data);                 nvault_close(Vault);         return PLUGIN_HANDLED; } public 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(Vault, Key, Data, 29, TimeStamp))     {         new sKills[15],sDeaths[15];         parse(Data,sKills,14,sDeaths,14);                 set_pev(id, pev_frags, str_to_float(sKills));         set_pdata_int(id, 290, str_to_num(sDeaths));     }     nvault_close(Vault);         return PLUGIN_HANDLED; }
stupok is offline
kmal2t
BANNED
Join Date: Apr 2006
Old 02-12-2007 , 00:50   Re: Plugin Fix
Reply With Quote #8

That unfortuantely doens't solve the problem of an sv_restart or the like being used and overwriting people's score.

Could you maybe write in a thing that if the commands sv_restart, sv_restartround, quit, restart, or kill etc are used it backs up the scores and sets everyone's again so they don't lose theirs?

Unfortunately a server shutdown or restart doesn't use any HL command so I have no idea if that would fuck up scores too :\ I'd just have to be careful to do it when no one is in the server.
kmal2t is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 02-12-2007 , 01:13   Re: Plugin Fix
Reply With Quote #9

Doh! The code I posted will not solve your problem. However, I will post tomorrow with a solution.
stupok is offline
Old 02-12-2007, 01:15
kmal2t
This message has been deleted by kmal2t.
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