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

Donīt use "E" to move the block


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 04-28-2010 , 09:21   Donīt use "E" to move the block
Reply With Quote #1

With this code I make a func_pushable block, but I only can move it pushing "E" ("use")

PHP Code:
#include <amxmodx>
#include <engine>

new val


public plugin_init()
{
    
register_plugin"MoneybagSpawner""0.2""TiToTal" );
    
register_touch("ts_model""player""Touch_MoneyBag");

}

public 
plugin_precache()
{
    
precache_model"models/block.mdl" )
}

stock create_moneybagmodel[], Float:origin[3], Float:angle 0.0 )
{
    new 
ent create_entity("func_pushable"

    
entity_set_origin(ent,origin)

    
entity_set_string(ent,EV_SZ_classname,"ts_model"); 
    
entity_set_model(ent,model); 
    
entity_set_int(ent,EV_INT_solid3
    
entity_set_int(ent,EV_INT_movetype13

    
entity_set_byte(ent,EV_BYTE_controller1,1); 
    
entity_set_byte(ent,EV_BYTE_controller2,1); 
    
entity_set_byte(ent,EV_BYTE_controller3,1); 
    
entity_set_byte(ent,EV_BYTE_controller4,1); 


    new 
Float:maxs[3] = {32.032.010.0}; 
    new 
Float:mins[3] = {-32.0, -32.0, -10.0}; 
    new 
Float:angles[3] = { 0.00.00.0 }
    
angles[1] = angle
    entity_set_size
(ent,mins,maxs)
    
entity_set_vectorentEV_VEC_anglesangles )

    
entity_set_float(ent,EV_FL_animtime,2.0
    
entity_set_float(ent,EV_FL_framerate,1.0
    
entity_set_int(ent,EV_INT_sequence,1); 

    return 
PLUGIN_HANDLED
}
public 
Touch_MoneyBag(moneybagid)
{
     new 
Float:vel[3];
     
entity_get_vector(idEV_VEC_velocityvel);
     
entity_set_vector(moneybagEV_VEC_velocityvel);
}
public 
client_putinserverid )
{
    if( 
val ) return PLUGIN_HANDLED

    val 
1



    
// Model Money Bag


    
new Float:moneybagone[3] = { 371.1, -1224.7, -219.9 }



    
create_moneybag"models/block.mdl"moneybagone0.0 )
    
    
    


Any suggestions?
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-28-2010 , 10:26   Re: Donīt use "E" to move the block
Reply With Quote #2

I don't understand.

1. You want it to work only for "+use".
2. It works only for "+use" and you want it to work whenever touched.

Which one do you want?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
LittleBody
BANNED
Join Date: Apr 2010
Old 04-28-2010 , 10:52   Re: Donīt use "E" to move the block
Reply With Quote #3

Quote:
Originally Posted by Exolent[jNr] View Post
I don't understand.

1. You want it to work only for "+use".
2. It works only for "+use" and you want it to work whenever touched.

Which one do you want?
He wants to option 2
LittleBody is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 04-28-2010 , 11:03   Re: Donīt use "E" to move the block
Reply With Quote #4

Yes, the second option, sorry for my english

With the code above, to move the block yo must push E("use")
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.

Last edited by S34Qu4K3; 04-28-2010 at 11:09.
S34Qu4K3 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-28-2010 , 11:52   Re: Donīt use "E" to move the block
Reply With Quote #5

Try in touch callback force_use(entity, player)
or put flag IN_USE or flag IN_FORWARD in payer button.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-28-2010 at 11:57.
ConnorMcLeod is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 04-28-2010 , 12:01   Re: Donīt use "E" to move the block
Reply With Quote #6

If I put:

new player//I thinks this is bad

force_use(ent, player)


I can traspase the solid
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-28-2010 , 12:10   Re: Donīt use "E" to move the block
Reply With Quote #7

PHP Code:
public Touch_MoneyBag(moneybagid)
{
 
set_pev(idpev_buttonpev(idpev_button) | IN_USE)

Code:
// Pull the func_pushable
void CPushable :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	if ( !pActivator || !pActivator->IsPlayer() )
	{
		if ( pev->spawnflags & SF_PUSH_BREAKABLE )
			this->CBreakable::Use( pActivator, pCaller, useType, value );
		return;
	}

	if ( pActivator->pev->velocity != g_vecZero )
		Move( pActivator, 0 );
}


void CPushable :: Touch( CBaseEntity *pOther )
{
	if ( FClassnameIs( pOther->pev, "worldspawn" ) )
		return;

	Move( pOther, 1 );
}

void CPushable :: Move( CBaseEntity *pOther, int push )
{
	entvars_t*	pevToucher = pOther->pev;
	int playerTouch = 0;

	// Is entity standing on this pushable ?
	if ( FBitSet(pevToucher->flags,FL_ONGROUND) && pevToucher->groundentity && VARS(pevToucher->groundentity) == pev )
	{
		// Only push if floating
		if ( pev->waterlevel > 0 )
			pev->velocity.z += pevToucher->velocity.z * 0.1;

		return;
	}


	if ( pOther->IsPlayer() )
	{
		if ( push && !(pevToucher->button & (IN_FORWARD|IN_USE)) )	// Don't push unless the player is pushing forward and NOT use (pull)
			return;
		playerTouch = 1;
	}

	float factor;

	if ( playerTouch )
	{
		if ( !(pevToucher->flags & FL_ONGROUND) )	// Don't push away from jumping/falling players unless in water
		{
			if ( pev->waterlevel < 1 )
				return;
			else 
				factor = 0.1;
		}
		else
			factor = 1;
	}
	else 
		factor = 0.25;

	pev->velocity.x += pevToucher->velocity.x * factor;
	pev->velocity.y += pevToucher->velocity.y * factor;

	float length = sqrt( pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y );
	if ( push && (length > MaxSpeed()) )
	{
		pev->velocity.x = (pev->velocity.x * MaxSpeed() / length );
		pev->velocity.y = (pev->velocity.y * MaxSpeed() / length );
	}
	if ( playerTouch )
	{
		pevToucher->velocity.x = pev->velocity.x;
		pevToucher->velocity.y = pev->velocity.y;
		if ( (gpGlobals->time - m_soundTime) > 0.7 )
		{
			m_soundTime = gpGlobals->time;
			if ( length > 0 && FBitSet(pev->flags,FL_ONGROUND) )
			{
				m_lastSound = RANDOM_LONG(0,2);
				EMIT_SOUND(ENT(pev), CHAN_WEAPON, m_soundNames[m_lastSound], 0.5, ATTN_NORM);
	//			SetThink( StopSound );
	//			pev->nextthink = pev->ltime + 0.1;
			}
			else
				STOP_SOUND( ENT(pev), CHAN_WEAPON, m_soundNames[m_lastSound] );
		}
	}
}
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 04-28-2010 , 12:15   Re: Donīt use "E" to move the block
Reply With Quote #8

A lot of invalid functions:
PHP Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2006 ITB CompuPhaseAMX Mod X Team

Warning
: Function "client_putinserver" should return a value on line 76
Error
Invalid function or declaration on line 78
Error
Invalid function or declaration on line 80
Error
Invalid function or declaration on line 82
Error
Invalid function or declaration on line 84
Error
Invalid function or declaration on line 87
Warning
Old style prototypes used with optional semicolumns on line 88
Error
Unmatched closing brace on line 89
Error
Invalid function or declaration on line 92
Error
Invalid function or declaration on line 94
Error
Invalid function or declaration on line 95
Error
Invalid function or declaration on line 97
Warning
Old style prototypes used with optional semicolumns on line 97
Error
Unmatched closing brace on line 98
Error
Invalid function or declaration on line 100
Error
Invalid function or declaration on line 106
Error
Invalid function or declaration on line 109
Error
Invalid function or declaration on line 112
Error
Invalid function or declaration on line 116
Error
Invalid function or declaration on line 118
Error
Invalid function or declaration on line 119
Error
Invalid function or declaration on line 123
Error
Invalid function or declaration on line 125
Error
Invalid function or declaration on line 127
Error
Invalid function or declaration on line 129
Error
Invalid function or declaration on line 130
Error
Invalid function or declaration on line 131
Error
Invalid function or declaration on line 134
Error
Invalid function or declaration on line 137 

FUll COde:

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

new val


public plugin_init()
{
    
register_plugin"MoneybagSpawner""0.2""TiToTal" );
    
register_touch("ts_model""player""Touch_MoneyBag");

}

public 
plugin_precache()
{
    
precache_model"models/block.mdl" )
}

stock create_moneybagmodel[], Float:origin[3], Float:angle 0.0 )
{
    new 
ent create_entity("func_pushable"
    

    
entity_set_origin(ent,origin)

    
entity_set_string(ent,EV_SZ_classname,"ts_model"); 
    
entity_set_model(ent,model); 
    
entity_set_int(ent,EV_INT_solid3
    
entity_set_int(ent,EV_INT_movetype13
    
    

    
entity_set_byte(ent,EV_BYTE_controller1,1); 
    
entity_set_byte(ent,EV_BYTE_controller2,1); 
    
entity_set_byte(ent,EV_BYTE_controller3,1); 
    
entity_set_byte(ent,EV_BYTE_controller4,1); 


    new 
Float:maxs[3] = {32.032.010.0}; 
    new 
Float:mins[3] = {-32.0, -32.0, -10.0}; 
    new 
Float:angles[3] = { 0.00.00.0 }
    
angles[1] = angle
    entity_set_size
(ent,mins,maxs)
    
entity_set_vectorentEV_VEC_anglesangles )

    
entity_set_float(ent,EV_FL_animtime,2.0
    
entity_set_float(ent,EV_FL_framerate,1.0
    
entity_set_int(ent,EV_INT_sequence,1); 

    return 
PLUGIN_HANDLED
}
public 
Touch_MoneyBag(moneybagid)
{
 
set_pev(idpev_buttonpev(idpev_button) | IN_USE)
}  
public 
client_putinserverid )
{
    if( 
val ) return PLUGIN_HANDLED

    val 
1



    
// Model Money Bag


    
new Float:moneybagone[3] = { 371.1, -1224.7, -219.9 }



    
create_moneybag"models/block.mdl"moneybagone0.0 )
    
    
    
}
// Pull the func_pushable
void CPushable :: Use( CBaseEntity *pActivatorCBaseEntity *pCallerUSE_TYPE useTypefloat value )
{
    if ( !
pActivator || !pActivator->IsPlayer() )
    {
        if ( 
pev->spawnflags SF_PUSH_BREAKABLE )
            
this->CBreakable::Use( pActivatorpCalleruseTypevalue );
        return;
    }

    if ( 
pActivator->pev->velocity != g_vecZero )
        
MovepActivator);
}


void CPushable :: TouchCBaseEntity *pOther )
{
    if ( 
FClassnameIspOther->pev"worldspawn" ) )
        return;

    
MovepOther);
}

void CPushable :: MoveCBaseEntity *pOtherint push )
{
    
entvars_t*    pevToucher pOther->pev;
    
int playerTouch 0;

    
// Is entity standing on this pushable ?
    
if ( FBitSet(pevToucher->flags,FL_ONGROUND) && pevToucher->groundentity && VARS(pevToucher->groundentity) == pev )
    {
        
// Only push if floating
        
if ( pev->waterlevel )
            
pev->velocity.+= pevToucher->velocity.0.1;

        return;
    }


    if ( 
pOther->IsPlayer() )
    {
        if ( 
push && !(pevToucher->button & (IN_FORWARD|IN_USE)) )    // Don't push unless the player is pushing forward and NOT use (pull)
            
return;
        
playerTouch 1;
    }

    
float factor;

    if ( 
playerTouch )
    {
        if ( !(
pevToucher->flags FL_ONGROUND) )    // Don't push away from jumping/falling players unless in water
        
{
            if ( 
pev->waterlevel )
                return;
            else 
                
factor 0.1;
        }
        else
            
factor 1;
    }
    else 
        
factor 0.25;

    
pev->velocity.+= pevToucher->velocity.factor;
    
pev->velocity.+= pevToucher->velocity.factor;

    
float length sqrtpev->velocity.pev->velocity.pev->velocity.pev->velocity.);
    if ( 
push && (length MaxSpeed()) )
    {
        
pev->velocity.= (pev->velocity.MaxSpeed() / length );
        
pev->velocity.= (pev->velocity.MaxSpeed() / length );
    }
    if ( 
playerTouch )
    {
        
pevToucher->velocity.pev->velocity.x;
        
pevToucher->velocity.pev->velocity.y;
        if ( (
gpGlobals->time m_soundTime) > 0.7 )
        {
            
m_soundTime gpGlobals->time;
            if ( 
length && FBitSet(pev->flags,FL_ONGROUND) )
            {
                
m_lastSound RANDOM_LONG(0,2);
                
EMIT_SOUND(ENT(pev), CHAN_WEAPONm_soundNames[m_lastSound], 0.5ATTN_NORM);
    
//            SetThink( StopSound );
    //            pev->nextthink = pev->ltime + 0.1;
            
}
            else
                
STOP_SOUNDENT(pev), CHAN_WEAPONm_soundNames[m_lastSound] );
        }
    }

__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-28-2010 , 12:18   Re: Donīt use "E" to move the block
Reply With Quote #9

The 2nd code i showed you is Half Life source code, don't use it, it's only so you can see how it works (should be exactly the same in cs), also it's not pawn language but C/C++.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 04-28-2010 , 12:25   Re: Donīt use "E" to move the block
Reply With Quote #10

Ahhhhh, ok ;)

But, Now I can move the block but only if I go to one side and only move laterally
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 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 13:34.


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