Raised This Month: $ Target: $400
 0% 

Problems with BOTs not shooting [SOLVED]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rul4
Senior Member
Join Date: Sep 2008
Location: Argentina
Old 10-09-2008 , 10:15   Problems with BOTs not shooting [SOLVED]
Reply With Quote #1

Hi, I am making a Paintball plugin and replacing weapons with paintball weapons (meaning: I forbid them from firing bullets and instead I create entities that look like pellets).

I am catching the player pre think and asking if he is attacking in order to shoot a new pellet into something like this:

PHP Code:
//in the plugin_init
register_forward(FM_PlayerPreThink"fw_playerprethink"1);

//the function looks like
public fw_playerprethink(id)
{
new 
buttons pev(idpev_button);
        if (
buttons IN_ATTACK)
        { 
//do something to shoot a pellet 
It works fine for real players, but Bots don't shoot.

Any ideas?

Thanks in advance.
Rul4.

PS: I am using PodBots, but I tried with other bots and the same thing happens.

Last edited by Rul4; 10-10-2008 at 14:41.
Rul4 is offline
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 10-10-2008 , 12:36   Re: Problems with BOTs not shooting
Reply With Quote #2

Code:
engfunc(EngFunc_RunPlayerMove, id, Float:{0.0,0.0,0.0}, 0.0, 0.0, 0.0, 0, 0, 0)
Your interested in the 3rd value from the end.

Hopefully it won't damage the bot api too much
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd
Orangutanz is offline
Rul4
Senior Member
Join Date: Sep 2008
Location: Argentina
Old 10-10-2008 , 12:46   Re: Problems with BOTs not shooting
Reply With Quote #3

Quote:
Originally Posted by Orangutanz View Post
Code:
engfunc(EngFunc_RunPlayerMove, id, Float:{0.0,0.0,0.0}, 0.0, 0.0, 0.0, 0, 0, 0)
Your interested in the 3rd value from the end.

Hopefully it won't damage the bot api too much
Sorry, what should I do with it? Replace the pev(id, pev_button)?

Thanks!
Rul4.
Rul4 is offline
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 10-10-2008 , 13:03   Re: Problems with BOTs not shooting
Reply With Quote #4

Yeah don't forget to check for is_user_bot 1st since this method is only for bots!

The following will force the bot to shoot.
Code:
engfunc(EngFunc_RunPlayerMove, id, Float:{0.0,0.0,0.0}, 0.0, 0.0, 0.0, IN_ATTACK, 0, 0)

If your trying to detect if a bot is shooting you should hook FM_CmdStart not FM_PlayerPreThink, this method works for both players/bots.

Code:
public plugin_init()     register_forward( FM_CmdStart, "CmdStart" ) } public CmdStart( id, uc_handle, random_seed ) {     if ( !is_user_alive( id ) )         return FMRES_IGNORED         static buttons; buttons = get_uc( uc_handle, UC_Buttons )     if ( buttons & IN_ATTACK )     {         // Do something here     }     return FMRES_IGNORED }
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd

Last edited by Orangutanz; 10-10-2008 at 13:06.
Orangutanz is offline
Rul4
Senior Member
Join Date: Sep 2008
Location: Argentina
Old 10-10-2008 , 14:35   Re: Problems with BOTs not shooting
Reply With Quote #5

Quote:
Originally Posted by Orangutanz View Post

If your trying to detect if a bot is shooting you should hook FM_CmdStart not FM_PlayerPreThink, this method works for both players/bots.
You ROCK, man!!!!! It worked!

Thanks a lot!
+KARMA
Rul4 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:08.


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