Raised This Month: $ Target: $400
 0% 

Add new entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-14-2009 , 14:47   Add new entity
Reply With Quote #1

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?
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-14-2009 , 14:51   Re: Add new entity
Reply With Quote #2

Already exists, search please.
__________________
Arkshine is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 10-14-2009 , 14:59   Re: Add new entity
Reply With Quote #3

I would need it too
KadiR is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-14-2009 , 15:25   Re: Add new entity
Reply With Quote #4

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
__________________
xPaw is offline
uxMal
Member
Join Date: Oct 2007
Old 10-14-2009 , 15:41   Re: Add new entity
Reply With Quote #5

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
uxMal is offline
Reply



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 22:40.


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