penalty fine for companies - send company info to clients

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
dihedral
Tycoon
Tycoon
Posts: 1053
Joined: 14 Feb 2007 17:48

penalty fine for companies - send company info to clients

Post 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
Attachments
fine_company.patch
patch agains svn://svn.openttd.org/tags/0.5.0RC5
(2.28 KiB) Downloaded 121 times
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post 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.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 50 guests