Raised This Month: $51 Target: $400
 12% 

Automatic func_tanks in Counter Strike


Post New Thread Reply   
 
Thread Tools Display Modes
capostrike93
Veteran Member
Join Date: Feb 2009
Location: adios y??
Old 05-05-2010 , 23:17   Re: Automatic func_tanks in Counter Strike
Reply With Quote #11

Quote:
Originally Posted by AntiBots View Post
Caostrike, you example they will only shoot people with the last index in the Radio.

You understand me?
no, my example does that attack the player closest to the tank ..
by default only attack to team terrorist

#define KILL_ONLYT
__________________
capostrike93 is offline
capostrike93
Veteran Member
Join Date: Feb 2009
Location: adios y??
Old 05-05-2010 , 23:20   Re: Automatic func_tanks in Counter Strike
Reply With Quote #12

Quote:
Originally Posted by joropito View Post
It works using fakemeNta too

(I'm using random 1-32 because I'm too lazy to make it better )

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

public plugin_init()
{
        
register_forward(FM_FindClientInPVS"findclientinpvs")
}

public 
plugin_precache()
{
        
RegisterHam(Ham_Spawn,"func_tank","spawnTank",1)
}

public 
spawnTank(id)
{
        
set_pev(id,pev_spawnflagsSF_TANK_ACTIVE SF_TANK_PLAYER SF_TANK_HUMANS SF_TANK_CANCONTROL SF_TANK_SOUNDON)
        
dllfunc(DLLFunc_Think,id)
}

public 
findclientinpvs(id)
{
        static class[
32]
        if(
pev_valid(id))
        {
                
pev(idpev_classname, class, charsmax(class))
                if(
equal(class, "func_tank"))
                {
                        
forward_return(FMV_CELLrandom_num(132))
                        return 
FMRES_SUPERCEDE
                
}
        }
        return 
FMRES_IGNORED

well, but it is clear that has to verify the integrity of random_num

I mean a. player is alive? check team? other?

and I almost forgot..

add
set_pdata_float(id,41,360.0,4) // For full rotation (360º)

__________________

Last edited by capostrike93; 05-05-2010 at 23:23.
capostrike93 is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 05-06-2010 , 08:33   Re: Automatic func_tanks in Counter Strike
Reply With Quote #13

Quote:
Originally Posted by capostrike93 View Post
well, but it is clear that has to verify the integrity of random_num

I mean a. player is alive? check team? other?
It was just a test the fakemeta alternative. It's just an example.

Quote:
Originally Posted by capostrike93 View Post
set_pdata_float(id,41,360.0,4) // For full rotation (360º)
Only if I need

Btw, I think it's possible to set full rotation using key "yawrange".
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-06-2010 , 08:50   Re: Automatic func_tanks in Counter Strike
Reply With Quote #14

If you want to use the keyvalue, I guess you need to hook the spawn as pre.

Like Quim said, you can get a list of offsets there http://wiki.amxmodx.org/CFuncTank_(CS) ; and you can see the name is enough explicit to understand the keyvalue name related :

Code:
void CFuncTank :: KeyValue( KeyValueData *pkvd )
{
	if (FStrEq(pkvd->szKeyName, "yawrate"))
	{
		m_yawRate = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "yawrange"))
	{
		m_yawRange = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "yawtolerance"))
	{
		m_yawTolerance = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "pitchrange"))
	{
		m_pitchRange = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "pitchrate"))
	{
		m_pitchRate = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "pitchtolerance"))
	{
		m_pitchTolerance = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "firerate"))
	{
		m_fireRate = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "barrel"))
	{
		m_barrelPos.x = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "barrely"))
	{
		m_barrelPos.y = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "barrelz"))
	{
		m_barrelPos.z = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "spritescale"))
	{
		m_spriteScale = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "spritesmoke"))
	{
		m_iszSpriteSmoke = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "spriteflash"))
	{
		m_iszSpriteFlash = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "rotatesound"))
	{
		pev->noise = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "persistence"))
	{
		m_persist = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "bullet"))
	{
		m_bulletType = (TANKBULLET)atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if ( FStrEq(pkvd->szKeyName, "bullet_damage" )) 
	{
		m_iBulletDamage = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "firespread"))
	{
		m_spread = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "minRange"))
	{
		m_minRange = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "maxRange"))
	{
		m_maxRange = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "master"))
	{
		m_iszMaster = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else
		CBaseEntity::KeyValue( pkvd );
}
But I guess it would be more appropriate to work with keyvalue when you can.
__________________
Arkshine is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 05-06-2010 , 11:16   Re: Automatic func_tanks in Counter Strike
Reply With Quote #15

This is awesome, good work. It's amazing how the CS modding capabilities are still growing after all these years.
Seta00 is offline
capostrike93
Veteran Member
Join Date: Feb 2009
Location: adios y??
Old 05-06-2010 , 23:43   Re: Automatic func_tanks in Counter Strike
Reply With Quote #16

Quote:
Originally Posted by joropito View Post
It was just a test the fakemeta alternative. It's just an example.



Only if I need

Btw, I think it's possible to set full rotation using key "yawrange".
ammm xD??

...

m_yawRange is num 41
set_pdata_float(id,41,360.0,4)



http://wiki.amxmodx.org/CFuncTank_%28CS%29
__________________
capostrike93 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-07-2010 , 06:08   Re: Automatic func_tanks in Counter Strike
Reply With Quote #17

It's more safe to deal with keyvalues than offset since this one can change on update. So if you can, use keyvalues.

Also, if I'm right ( but I've seen some tutorials saying the same thing ), to have a full rotation you should write 180, 180 left + 180 right = 360. Like the Joropito's example : "yawrange 55" ; meaning the range is : 55 + 55 = 110.
__________________
Arkshine is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 05-07-2010 , 08:54   Re: Automatic func_tanks in Counter Strike
Reply With Quote #18

Quote:
Originally Posted by Arkshine View Post
If you want to use the keyvalue, I guess you need to hook the spawn as pre
Why must be done at precache (in func_tank case)?

This should work (not tested).

PHP Code:
set_kvd(0KV_ClassName"func_tank")
set_kvd(0KV_KeyName"yawrange")
set_kvd(0KV_Value180)
set_kvd(0KV_fHandled0)
dllfunc(DLLFunc_KeyValueent0
In hlsdk I can see that at CFuncTank::KeyValue() every offset is updated with the new values.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-07-2010 , 09:53   Re: Automatic func_tanks in Counter Strike
Reply With Quote #19

I have read somewhere after using DispatchKeyValue you must use DispatchSpawn but looking the HLSDK I don't find any reference to that, so I guess it should work right away. I'm going to try to see.
__________________
Arkshine is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 05-07-2010 , 10:29   Re: Automatic func_tanks in Counter Strike
Reply With Quote #20

Quote:
Originally Posted by Arkshine View Post
I have read somewhere after using DispatchKeyValue you must use DispatchSpawn but looking the HLSDK I don't find any reference to that, so I guess it should work right away. I'm going to try to see.
Yeah, maybe that dispatch it's for some entities but for func_tank it seems to be quite different unless CFuncTank::KeyValue isn't related to DLLFunc_KeyValue.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
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 07:10.


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