AlliedModders

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

DarthMan 02-22-2017 02:49

Replace Entity Strength
 
Hello. There is a problem with this script. I want to change the strength to 1000 for all entities named glass_votemap . Any help will be appreciated. Thanks !

Code:

//* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>

#define PLUGIN "VoteMap"
#define VERSION "0.1"
#define AUTHOR "DarthMan"


public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        new entity = -1
        while((entity = fm_find_ent_by_tname(entity, "func_breakable")))
        {
          DispatchKeyValue(entity,"Strength", "1000");
        }
}


Natsheh 02-22-2017 04:18

Re: Replace Entity Strength
 
You could do set pev health

Instead of tname do classname

DarthMan 02-22-2017 05:02

Re: Replace Entity Strength
 
Quote:

Originally Posted by Natsheh (Post 2497398)
You could do set pev health

Instead of tname do classname

So what part of code do I ahve to basically change? I ahve enver used pev before.

edon1337 02-22-2017 07:13

Re: Replace Entity Strength
 
PHP Code:

#include < amxmodx >
#include < engine >

#define PLUGIN "VoteMap"
#define VERSION "0.1"
#define AUTHOR "DarthMan"

public plugin_init( ) {

    
register_pluginPLUGINVERSIONAUTHOR );
    
    new 
ent = -1
    
while( ( ent find_ent_by_classent"func_breakable" ) ) )
    
    
entity_set_floatentEV_FL_health1000.0 )



DarthMan 02-22-2017 07:27

Re: Replace Entity Strength
 
Quote:

Originally Posted by edon1337 (Post 2497437)
PHP Code:

#include < amxmodx >
#include < engine >

#define PLUGIN "VoteMap"
#define VERSION "0.1"
#define AUTHOR "DarthMan"

public plugin_init( ) {

    
register_pluginPLUGINVERSIONAUTHOR );
    
    new 
ent = -1
    
while( ( ent find_ent_by_classent"func_breakable" ) ) )
    
    
entity_set_floatentEV_FL_health1000.0 )



So that was the way to do it, EV_FL_health .
But another question, how can I make it only apply this to the entities named glass_votemap ?

edon1337 02-22-2017 07:53

Re: Replace Entity Strength
 
Quote:

Originally Posted by DarthMan (Post 2497447)
So that was the way to do it, EV_FL_health .

Idk if it's correct.

Quote:

Originally Posted by DarthMan (Post 2497447)
But another question, how can I make it only apply this to the entities named glass_votemap ?

Then change func_breakable to glass_votemap ?

DarthMan 02-22-2017 08:36

Re: Replace Entity Strength
 
Quote:

Originally Posted by edon1337 (Post 2497456)
Idk if it's correct.



Then change func_breakable to glass_votemap ?

Is this gonna look for the targetname instead of the classname?

DarthMan 02-22-2017 08:50

Re: Replace Entity Strength
 
Quote:

Originally Posted by DarthMan (Post 2497472)
Is this gonna look for the targetname instead of the classname?

Code:

public map_lights(id)
{
    new ent_light_1 = create_entity("light")
    entity_set_origin(ent_light_1,Float:{-384.0,952.0,-165.0})
    ready=1
}

This new code adds a light at a given position. Any ideas on how can i set the brightness of the light? Thanks ! This will be used for the panels.

killerZM 02-22-2017 10:41

Re: Replace Entity Strength
 
pev renders natives ?

edon1337 02-22-2017 11:16

Re: Replace Entity Strength
 
Quote:

Originally Posted by DarthMan (Post 2497472)
Is this gonna look for the targetname instead of the classname?

find_ent_by_tname - Finds by targetname

find_ent_by_class - Finds by classname

Quote:

Originally Posted by DarthMan (Post 2497481)
Code:

public map_lights(id)
{
    new ent_light_1 = create_entity("light")
    entity_set_origin(ent_light_1,Float:{-384.0,952.0,-165.0})
    ready=1
}

This new code adds a light at a given position. Any ideas on how can i set the brightness of the light? Thanks ! This will be used for the panels.

EV_INT_light_level


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

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