Raised This Month: $ Target: $400
 0% 

[Help] Change Map Entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 06-04-2013 , 08:58   [Help] Change Map Entity
Reply With Quote #1

Well, i got a map from CSO.
But the problem is:

Round 1: The main door auto break so player can move out from the room
But from Round 2 until.... The main door doesn't auto break. -> Player can't move out and stuck in the room

My friend said: "we need to change trigger_once to trigger_multiple".
So how to change with amxx ?

I tried and nothing. Here is my code:
PHP Code:
public pfn_keyvalue(ent)
{
    new 
classname[32], key[32], value[32]
    
copy_keyvalue(classname31key31value31)

    if(
equal(classname"trigger_once"))
    {
        if(
equal(key"target") && equal(value"start"))
        {
            
DispatchKeyValue("classname""trigger_multiple")
            
DispatchSpawn(ent)
        }
    }


Last edited by dias; 06-04-2013 at 08:59.
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-04-2013 , 09:41   Re: [Help] Change Map Entity
Reply With Quote #2

Maybe using, pev and set_pev ? with pev_classname :O
TheDS1337 is offline
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 06-04-2013 , 09:45   Re: [Help] Change Map Entity
Reply With Quote #3

i tried and nothing..
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-04-2013 , 10:07   Re: [Help] Change Map Entity
Reply With Quote #4

I really don't know, but maybe you can delete it, and make new entity have the same origin, size ... of it
Code:
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >

public plugin_init( ) 
	register_forward( FM_Spawn, "OnEntitySpawn" );
	
public OnEntitySpawn( Entity )
{
	if( pev_valid( Entity ) ) // Not a NULL Entity
	{
		static ClassName[ 32 ];
		pev( Entity, pev_classname, ClassName, charsmax( ClassName ) );
		if( equal( ClassName, "trigger_once" ) )
		{			
			static NewEntity;
			NewEntity = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "trigger_multiple" ) );
			
			set_pev( NewEntity, pev_origin, pev( Entity, pev_origin ) );			
			engfunc( EngFunc_SetSize, NewEntity, pev( Entity, pev_mins ), pev( Entity, pev_maxs ) );
			engfunc( EngFunc_RemoveEntity, Entity );
                        return FMRES_SUPERCEDE;
		}
	}
        return FMRES_IGNORED;
}

Last edited by TheDS1337; 06-04-2013 at 10:08.
TheDS1337 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-04-2013 , 10:28   Re: [Help] Change Map Entity
Reply With Quote #5

Changing the entity's classname should work but you woud need to hook spawn in plugin precache.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 06-04-2013 , 12:38   Re: [Help] Change Map Entity
Reply With Quote #6

if you create trigger entity then its need:
target; if player touch, then which entity will be triggered
model; this is for hull, because without model or mins/maxs you cant touch it
you can copy those from trigger_once

Last edited by .Dare Devil.; 06-04-2013 at 12:38.
.Dare Devil. is offline
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 06-04-2013 , 20:11   Re: [Help] Change Map Entity
Reply With Quote #7

So we can do like DeagLe.Studio did in the Post #4 ?
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 06-05-2013 , 03:03   Re: [Help] Change Map Entity
Reply With Quote #8

Ok. Now i got a new problem. The door exploses continously... (even round 1)
Here is my code. Is there anything wrong ?
PHP Code:
public plugin_precache()
{
    
register_forward(FM_Spawn"fw_Spawn")
}

public 
fw_Spawn(ent)
{
    if(!
pev_valid(ent))
        return 
FMRES_IGNORED

    
static ClassName[32], Target[64]
    
pev(entpev_classnameClassNamecharsmax(ClassName))
    
pev(entpev_targetTargetsizeof(Target))
    
    if(
equal(ClassName"trigger_once") && equal(Target"start"))
    {
        static 
NewEntityFloat:Origin[3], String[64]
        
NewEntity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"trigger_multiple"))
        
        
fm_set_kvd(NewEntity"model""*101")
        
fm_set_kvd(NewEntity"target""start")
        
fm_set_kvd(NewEntity"style""32")
        
        
dllfunc(DLLFunc_SpawnNewEntity)
        
        
Big 1
        
        
return FMRES_SUPERCEDE
    
}
    
    return 
FMRES_IGNORED

dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-05-2013 , 03:16   Re: [Help] Change Map Entity
Reply With Quote #9

Quote:
Originally Posted by dias View Post
Ok. Now i got a new problem. The door exploses continously... (even round 1)
Here is my code. Is there anything wrong ?
PHP Code:
public plugin_precache()
{
    
register_forward(FM_Spawn"fw_Spawn")
}

public 
fw_Spawn(ent)
{
    if(!
pev_valid(ent))
        return 
FMRES_IGNORED

    
static ClassName[32], Target[64]
    
pev(entpev_classnameClassNamecharsmax(ClassName))
    
pev(entpev_targetTargetsizeof(Target))
    
    if(
equal(ClassName"trigger_once") && equal(Target"start"))
    {
        static 
NewEntityFloat:Origin[3], String[64]
        
NewEntity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"trigger_multiple"))
        
        
fm_set_kvd(NewEntity"model""*101")
        
fm_set_kvd(NewEntity"target""start")
        
fm_set_kvd(NewEntity"style""32")
        
        
dllfunc(DLLFunc_SpawnNewEntity)
        
        
Big 1
        
        
return FMRES_SUPERCEDE
    
}
    
    return 
FMRES_IGNORED

Maybe you need to remove old entity
Code:
engfunc(EngFunc_RemoveEntity, ent)
TheDS1337 is offline
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 06-05-2013 , 03:48   Re: [Help] Change Map Entity
Reply With Quote #10

^
- No need.
You returned FMRES_SUPERCEDE -> Entity removed
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
Reply


Thread Tools
Display Modes

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 16:19.


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