Raised This Month: $ Target: $400
 0% 

[Solved] Save


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 05-18-2009 , 12:58   [Solved] Save
Reply With Quote #1

[Solved]

PHP Code:
public Save(id)
{
 if(
get_pcvar_num(g_pSaveXP) == 0)
 {
  return 
PLUGIN_HANDLED;
 }
 else
 {
  new 
Float:time_left;
  new 
Float:current_time;
 
  
current_time get_gametime();
  
time_left current_time last_save[id];
 
  if(
time_left SAVE_SPAM)
  {
   
client_print(idprint_chat"[%s] You must wait %0.1f seconds before saving again."PLUGIN_TAGSAVE_SPAM-time_left);
   return 
false;
  }
  else
  {
   
SaveData(id);
   
client_print(idprint_chat"[%s] Your points was saved."PLUGIN_TAG)
   
last_save[id] = 1
   
return true;
  }  
 }
 return 
false;

I made a function, as you see above.. to save a player points..
But when the time runs out.. the 60 secs that is defined with SAVE_SPAM, the player can spam save, which will result in lag.

How can I fix this?
__________________
Achievements API - a simple way for you to create your OWN custom achievements!

Last edited by Xellath; 05-18-2009 at 15:02.
Xellath is offline
 


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 01:25.


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