Blockland Forums > Modification Help
Will this work?
wizzlemanizzle:
--- Quote ---Now that you have the serverCmd following the correct pattern, your assign a value to variable %client inside your function. While torque doesnt care if you do this, other languages will, and since you said your just learning, its a good idea to start learning good ways of coding.
So with that - you need to change: %client = clientGroup.getObject(%i);
to use something other than %client. try: %obj or %cl or something.
--- End quote ---
what are you saying here? are you telling me NOT to use % client as what i query the server for? the cliet is what i need to affect later on i am pretty sure
Red_Guy:
--- Quote from: wizzlemanizzle on March 28, 2011, 08:16:49 PM ---what are you saying here? are you telling me NOT to use % client as what i query the server for? the cliet is what i need to affect later on i am pretty sure
--- End quote ---
you dont have to change the name of the variable -- its just a good idea.
you can also call it anything you want. The pattern is do to this:
function serverCmdSomething(%client)
{
if (%client.isAdmin)
... do stuff ...
messageClient(%client, '', "Stuff");
... do stuff ...
}
now this pattern will work:
function serverCmdSomething(%client)
{
%client = <something> ;
if (%client.isAdmin)
... do stuff ...
%client = <somethingElse>;
messageClient(%client, '', "Stuff");
... do stuff ...
}
but its a really bad habit to get into.
Try something like this:
for (%i = 0; %i < clientGroup.getCount(); %i++)
{
%cl = clientGroup.getObject(%i);
if(%cl.isAdmin || %cl.isSuperAdmin || %cl.isHost)
wizzlemanizzle:
Red Guy? you still havent answered my other question...
Placid:
--- Quote from: wizzlemanizzle on March 28, 2011, 08:14:41 PM ---oh alright
i would like to know the command to disconnect a player from the server. would it be
%client.disconnect();?
or what? also...
--- End quote ---
%client.delete();
make sure you don't do a %client.player.delete(); as this will glitch players out
also, next time you want to find something like this function out:
1. go into console
2. type trace(1);
3. perform the action that you want to find the function for
4. go back to console and as quickly as possible, type trace(0);
5. look up in console log and see which function lines match the function you're trying to find
suggestion: do it in single player, so you won't get all the stuff for connections and such
wizzlemanizzle:
thanks again placid
you are a lifesaver
keeping this open for now incase i need something else