Author Topic: Whats an argument? What should I replace argument with in this console command?  (Read 683 times)

/title
Also, the console command I need help on: (Read title)
schedule(30000,0,clearspam(),argument);
All help is appreciated. Thanks!

Code: [Select]
function serverstuff(%client)
{
  //Do stuff
}

the %client is the argument.

EDIT;

Also, this could have gone in your other thread on calling functions, as it has something related to it, just to let you know

Code: [Select]
function serverstuff(%client)
{
  //Do stuff
}

the %client is the argument.

EDIT;

Also, this could have gone in your other thread on calling functions, as it has something related to it, just to let you know
I'm making the schedule command work with this command:
commandtoserver('clearspambricks',"");
Does the function HAVE to have %client in it? (Or, is %client just a variable that I can change?)

I'm making the schedule command work with this command:
commandtoserver('clearspambricks',"");
Does the function HAVE to have %client in it? (Or, is %client just a variable that I can change?)


The variable name can be whatever name you want. But the variable must contain an actual client in this case.

Someone should write a good sized tutorial just on passing arguments to functions, how it's done, and how it works.
Over my experience of being a C++ tutor for my school, casual helping someone in class, and these forums, it seems to be one specific issue that stands out in particular.


As far as the OP question goes, an argument (you may also hear them called parameters) is what you give to a function to have it do stuff with. It's what's between the parenthesis is a function declaration:
function someFunction(%arg1,%arg2)
{
    //stuff
}

and a function call:
someFunction(%a,%b);
Note that the names doesn't need to match up.

As for the schedule call, take the parenthesis off of clearspam(). As far as the arguments go, I can't help you because clearspam is not a default function. If you could post the start of the function declaration, the first line, function functionName(arguments) (I forgot the actual term for this) I could tell you.
« Last Edit: October 11, 2012, 11:43:51 PM by Headcrab Zombie »

From my website that I haven't finished. It could help him though it doesn't go REAL deep into arguments and is supposed to be newb friendly but oh well.