Thread: set_task
View Single Post
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 09-02-2016 , 03:55   Re: set_task
Reply With Quote #9

Quote:
Originally Posted by Shattered Heart Lynx View Post
Well, with the way you wanted to provide protection there's not really anything else to do, maybe displaying a message to the player that its spawn protection is no longer active?

client_print(id, ... etc etc
Quote:
Originally Posted by HamletEagle View Post
After all, you don't need a task. Simply use get_gametime()
About the substract thing, you set the taskid to id + PROTECTTASK. If in task callback you want to do something with the player index, you can obtain it by substracting -PROTECTTASK, so you get only id. If you don't need the player index in that task, then don't add id to PROTECTTASK and use only that as task index.

PHP Code:
public something(id)
{
     
set_task(..., ..., SomeRandomNumber id)
}

public ...(
TaskIndex)
{
    new 
id TaskIndex SomeRandomNumber

That's basically: SomeRandomNumber + id - SomeRandomNumber = id.
Quote:
Originally Posted by PartialCloning View Post
Code:
public StopSpawnProtection(id) {}


Return values for ham forwards are:
Code:
HAM_IGNORED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;/**< Calls target function, returns normal value */ HAM_HANDLED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;/**< Tells the module you did something, still calls target function and returns normal value */ HAM_OVERRIDE&nbsp;&nbsp;&nbsp;&nbsp;/**< Still calls the target function, but returns whatever is set with SetHamReturn*() */ HAM_SUPERCEDE&nbsp;&nbsp;&nbsp;&nbsp;/**< Block the target call, and use your return value (if applicable) (Set with SetHamReturn*()) */
@Shattered Heart Lynx, that's probably the only thing i could do yes.

@HamletEagle, I'm not really familiar with get_gametime(), although thanks for the explanation, got me further.

@PartialCloning, thanks for reminding, i always forget that >.<
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be