[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(id, print_chat, "[%s] You must wait %0.1f seconds before saving again.", PLUGIN_TAG, SAVE_SPAM-time_left);
return false;
}
else
{
SaveData(id);
client_print(id, print_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?
__________________