AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with this error (https://forums.alliedmods.net/showthread.php?t=216220)

Balck 05-18-2013 05:01

Help with this error
 
Can some one help me to fix this code


L 05/18/2013 - 00:17:45: [AMXX] Run time error 10: native error (native "ArrayGetCell")
L 05/18/2013 - 00:17:45: [AMXX] [0] Remove_forest_woods.sma::pfn_keyvalue (line 70)

PHP Code:

#include <amxmodx>
#include <engine>

new Array:g_hMaterial, Array:g_hModels, Array:g_hEntsg_iLastEntg_iArraySize = -1bool:g_bCheck true

public plugin_precache()
{
    new 
szMapName[32]; get_mapname(szMapName31)
    if(!
equali(szMapName"deathrun_forest"))
    {
        
set_fail_state("Plugin only works on deathrun_forest")
    }
    
    
g_hMaterial ArrayCreate(11)
    
g_hModels ArrayCreate(31)
    
g_hEnts ArrayCreate(11)
}

public 
plugin_init()
{
    
register_plugin("Remove W00D""1.0""Khalid :)")
    
    
g_bCheck false
    
new iModeliEnts 0
    
for(new ig_iArraySizei++)
    {
        
iModel ArrayGetCell(g_hModelsi)
        
        if(
iModel 41 /* Explosion box trap model num */)
        {
            
remove_entity(ArrayGetCell(g_hEntsi))
            
iEnts++
            
server_print("Removed")
        }
    }
    
    
ArrayDestroy(g_hMaterial)
    
ArrayDestroy(g_hModels)
    
ArrayDestroy(g_hEnts)
    
    if(
iEnts == 6)
    {
        
set_fail_state("Removed ALL (6) func_breakable wood")
    }
}

public 
pfn_keyvalue(iEnt)
{    
    if(!
g_bCheck)
    {
        return;
    }
    
    new 
szClassName[31], szKeyName[31], szValue[5]
    
copy_keyvalue(szClassName30szKeyName30szValue4)
    
    if(!
equal(szClassName"func_breakable"))
    {
        return;
    }
    
    if(
iEnt != g_iLastEnt)
    {
        
g_iLastEnt iEnt
    
}
    
    if(
equal(szKeyName"material") && szValue[0] == '1' && szValue[1] == EOS)
    {
        
g_iArraySize++
        
ArrayPushCell(g_hMaterialstr_to_num(szValue))
        
ArrayPushCell(g_hEntsiEnt)
        return;
    }
    
    if(
equal(szKeyName"model") && ArrayGetCell(g_hMaterialg_iArraySize))
    {
        
replace(szValue4"*""")
        
        
ArrayPushCell(g_hModelsstr_to_num(szValue))
    }


https://forums.alliedmods.net/showthread.php?t=216162
:cry:
Help is some one can

YamiKaitou 05-18-2013 11:50

Re: Help with this error
 
What is the complete error message? You are missing part of it

Balck 05-19-2013 03:27

Re: Help with this error
 
Quote:

Originally Posted by YamiKaitou (Post 1953957)
What is the complete error message? You are missing part of it

Here is it


L 05/19/2013 - 00:30:36: -------- Mapchange to deathrun_forest --------
L 05/19/2013 - 00:30:55: Invalid cellvector handle provided (1:-1:0)
L 05/19/2013 - 00:30:55: [AMXX] Displaying debug trace (plugin "Remove_forest_woods.amxx")
L 05/19/2013 - 00:30:55: [AMXX] Run time error 10: native error (native "ArrayGetCell")
L 05/19/2013 - 00:30:55: [AMXX] [0] Remove_forest_woods.sma::pfn_keyvalue (line 70)

ConnorMcLeod 05-19-2013 04:39

Re: Help with this error
 
Oh, pokemonmaster code lol.


Try this :

PHP Code:

#include < amxmodx >
#include < engine >
#include < fakemeta >

#pragma semicolon 1

#define PLUGIN ""
#define VERSION "0.0.1"

const matWood 1;

const 
XO_CBREAKABLE 4;
const 
m_Material 36;

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    new 
mapname[32];
    
get_mapname(mapnamecharsmax(mapname));

    if( 
equali(mapname"deathrun_forest") )
    {
        new 
ent;
        while( (
ent find_ent_by_class(ent"func_breakable")) )
        {
            if( ~
entity_get_int(entEV_INT_spawnflags) & SF_BREAK_TRIGGER_ONLY && get_pdata_int(entm_MaterialXO_CBREAKABLE) == matWood )
            {
                
remove_entity(ent);
            }
        }
    }



Balck 05-19-2013 06:22

Re: Help with this error
 
Quote:

Originally Posted by ConnorMcLeod (Post 1954312)
Oh, pokemonmaster code lol.


Try this :

PHP Code:

#include < amxmodx >
#include < engine >
#include < fakemeta >

#pragma semicolon 1

#define PLUGIN ""
#define VERSION "0.0.1"

const matWood 1;

const 
XO_CBREAKABLE 4;
const 
m_Material 36;

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    new 
mapname[32];
    
get_mapname(mapnamecharsmax(mapname));

    if( 
equali(mapname"deathrun_forest") )
    {
        new 
ent;
        while( (
ent find_ent_by_class(ent"func_breakable")) )
        {
            if( ~
entity_get_int(entEV_INT_spawnflags) & SF_BREAK_TRIGGER_ONLY && get_pdata_int(entm_MaterialXO_CBREAKABLE) == matWood )
            {
                
remove_entity(ent);
            }
        }
    }



Thanks very much ConnorMcLeod it works perfectly :)

ConnorMcLeod 05-19-2013 17:13

Re: Help with this error
 
Answer to your PM :

Code:

// CBaseEntity -> CBaseDelay -> CBreakable
// Linux +4
stock const XO_CBREAKABLE = 4;

enum _:Explosions{ expRandom, expDirected}
enum _:Materials{ matGlass = 0, matWood, matMetal, matFlesh, matCinderBlock, matCeilingTile, matComputer, matUnbreakableGlass, matRocks, matNone, matLastMaterial }

stock const m_Material = 36; // Materials
stock const m_Explosion = 37; // Explosions
stock const m_idShard = 38;
stock const m_angle = 39;
stock const m_iszGibModel = 40;
stock const m_iszSpawnObject = 41;


Balck 05-20-2013 01:49

Re: Help with this error
 
Quote:

Originally Posted by ConnorMcLeod (Post 1954709)
Answer to your PM :

Code:

// CBaseEntity -> CBaseDelay -> CBreakable
// Linux +4
stock const XO_CBREAKABLE = 4;

enum _:Explosions{ expRandom, expDirected}
enum _:Materials{ matGlass = 0, matWood, matMetal, matFlesh, matCinderBlock, matCeilingTile, matComputer, matUnbreakableGlass, matRocks, matNone, matLastMaterial }

stock const m_Material = 36; // Materials
stock const m_Explosion = 37; // Explosions
stock const m_idShard = 38;
stock const m_angle = 39;
stock const m_iszGibModel = 40;
stock const m_iszSpawnObject = 41;


thanks :)

darcadarca 05-20-2013 05:30

Re: Help with this error
 
or better you can use entity remover by exolent:)
edit : yes .. exolent , sorry about that , counfuse :)

ConnorMcLeod 05-20-2013 06:55

Re: Help with this error
 
Quote:

Originally Posted by darcadarca (Post 1954956)
or better you can use entity remover by connor:)

You mean by xolent.

Lolz0r 05-20-2013 08:59

Re: Help with this error
 
Connor, if I can make use of the topic and dont make another one to ask you here if I want to remove something from surf_ski_2 how should i do it ?


Code:

Classnames :

func_button
trigger_teleport
trigger_teleport

Code:

Models :

*20
*22
*23



All times are GMT -4. The time now is 16:25.

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