Raised This Month: $51 Target: $400
 12% 

How to pass 2 arguements to a timered method?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Casio
Member
Join Date: Jan 2005
Old 07-09-2006 , 20:59   How to pass 2 arguements to a timered method?
Reply With Quote #1

What I want to do is simple, however putting it into practise is not (at least it isn't easy for me (I'm self-taught btw).

I wish to have a method (it's invocation is irrelevant) that will get the id and authid of the calling player, then 1 minute later, pass those 2 pieces of data to another method.

This is my current attempt:

Code:
...

public one ( id ) {

	//2-dim array intended to store "id" and "authid" seperately
	new var[2][32]

	format(var[0], 31, "%d", id)

	get_user_authid(id, var[1], 31)

	set_task(60.0, "two", _, var, 2)
}

public two ( param[2][32] )
	client_print(0, print_chat, "0 = %s, 1 = %s", param[0], param[1])
I keep getting this error:


Welcome to the AMX Mod X 1.70-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team

Error: Array dimensions do not match on line 28

1 Error.
Could not locate output file C:\1.amx (compile failed).


and it points to this line:

Code:
set_task(60.0, "two", _, var, 2)
I realise I could code this by:

1) Storing the id and authid into 2 global variables and have the second method access those global variables 1 minute later.

OR

2) Add the id, a wierd character and the authid to one string so it would appear as:

1*Steam_0:0:999999

and then ofcourse pass it to the second method where the 2 pieces of data would be seperated.

I know what I want can be done, I just want it done the way I am asking about.

Please can anyone help?

Eternal thanks,
Casio.
Casio is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-09-2006 , 21:15   Re: How to pass 2 arguements to a timered method?
Reply With Quote #2

What you can do is this:

Code:
... public one ( id ) {     //2-dim array intended to store "id" and "authid" seperately     new var[34]     get_user_authid(id, var, 32)         var[33] = id     set_task(60.0, "two", _, var, 34) } public two ( param[34] )     client_print(0, print_chat, "0 = %s, 1 = %i", param, param[33])
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Casio
Member
Join Date: Jan 2005
Old 07-10-2006 , 07:50   Re: How to pass 2 arguements to a timered method?
Reply With Quote #3

Hey thats a good idea and perfect for what I want, cheers!
Casio 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 08:14.


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