Author Topic: Using a function for multiple clients  (Read 702 times)

I'm trying to edit a CityRPG to have a function that effects all players currently on the server.
I want it to edit the tax amount for all the client's taxes on the server. (I.e 2 players have $10 for taxes, do the command and their taxes raise/lower)
I know the taxes are client sided, so I would need to do...
Code: [Select]
function servercmdchangetaxes(%client, %arg)
{
        %alltheclients = (Something that defines all the clients on the server)
        %alltheclients.brickgroup.taxes += %arg;
}
So, all the client's taxes would raise (%arg). But I have no clue what "Something that defines all the client's on the server" would be!
To tell you the truth, I really not good with most of stuff that involves clients, i'm sorry if i'm missing something obvious.

for(%i = 0; %i <= ClientGroup.getCount(); %i++)
{
   %person = ClientGroup.getObject(%i);
   %person.kill();
}
try something like that, it will loop through everybody i think

To actually answer your question, a client's taxes in a cityRPG are determined by he bricks, so you cannot edit it like that.  But the solution is simpler than you think.  You can just add a little global variable when a client's taxes are being applied in the function where they get paid.  The only function you need to make is one to change that variable.  Otherwise, rewrite the tax system.

I know the taxes are client sided
Not true.  If it was client sided, that means the client gets to edit it for themselves.
« Last Edit: January 20, 2011, 02:21:19 AM by Nexus »

To actually answer your question, a client's taxes in a cityRPG are determined by he bricks, so you cannot edit it like that.  But the solution is simpler than you think.  You can just add a little global variable when a client's taxes are being applied in the function where they get paid.  The only function you need to make is one to change that variable.  Otherwise, rewrite the tax system.
Not true.  If it was client sided, that means the client gets to edit it for themselves.
Eh, we indeed fact tried editing the lot's brick value, unfortunately, the client's bottomprint taxes value never changed. So, I found a new solution, editing the client's taxes in their save. When the client places a brick, the client's
"%client.brickGroup.taxes" Or the client's taxes, increases, So were trying to edit that value that keeps the client's taxes. I think I misunderstood the meaning of "client sided", so I guess I messed up there. But I just used that to define the client's taxes, I hope you know what I mean.

EDIT: Oh yea, I'll take that suggestion/easier way to do it into thinking. Thanks!

And Also thanks, phflack, that helps a lot too!
« Last Edit: January 20, 2011, 05:00:08 PM by computermix »