Raised This Month: $ Target: $400
 0% 

Fvault code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 04-16-2013 , 06:26   Fvault code
Reply With Quote #1

What does this code do.
And when can you use it?

i didnt found anything about it

Code:
// Pruning player agree/decline after 15 days of not being updated

// 15 days * 24 hours * 60 minutes * 60 seconds = 15 days in seconds
new end_prune_time = get_systime() - (15 * 24 * 60 * 60);

fvault_prune("player_agree", _, end_prune_time);
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-16-2013 , 07:15   Re: Fvault code
Reply With Quote #2

It checks the time stamp of all player_agree entries, and removes them after 15 days. You can use it whenever you want, buy it'll only have the effect if this plugin has been running for more than 15 days.
It could be used in the case that you want players to regularly read and accept the rules, shall they be updated. Or, perhaps if you change the time stamp by touching the entry it could be used to make players read and accept if they haven't p[layed in 15 days. Im not 100% sure since I've never actually used FVault.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 04-16-2013 at 07:17.
hornet is offline
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 04-16-2013 , 09:08   Re: Fvault code
Reply With Quote #3

Quote:
Originally Posted by hornet View Post
It checks the time stamp of all player_agree entries, and removes them after 15 days. You can use it whenever you want, buy it'll only have the effect if this plugin has been running for more than 15 days.
It could be used in the case that you want players to regularly read and accept the rules, shall they be updated. Or, perhaps if you change the time stamp by touching the entry it could be used to make players read and accept if they haven't p[layed in 15 days. Im not 100% sure since I've never actually used FVault.

Okay but what is the best way to do it?

in Vault
or nVault
or fVault
or SQL?
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-16-2013 , 09:17   Re: Fvault code
Reply With Quote #4

You never said what your doing.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 04-16-2013 , 09:40   Re: Fvault code
Reply With Quote #5

Quote:
Originally Posted by hornet View Post
You never said what your doing.
Okay so i need this
When a user joins the server and write /hello a command are executed
and then he needs to wait 24 hours before he can write can write /hello again
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
Podarok
BANNED
Join Date: Jan 2011
Location: Narnia
Old 04-16-2013 , 10:21   Re: Fvault code
Reply With Quote #6

I suggest you using mysql.
Podarok is offline
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 04-16-2013 , 10:28   Re: Fvault code
Reply With Quote #7

I Solved it

i did it with fVault becuse that was easier

Edit: here is the code if anyone needs it
Code:
/*
CODE FROM JUMPSTATS BY EXOLENT EDIT IRONSKILLZ1(SNUSMUMRIKEN)
*/
#include <amxmodx>
#include <fvault>
new cvar_save_prune;
new const g_agree_vault[] = "hello";
new bool:g_agreed[33];
public plugin_init()
{
 
 cvar_save_prune = register_cvar("js_save_prune", "1");  // 1 day
 register_clcmd( "say /hello", "Hello" ); 
  
 Check()
 
}
public Hello(client)
{
 static authid[35];
 get_user_authid(client, authid, sizeof(authid) - 1);
 
 g_agreed[client] = true;
 
 fvault_set_data(g_agree_vault, authid, "1");
}

public client_authorized(client)
{
 if( !is_user_bot(client) )
 {
  static authid[35];
  get_user_authid(client, authid, sizeof(authid) - 1);
  
  if( fvault_get_keynum(g_agree_vault, authid) == -1 )
  {
   g_agreed[client] = false;
  }
  else
  {
   g_agreed[client] = true;
   
  }
 }
}
public Check()
{
 static bool:bAlreadyExecuted;
 if( !bAlreadyExecuted )
 {
  new iDays = get_pcvar_num( cvar_save_prune );
  if( iDays )
  {
   fvault_prune( g_agree_vault, _, get_systime( ) - ( iDays * 60 * 60 ) );
  }
  
  bAlreadyExecuted = true;
 }
}
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.

Last edited by ironskillz1; 04-16-2013 at 11:11.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 04-16-2013 , 17:23   Re: Fvault code
Reply With Quote #8

plugin_init is called once a map. You don't need this bool -> bAlreadyExecuted

You can use fvault_get_data instead of fvault_get_keynum

This,

PHP Code:
fvault_pruneg_agree_vault_get_systime( ) - ( iDays 60 60 ) ); 
Should be,

PHP Code:
fvault_pruneg_agree_vault_get_systime( ) - ( iDays 24 60 60 ) ); 
guipatinador 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 10:51.


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