AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Ham Touch doesn't work on POD BOT-s :( (https://forums.alliedmods.net/showthread.php?t=89966)

Empowers 04-12-2009 14:22

[SOLVED] Ham Touch doesn't work on POD BOT-s :(
 
I have such a code:
PHP Code:

public plugin_init()  
    
RegisterHam(Ham_Touch,"weapon_c4","fw_TakeBomb")

public 
fw_TakeBomb(weapon_ent,id)
{

    if(
g_BombStatus == BOMB_NOT)
    {
        
g_BombCarrier id
        g_BombStatus 
BOMB_PICKEDUP

        server_print
("%i is New Carrier",id)
    }

    else if(
g_NewRoundRespawn)
    {
        
server_print("BOMB is TRANSFERED TO %i",id)
        
        
SetHamParamEntity(2,g_BombCarrier)

        return 
HAM_HANDLED;
    }

            
    return 
HAM_IGNORED;


With Humans it works perfectly.. But with POD bots
It does't change param here:
PHP Code:

        SetHamParamEntity(2,g_BombCarrier)

        return 
HAM_HANDLED


Any Suggestions?

Exolent[jNr] 04-12-2009 14:26

Re: Ham Touch doesn't work on POD BOT-s :(
 
I can't remember if it is all or some, but some Ham_* don't work with bots.

Empowers 04-12-2009 14:29

Re: Ham Touch doesn't work on POD BOT-s :(
 
Strange There are many Ham hooks in zombie-plague or in gungame.. But POD BOTs work perfectly with this mods.

And also touch hook gets executed always on POD bot-s.. I can see messages in server console, but no result when changing param.

Why?

Bugsy 04-12-2009 15:11

Re: Ham Touch doesn't work on POD BOT-s :(
 
Edit2: Oops sorry, I didn't see you say it works perfect for humans.

Empowers 04-12-2009 15:21

Re: Ham Touch doesn't work on POD BOT-s :(
 
Quote:

I'm 99.9% sure it is a weaponbox while on the ground
No I wanna to hook when c4 is gived by engine,
but not pickuped from the groud..

Here how engine does it:
Code:

Ham_Spawn (weapon_c4, info_player_deathmatch)
Ham_Touch (weapon_c4, player)


ConnorMcLeod 04-12-2009 16:26

Re: Ham Touch doesn't work on POD BOT-s :(
 
The following code works fine with PodBots, means that the problem is somewhere in your code, you may try to supercede the forward and fire another touch.

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Detect c4"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )

new g_iMaxPlayers

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
g_iMaxPlayers get_maxplayers()
    
RegisterHam(Ham_Touch"weapon_c4""C4_Touch")
}

public 
C4_Touch(iEntid)
{
    if( 
IsPlayer(id) )
    {
        
client_print(0print_chat"C4 touched by %d"id)
    }



Empowers 04-13-2009 06:55

Re: Ham Touch doesn't work on POD BOT-s :(
 
Quote:

Originally Posted by ConnorMcLeod (Post 803990)
The following code works fine with PodBots, means that the problem is somewhere in your code

Above I said:
Quote:

And also touch hook gets executed always on POD bot-s.. I can see messages in server console, but no result when changing param.
Quote:

With Humans it works perfectly.. But with POD bots..
so if it works perfectly with humans, then error is not is the code, but somethink with bots
don't U think so?

Quote:

Originally Posted by ConnorMcLeod (Post 803990)
you may try to supercede the forward and fire another touch.

I was trying to supercede it but then touch is stoping at all.. And I wanna just to change param

ConnorMcLeod 04-13-2009 08:32

Re: Ham Touch doesn't work on POD BOT-s :(
 
Quote:

Originally Posted by ConnorMcLeod (Post 803990)
you may try to supercede the forward and fire another touch.

Try to send another touch with the player you want when you supercede the forward.

Empowers 04-13-2009 09:38

Re: Ham Touch doesn't work on POD BOT-s :(
 
Quote:

Originally Posted by ConnorMcLeod (Post 804417)
Try to send another touch with the player you want when you supercede the forward.

Oh that works Thx
+karma

ConnorMcLeod 04-13-2009 09:43

Re: [SOLVED] Ham Touch doesn't work on POD BOT-s :(
 
I was wrong, you don't need to resend, will post the code in few seconds/minutes.

Ok, tested on my listenserver, so 1 represent(=listenserver) my player id, all other players were BOTs.
Gives me the bomb each new round, you just have to make it works with your code.

PHP Code:

/*    Copyright © 2009, ConnorMcLeod

    Detect c4 is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Detect c4; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <cstrike>
#include <engine>
#include <hamsandwich>

#define PLUGIN "Detect c4"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

// #define MAX_PLAYERS    32
#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )

new g_iMaxPlayersgmsgScoreAttrib

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
g_iMaxPlayers get_maxplayers()
    
gmsgScoreAttrib get_user_msgid("ScoreAttrib")
    
RegisterHam(Ham_Touch"weapon_c4""C4_Touch")
}

public 
C4_Touch(iEntid)
{
    if( 
IsPlayer(id) && is_user_bot(id) )
    {
        if( 
is_user_alive(1) )
        {
            
SetHamParamEntity(21)
            
SetPlanter(id0)
            
SetPlanter(11)
        }
    }
}

SetPlanter(idbOnOff)
{
    new 
iFlagsiPlantSkill
    
if( bOnOff )
    {
        
iFlags = (1<<1)
        
iPlantSkill 1
    
}

    
cs_set_user_plant(idiPlantSkill// set player ability to plant the bomb (or not)
    
entity_set_int(idEV_INT_bodyiPlantSkill// draw bomb at player's back (or not)

    
message_begin(MSG_BROADCASTgmsgScoreAttrib// show players as bomb carrier in scoreboard (or not)
    
write_byte(id)
    
write_byte(iFlags)
    
message_end()




All times are GMT -4. The time now is 02:28.

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