AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Entity question (https://forums.alliedmods.net/showthread.php?t=305913)

GasmoN 03-09-2018 15:35

Entity question
 
This code will reset any block that is around doors at zombie spawn.
But the problem is that if there are two doors, plugin is removing blocks
at the center between these two doors. How to fix that?

PHP Code:

// plugin_init
    
new Float:mins[3], Float:maxs[3]
    
    
g_iEntBarrier find_ent_by_tname( -1"barrier" );
    
    
entity_get_vector(g_iEntBarrierEV_VEC_minsmins);
    
entity_get_vector(g_iEntBarrierEV_VEC_maxsmaxs);
    
    
g_fBarrierOrigin[0] = (mins[0] + maxs[0]) / 2.0
    g_fBarrierOrigin
[1] = (mins[1] + maxs[1]) / 2.0
    g_fBarrierOrigin
[2] = (mins[2] + maxs[2]) / 2.0 

PHP Code:

// Triggered when player release block

new entity = -1
while( ( entity engfuncEngFunc_FindEntityInSphereentityg_fBarrierOrigin200.0 ) ) != )
{
    if (
entity == ent)
    {
        
ColorChat(idCHATCOLOR_RED"$g%s$t %L"BB_PREFIXid"BBBM_BLOCK_SPAWN")
        
        
engfuncEngFunc_SetOriginentityFloat:{ 0.00.00.0 } );
        
//g_iOwnedEntities[BlockLocker(ent)]--
        
g_EntMover[ent] = 0
        g_EntOwner
[ent] = 0
    
}



DjSoftero 03-10-2018 07:10

Re: Entity question
 
I'm not sure, But I think those 2 doors are 1 entity. You could make something, that would load data from a file for every map separately.

GasmoN 03-10-2018 12:48

Re: Entity question
 
I thought about that but the problem is im not sure how to check if block is on given coordinates.

DjSoftero 03-11-2018 01:11

Re: Entity question
 
instead of plugin_init part of the code, create a system to read/write mins and max of the entrance and save it to a file. After that, loop through 2 separate bounds instead of only one

GasmoN 03-11-2018 07:38

Re: Entity question
 
I'll try to do something with this, tomorrow since I don't have time today
https://forums.alliedmods.net/showpo...64&postcount=2


All times are GMT -4. The time now is 20:26.

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