AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Bot Apology for TK (https://forums.alliedmods.net/showthread.php?t=85581)

Vet 02-23-2009 10:53

Re: Bot Apology for TK
 
FYI, we run this plugin on our server and it appears to do the job quite well.

Programming wise, like I always say, there's many ways to skin a cat (I prefer pliers). So unless the code is in a critical routine (like a prethink), 'to each his own'.

fysiks 02-23-2009 11:07

Re: Bot Apology for TK
 
Apparently you have not run my plugin with bots yet. :). I guaruntee it will work on DOD with Shrikebot. It's running on a public server right now.

Ham :::
I had a bit of trouble with Ham. I was required to check a alot more stuff (maybe not alot, but enough to be annoying). I was getting killerids like 59, 639, 520, . . . (59 is electric ally on dod_caen). If you are saying Ham is quicker to the draw, it doesn't matter, the response is delayed anyways. Also, if it can be done with only one include and I don't need to do anything like supercede this way is great afaik.

is_user_bot(id) :::
Go back and read arkshine's comments. (minimize native calls)

Random :::
No. For the phrases I want random (just plain random, well, pseudorandom :)).

chance(prob) :::

chance(100) returns true 100% of the time.
chance(50) returns true 50% of the time (statistically).
chance(1) returns true 1% of the time (statistically).
chance(0) returns true 0% of the time (i.e. always returns false.)

engclient_cmd() :::

You can't send a client command to a bot (i.e. can't use client_cmd) afaik. engclient_cmd sends a command to the server as if it is coming from the client and it works great!

Why would I use a case structure if I can just assign a variable and pass that variable to the command?

Quote:

overall i think you make it way more complicated then it have to be...
As far as I'm concerned this code is very simple (Once I got things straightened out).

Quote:

Did that bot just apologiz to me?

Meathead~MBG~ 03-01-2009 01:41

Re: Bot Apology for TK
 
That would be my server. Working fine.

From HLSW
Quote:

(Allies) Pvt.*LiTTleKings : sory
(Allies) Pvt.*LiTTleKings : sory
(Allies) Pvt.*naTurAlliGht : sorry
( Axis) Pvt.*mOOsEheaD : sorry
(Allies) Pvt.*naTurAlliGht : sorry!
(Allies) Pvt.*CaN : sry
( Axis) Pvt.*BoTTle : sry!
( Axis) Pvt.*st.paulyGURL : sry
(Allies) Pvt.*HEINEken : oops sorry
( Axis) Pvt.*BoTTle : sry
( Axis) Pvt.*sChLitZ : sory
(Allies) Pvt.*KEGGER : oops sorry
( Axis) Pvt.*sChLitZ : sorry!
(Allies) Pvt.*KEGGER : sory

Exolent[jNr] 03-29-2009 15:34

Re: Bot Apology for TK
 
1. Would be better to have a .ini file so they could put their own apology messages.

2.
Code:
new chat_method[9] // chat_method = chance(get_pcvar_num(cvar_chat_method)) ? "say_team" : "say"; // Does not work :(; runtime error 5:memory access; line 90,72 if(chance(get_pcvar_num(cvar_chat_method))) // Is it said in public or team chat? {   chat_method = "say_team"; } else {   chat_method = "say"; }
Use copy() instead.

3.
Code:
// Given the probability, does it happen? bool:chance(probability) {     // return ( clamp(probability,0,100) > random_num(0,99) )     return ( probability > random_num(0,99) )  // Faster without pointless native call. }
If it is something like this that can be made with one line, it's better to make it a define and place it at the top of the plugin.
Also, random numbers should be 1-100
Code:
#define chance(%1) ( probability >= random_num(1, 100) )

Approval pending upon changes.

fysiks 03-29-2009 15:56

Re: Bot Apology for TK
 
I greatly appreciate your input.

ini file: Should I use dynamic arrays for retrieving the apology messages or should I hard code a cap (max) (with a #define probably)?

Chance: If using '>=' you must use 1-100 but if using only the '>' 0-99 is correct.

I'll get to work on this.

Exolent[jNr] 03-29-2009 15:59

Re: Bot Apology for TK
 
I would suggest dynamic arrays, but it's however you wish.

As for the chance calculation, you are correct. I just use 1-100 because it's more readable.

fysiks 03-29-2009 16:56

Re: Bot Apology for TK
 
Updated. Let me know if I can improve it anymore. I will look into using dynamic arrays for phrases sometime in the near future.

I have a max of 10 phrases (this can be changed in the code: "SORRYS_MAX").

Thanks everybody.

joaquimandrade 03-29-2009 18:19

Re: Bot Apology for TK
 
Quote:

Originally Posted by fysiks (Post 792649)
Updated. Let me know if I can improve it anymore. I will look into using dynamic arrays for phrases sometime in the near future.

I have a max or 10 phrases (this can be changed in the code: "SORRYS_MAX").

Thanks everybody.

Congratulations fysiks.

Vet 03-29-2009 21:54

Re: Bot Apology for TK
 
GJ my man

fysiks 03-30-2009 19:06

Re: Bot Apology for TK
 
Wahooo! Thanks guys.


All times are GMT -4. The time now is 17:12.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.