Raised This Month: $ Target: $400
 0% 

how to pass someone's id to another function?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rolnaaba
Veteran Member
Join Date: May 2006
Old 10-17-2006 , 10:04   how to pass someone's id to another function?
Reply With Quote #1

if I had this function:
Code:
public function(id) { //want this (id) to pass to next function //blah blah }

could I use set_task to pass this id to another function and if so how?
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 10-17-2006 , 10:05   Re: how to pass someone's id to another function?
Reply With Quote #2

Code:
public funtion(id) {     function2(id); } function2( id ) {   // id got passed }
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
Rolnaaba
Veteran Member
Join Date: May 2006
Old 10-17-2006 , 10:06   Re: how to pass someone's id to another function?
Reply With Quote #3

ahh so simple, but I want a delay to occur before that second function is executed, specifically five seconds, and the only way I know to do this is set_task is there another, and if set_task is the only way how can I pass id through set_task?
__________________
DO NOT PM me about avp mod.

Last edited by Rolnaaba; 10-17-2006 at 10:13.
Rolnaaba is offline
umarsa
Senior Member
Join Date: Feb 2006
Location: U.K
Old 10-17-2006 , 10:19   Re: how to pass someone's id to another function?
Reply With Quote #4

set_task()
__________________
umarsa is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 10-17-2006 , 10:21   Re: how to pass someone's id to another function?
Reply With Quote #5

how do I pass an id through set task is my question
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
umarsa
Senior Member
Join Date: Feb 2006
Location: U.K
Old 10-17-2006 , 10:24   Re: how to pass someone's id to another function?
Reply With Quote #6

i think..

1st of all the set_task :

set_task(Float:time,const function[],id = 0,parameter[]="",len = 0,flags[]="", repeat = 0)

ok.

public funtion(id)
{
function2(id);
set_task here

function2( id )
{
// id got passed
}

i dont have my amxx studio atm so im not sure nort tested
__________________
umarsa is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 10-17-2006 , 10:25   Re: how to pass someone's id to another function?
Reply With Quote #7

that would make the func execute before set_task is even looked at that makes no sense
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 10-17-2006 , 11:02   Re: how to pass someone's id to another function?
Reply With Quote #8

PHP Code:
public func1(id)
{
        new 
parm[1]
        
param[0] = id
        set_task
(5.0,"func2",0,parm,1)
}
 
public 
func2(parm[])
{
       
id parm[0]

thanks to Emp`!
wonsae is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 10-17-2006 , 11:05   Re: how to pass someone's id to another function?
Reply With Quote #9

awesome you rock wonsae ty ty -karma fo joo
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-17-2006 , 15:02   Re: how to pass someone's id to another function?
Reply With Quote #10

If you want, you can pass the player id as the task id. If no extra parameters are set, then the task id will be passed to the function. Example:

Code:
public function1(id) {      set_task(5.0,"function2",id); } public function2(id) {      // id in function2 is the same as in function1 }

But if you plan to have multiple tasks and also use the other task functions (change_task, task_exists, remove_task), then you should use unique task ids and instead pass the player id the way that wonsae showed you.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Reply



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 04:48.


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