PDA

View Full Version : Bot Apology for TK


Fysiks
02-17-2009, 05:09 PM
Bot Apology for TK

Many servers that I play on have friendly fire turned on and many also "require" an apology for team kills. If you have bots, why not let them set a good example?

Description:
This plugin will make a bot apologize, in chat, for it's team kills.

Cvars:
amx_bot_apology <1|0> - Turn Plugin On or Off.
amx_bot_apology_prob <0-100> - The probability that the bot will apologize for a TK.
amx_bot_apology_method <0-100> - Probability that team chat will be used. (0 -> public, 100 -> team)
amx_bot_apology_delay <#> - The time between the TK and the apology (from last TK if there was another within the delay time of the previous TK).

Latest update available here (http://forums.alliedmods.net/showthread.php?t=85581).

Dr.G
02-18-2009, 06:19 PM
1st off all nice to see new ppl thats jumped in to coding around here, but there are things that i dont understand in your code...

1 - it would be great to have and on and off cvar, so e.g its starting to spam out some message, you can stop it.

2 - the plugin_cfg() part isnt needed, and its not good to lock some pointers, cuz if u do so u will need to restart the server for them to change value.

3 - in the ham_player_death func. you should start by checking if its a bot or not, there are no need to run thru alot of "if's" is its not a bot that did something. and iam not sure that a bot even can get disconnected :)


cheers

Fysiks
02-19-2009, 01:22 AM
1 - it would be great to have and on and off cvar, so e.g its starting to spam out some message, you can stop it.

I thought about that but figured if you didn't want it on you wouldn't install the plugin. But I can put it in there. Why would it start spamming?

2 - the plugin_cfg() part isnt needed, and its not good to lock some pointers, cuz if u do so u will need to restart the server for them to change value.

I figure it's not really a setting that you would be needing to change instantaneously. But I can switch it. I guess, at the time, I was trying to not use so many native calls in the death function. I don't know enough to know if it is significantly slower or not. Also, it would only require a map change.

3 - in the ham_player_death func. you should start by checking if its a bot or not, there are no need to run thru alot of "if's" is its not a bot that did something.

I was told, at AlliedModders, to do non-native checks first but I don't know that I agree. What I told them was that I should check for the most likely case to return true first. I would check for it not being a TK first then check if it's a bot second. But now that I think of it I would check for bots first then tks.

and iam not sure that a bot even can get disconnected :)

If a bot's id is 12 and gets kicked for tking is_user_connected(12) should return false. But then again, if you use max_bots, the bot will be replaced and the new bot will say sorry :).

meathead
02-19-2009, 08:50 AM
Will try it out!

Fysiks
02-19-2009, 04:58 PM
Updated. See Changelog.

Vet
02-20-2009, 09:11 PM
P.S. I was told I was not creative with my phrases by a friend. Change as you please.
lol; How 'bout my favorite... "Sorry, I didn't know it was loaded".

Fysiks
02-20-2009, 09:18 PM
Updated.

lol; How 'bout my favorite... "Sorry, I didn't know it was loaded".

Yeah, but that's a lie everytime! :)

EDIT: Updated to 1.5
EDIT: Updated to 2.0

dannyowan
02-24-2009, 04:12 AM
cool!
bots always tk us xD

Fysiks
04-11-2009, 12:19 AM
I added the use of bot_apology.ini for phrases to be used. It can be found here:

http://forums.alliedmods.net/showthread.php?t=85581