AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   passing ids thru set_task (https://forums.alliedmods.net/showthread.php?t=45991)

wonsae 10-15-2006 22:51

passing ids thru set_task
 
How would I pass a targetid and id using set_task or a different way
PHP Code:

public item_carbomb(){
    new 
arg[33], caridcaridFloat:origin[3], tauthid[64], enttid
    read_argv
(1,arg,32)
    
id str_to_num(arg)
    
    
ent entity_get_vector(id,EV_VEC_origin,origin);
    
tid get_id_by_steamid(tauthid)
    
get_user_aiming(id,carid,car,100)
    if(
carid == ent)
    {
        
client_print(id,print_chat,"[CarMod] You're setting up the bomb....")
        
setbomb(id,tid)
        return 
PLUGIN_HANDLED
    
}
    else
    {
        
client_print(id,print_chat,"[CarMod] You need to be near a car.")
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED
}

public 
setbomb(id,tid)
{
    
client_print(id,print_chat,"[CarMod] You set up the bomb!")
    
hasbomb[tid] += 1
    
return PLUGIN_HANDLED


I want it to wait like 10 seconds before it sets up the bomb.

Emp` 10-15-2006 23:29

Re: passing ids thru set_task
 
Code:

your_function()
{
  //you have stuff here
  new parm[2]
  parm[0] = id
  parm[1] = tid
  set_task(10.0,"setbomb",0,parm,2)
}
public setbomb(parm[])
{
    new id = parm[0]
    new tid = parm[1]

    client_print(id,print_chat,"[CarMod] You set up the bomb!")
    hasbomb[tid] += 1
    return PLUGIN_HANDLED
}


wonsae 10-16-2006 06:56

Re: passing ids thru set_task
 
thanks, I'll try it


All times are GMT -4. The time now is 04:56.

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