AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Add new entity (https://forums.alliedmods.net/showthread.php?t=106383)

OneMoreLevel 10-14-2009 14:47

Add new entity
 
Is there a possible way to add entities to a map, like lets say you say: amx_rain, and it adds a env_rain entity to the map, so it starts raining. Is this possible?

Arkshine 10-14-2009 14:51

Re: Add new entity
 
Already exists, search please.

KadiR 10-14-2009 14:59

Re: Add new entity
 
I would need it too :)

xPaw 10-14-2009 15:25

Re: Add new entity
 
You can't create such entities while in game, only in plugin_precache, well rain may work from _init too, but not from middle game

uxMal 10-14-2009 15:41

Re: Add new entity
 
here you go

Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Rain"
#define VERSION "1.0"
#define AUTHOR "uxmal"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)

}

public plugin_precache() {
   
    new ent = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"env_rain"));
    if(ent > 0) {
       
       
       
        new spent = engfunc(EngFunc_FindEntityByString,1,"classname","info_player_start");
        if(!spent)
            return PLUGIN_HANDLED;
        new origin[3];
        pev(spent,pev_origin,origin,3);
       
        engfunc(EngFunc_SetOrigin,ent,origin);
       
        //dllfunc(DLLFunc_Spawn, ent);
        // not needed
       
    }
    else {
    client_print(0,print_center,"ERROR");   
    }
   
    return PLUGIN_HANDLED;
   
   
}

I think you needn't even set the origin of the ent cause it rains on the whole map but in my code it spawns the ent at the first ct spawnpoint


All times are GMT -4. The time now is 22:40.

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