Raised This Month: $ Target: $400
 0% 

Save user team on disconnect - the best way?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 07-10-2014 , 20:51   Re: Save user team on disconnect - the best way?
Reply With Quote #8

I'm sure you could find this if you tried searching... Try to think a bit, you can get the current time with multiple ways, such as get_systime() (not really optimal, returns unix timestamp) or get_gametime() (which returns the time passed from map start). So obviously, the best way is to store that time somewhere and compare it again later.

PHP Code:
new Float:g_Time


public called_first()
{
    
g_Time get_gametime() + 60.0 // cache it
}

public 
called_later()
{
    if(
g_Time get_gametime())
    {
        
// 60 seconds have passed
    
}

Don't know what you mean by task? If you're using a task for 60 seconds, you can check if it was already completed with task_exists.

PHP Code:
const TASK_ID 159252
set_task
(60.0"TaskFunc"TASK_ID)

if(
task_exists(TASK_ID)) // not yet passed 
Backstabnoob is offline
 



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 21:07.


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