Page 1 of 1

penalty fine for companies - send company info to clients

Posted: 14 Feb 2007 18:00
by dihedral
Hi there,

as misbehaving players can be kicked or banned - it might not always be positive to the actual gameplay, and does not shed the brightest light on the admin (in some occasions at least)

so i started writing a little function which would fine that company a certain percentage of the current p->money64 value

the only problem i am having now is getting this information out to already connected clients. it is no problem if the clients disconnect and reconnect - they then automatically get the new information. but i need the information to propagate while clients are connected.

btw. the fine is charged to EXPENSES_OTHER
it is not finished so i have not spent time on wording the output messages - personally i would prefer though if a message was broadcasted to all clients e.g. "company <company_name> fined with <cost> for <reason>"

<reason has not been added yet. currently the command 'fine' takes 2 params, <company_id> and <fine_percent>
<cost> is the actual value that will be deducted from the companies money.

there will also be a checking to only allow a certain maximum percentage.

if somebody could tell me how i can get this data propagated to all currently connected clients - that would be great.

ps: money goes nowwhere - just to make it clear - the idea behind this is not to give money to somebody else. just to loose it :-P :?: :?:

pps: the patch is against svn://svn.openttd.org/tags/0.5.0RC5

Posted: 14 Feb 2007 18:15
by Darkvater
You can simply make this into a CMD_ which I think you already did. Then in the command list you can make this a server-only command (look at CMD_PAUSE as a reference) and implement a console command (again, server only) that does this.

Everything else is peanuts.

In the console command you can send out an administrative chat message with SendNetworkMessage() that'll be read by all players.