AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to pass 2 arguements to a timered method? (https://forums.alliedmods.net/showthread.php?t=41136)

Casio 07-09-2006 20:59

How to pass 2 arguements to a timered method?
 
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.

Hawk552 07-09-2006 21:15

Re: How to pass 2 arguements to a timered method?
 
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])

Casio 07-10-2006 07:50

Re: How to pass 2 arguements to a timered method?
 
Hey thats a good idea and perfect for what I want, cheers! :D


All times are GMT -4. The time now is 08:05.

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