View Single Post
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-20-2009 , 01:58   Re: Bot Apology for TK
Reply With Quote #11

Quote:
Originally Posted by joaquimandrade View Post
random_num(0,99) should be random_num(0,100)
Incorrect. I thought this over hard. Checked my boundaries and I need 99. If I set the cvar to 100 and random_num() returns 100 --> 100 !> 100 and therefore would execute the command even though it should 100% of the time. Also, 0 to 100 is 101 numbers.

If I use "<=" I can use 1 to 100.

Quote:
Originally Posted by arkshine View Post
- g_sorry_phrases <= use const before since it's something constant and don't harcode '6', no need.
Will do.

Quote:
Originally Posted by arkshine View Post
- Since it's for bots, you should not use Ham, if the bot's classname is not "player" it will not work. More appropriate to use DeathMsg event which is perfectly fine.
Once I had a taste of the HamSandwich I crave it all the time . I'll get it switched.

Quote:
Originally Posted by arkshine View Post
- Cache the value of is_user_bot(). Just save it into a var in client_putinserver().
I assume you say this because it will be faster/more efficient?

Quote:
Originally Posted by arkshine View Post
- Doing a check if victim/killer is connected in the death function is useless here.
I was trying to prevent this runtime error: (in case the victim or killer gets disconnected for some reason)
Code:
L 02/20/2009 - 00:37:07: [DODX] Invalid player 15
L 02/20/2009 - 00:37:07: [AMXX] Displaying debug trace (plugin "test.amxx")
L 02/20/2009 - 00:37:07: [AMXX] Run time error 10: native error (native "get_user_team")
Quote:
Originally Posted by arkshine View Post
- set_task ; why did you pass the killer id ? The message will be showed only for the killer and not the victim. I think this message should be showed for all players, so using 0.
It's not a print_chat message. It's emulating the user(bot) saying something in chat. And therefore will be shown to everyone.

Using zero gives this:
Code:
|RIP| Fysiks |mR killed his teammate Sgt.EVILswede with garand
|RIP| Fysiks |mR: sorry
Sgt.Dayglow_abortions: sorry
Sgt.ObiWan: sorry
Sgt.Polymorph: sorry
Sgt.KristineKochanski: sorry
Sgt.QuagaarWarrior: sorry
Sgt.Gilderk_the_Minotaur: sorry
Sgt.EVILcommando: sorry
...
Quote:
Originally Posted by arkshine View Post
- In say_sorry() function, the check for bot is useless ; same for is_user_connected assuming you pass 0, and you engclient_cmd() should be : engclient_cmd(0,"say %s",g_sorry_phrases[random_num(0, sizeof g_sorry_phrases - 1)])
I check if it's a bot because in 3 seconds time (or what ever time set with the cvar) the bot could leave and a real player enters. I don't want the real player to say sorry for that which he has not done.
I check is_user_connected because the bot could leave (and not be replaced) in the time set with the delay cvar.

Also, engclient_cmd deos not work like that. "say" is the command and g_sorry_phrase[#] is arg1.

Quote:
Originally Posted by arkshine View Post
Did you test your plugin ? :s
WOW, that is quite the insult. Yes, why wouldn't I. I would not have posted it if it didn't work, I test my plugins after nearly every change in code I make. It works exactly as I expect it to. Of course I only play DOD so that is what I tested it on.

Last edited by fysiks; 02-20-2009 at 04:11.
fysiks is offline