THE.LOST Administrator
Mesaje : 72 Puncte : 202 Data de inscriere : 23/03/2010 Varsta : 39 Localizare : Prin Satelit
| Subiect: RainySnowy 2.0 Mar Feb 22, 2011 6:02 pm | |
| - AMXX 1.71+ - Modules: Default FAKEMETA. To use ENGINE, uncomment the #include, and comment #include - .inc file: ojos.inc has #defines and stocks to make switching between ENGINE and FAKEMETA a breeze. Whichever #include you choose is the module's natives it'll use. Their designed to do the same thing on both modules, in one simple macro.
CVAR: - weather_type < 0 | 1 | 2 | 3 > - ( 0 = OFF | 1 = RAIN | 2 = SNOW | 3 = RANDOM ) - weather_storm < 0 - 100 > - ( 0 = OFF | 1-100 = INTENSITY ) - Only works when its raining.
Pluginu:
[] - Citat :
- #include
/* Choose One */ //#include #include
#include "ojos.inc"
#define MAX_LIGHT_POINTS 3
new weather_ent new Float:g_strikedelay new g_lightpoints[MAX_LIGHT_POINTS] new g_fxbeam; new g_soundstate[33] new g_maxplayers; new g_stormintensity;
public plugin_precache() { register_plugin("RainySnowy", "2.0y", "RAPP"); register_cvar("rainysnowy", "2.0y", FCVAR_SERVER); register_cvar("weather_type", "1"); register_cvar("weather_storm", "50"); g_maxplayers = get_maxplayers(); new type = get_cvar_num("weather_type"); if(type == 3) type = random_num(0,2); switch(type) { case 1: { g_fxbeam = precache_model("sprites/laserbeam.spr"); precache_model("models/chick.mdl"); precache_sound("ambience/rain.wav"); precache_sound("ambience/thunder_clap.wav"); weather_ent = CREATE_ENTITY("env_rain") THINK("env_rain","WeatherSystem") NEXTTHINK(weather_ent,1.0) } case 2: { weather_ent = CREATE_ENTITY("env_snow"); } } }
public client_putinserver(id) client_cmd(id,"cl_weather 1");
//This is only for rain. public WeatherSystem(entid) { if(entid == weather_ent) { //Is weather_storm activated? ( 0 = OFF ) -- ( 1-100 = INTENSITY ) g_stormintensity = get_cvar_num("weather_storm"); //Do our soundstate and picks random player. new victim = GetSomeoneUnworthy(); if(g_stormintensity) { //Is the delay up? if(g_strikedelay < get_gametime()) { //We got player to create lightning from? if(victim) { //Do our Lightning Technique. CreateLightningPoints(victim); } } } NEXTTHINK(weather_ent,2.0) } return PLUGIN_CONTINUE }
GetSomeoneUnworthy() { new cnt, id, total[33]; for(id=1;id if(is_user_alive(id)) if(is_user_outside(id)) { total[cnt++] = id; if(!g_soundstate[id]) { g_soundstate[id] = 1; client_cmd(id, "speak ambience/rain.wav"); } } else if(g_soundstate[id]) { g_soundstate[id] = 0; client_cmd(id, "speak NULL") } if(cnt) return total[random_num(0, (cnt-1))]; return 0; }
CreateLightningPoints(victim) { if(IS_VALID_ENT(g_lightpoints[0])) return 0; new ent, x, Float:tVel[3]; new Float:vOrig[3]; new Float:mins[3] = { -1.0, -1.0, -1.0 }; new Float:maxs[3] = { 1.0, 1.0, 1.0 }; new Float:dist = is_user_outside(victim)-5; //Get distance to set ents at. GET_ORIGIN(victim,vOrig) if(dist > 700.0) { //cap distance. dist = 700.0; } vOrig[2] += dist;
//Create lightning bolts by spreading X entities randomly with velocity for(x=0;x { ent = CREATE_ENTITY("env_sprite") SET_INT(ent,movetype,MOVETYPE_FLY) SET_INT(ent,solid,SOLID_TRIGGER) SET_FLOAT(ent,renderamt,0.0) SET_INT(ent,rendermode,kRenderTransAlpha) SET_MODEL(ent,"models/chick.mdl") SET_VECTOR(ent,mins,mins) SET_VECTOR(ent,maxs,maxs) tVel[0] = random_float(-500.0,500.0); tVel[1] = random_float(-500.0,500.0); tVel[2] = random_float((dist<=700.0?0.0:-100.0),(dist<=700.0?0.0:50.0)); SET_VECTOR(ent,origin,vOrig) SET_VECTOR(ent,velocity,tVel) g_lightpoints[x] = ent; } emit_sound(ent, CHAN_STREAM, "ambience/thunder_clap.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) set_task(random_float(0.6,2.0),"Lightning",victim); return 1; }
// Creating a beam at each entity consecutively. // Player has 1 in 1000 chance of getting struck ! public Lightning(victim) { new x, a, b, rand; new endpoint = MAX_LIGHT_POINTS-1; while(x < endpoint) { a = g_lightpoints[x]; b = g_lightpoints[x+1]; x++ if(x == endpoint) { rand = random_num(1,1000); //One unlucky son of a bish. if(rand == 1) { b = victim; FAKE_DAMAGE(victim,"Lightning",100.0,1); } } CreateBeam(a,b); } for(x=0;x if(IS_VALID_ENT(g_lightpoints[x])) REMOVE_ENTITY(g_lightpoints[x]) //Set up next lightning. if(g_stormintensity > 100) { set_cvar_num("weather_storm", 100); g_stormintensity = 100; } new Float:mins = 50.0-float(g_stormintensity/2); new Float:maxs = 50.0-float(g_stormintensity/3); g_strikedelay = get_gametime() + random_float(mins, maxs); }
//return distance above us to sky Float:is_user_outside(id) { new Float:origin[3], Float:dist; GET_ORIGIN(id, origin) dist = origin[2]; while (POINTCONTENTS(origin) == -1) origin[2] += 5.0;
if (POINTCONTENTS(origin) == -6) return (origin[2]-dist); return 0.0; }
CreateBeam(entA, entB) { message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); write_byte( 8 ); write_short( entA ); write_short( entB ); write_short( g_fxbeam ); write_byte(0); //start frame write_byte(10); //framerate write_byte(5); //life write_byte(; //width write_byte(100); //noise write_byte(255); //red write_byte(255); //green write_byte(255); //blue write_byte(255); //brightness write_byte(10); //scroll speed message_end(); }
Textu:
formati un text documents cu numele "ojos" si copiati urmatoarele in el:
- Citat :
- #if defined _engine_included
#define DISPATCH_KEYVALUE(%1,%2,%3) DispatchKeyValue(%1,%2,%3) #define SET_INT(%1,%2,%3) entity_set_int(%1,EV_INT_%2,%3) #define GET_INT(%1,%2) entity_get_int(%1, EV_INT_%2) #define SET_FLOAT(%1,%2,%3) entity_set_float(%1,EV_FL_%2,%3) #define GET_FLOAT(%1,%2) entity_get_float(%1,EV_FL_%2) #define SET_VECTOR(%1,%2,%3) entity_set_vector(%1,EV_VEC_%2,%3) #define GET_VECTOR(%1,%2,%3) entity_get_vector(%1,EV_VEC_%2,%3) #define SET_EDICT(%1,%2,%3) entity_set_edict(%1,EV_ENT_%2,%3) #define GET_EDICT(%1,%2,%3) entity_get_edict(%1,EV_ENT_%2,%3) #define SET_STRING(%1,%2,%3) entity_set_string(%1,EV_SZ_%2,%3) #define GET_STRING(%1,%2,%3,%4) entity_get_string(%1,EV_SZ_%2,%3,%4) #define FIND_ENT_BY_CLASS(%1,%2) find_ent_by_class(%1,%2) #define IS_VALID_ENT(%1) is_valid_ent(%1) #define CREATE_ENTITY(%1) create_entity(%1) #define REMOVE_ENTITY(%1) remove_entity(%1) #define SET_MODEL(%1,%2) entity_set_model(%1,%2) #define MDLL_SPAWN(%1) DispatchSpawn(%1) #define THINK(%1,%2) register_think(%1,%2) #define FAKE_TOUCH(%1,%2) fake_touch(%1,%2) #define POINTCONTENTS(%1) point_contents(%1) #define TRACE_LINE(%1,%2,%3,%4) trace_line(%1,%2,%3,%4) #else //Make sure its loaded #if !defined _fakemeta_included #include #endif stock DISPATCH_KEYVALUE(idEntity,szKeyName[],szValue[]) { set_kvd(0,KV_KeyName,szKeyName) set_kvd(0,KV_Value,szValue) set_kvd(0,KV_fHandled,0) return dllfunc(DLLFunc_KeyValue,idEntity,0) }
#define SET_INT(%1,%2,%3) set_pev(%1,pev_%2,%3) #define GET_INT(%1,%2) pev(%1,pev_%2) #define SET_FLOAT(%1,%2,%3) set_pev(%1,pev_%2,%3) #define GET_FLOAT(%1,%2) pev(%1,pev_%2) #define SET_VECTOR(%1,%2,%3) set_pev(%1,pev_%2,%3) #define GET_VECTOR(%1,%2,%3) pev(%1,pev_%2,%3) #define SET_EDICT(%1,%2,%3) set_pev(%1,pev_%2,%3) #define GET_EDICT(%1,%2,%3) pev(%1,pev_%2,%3) #define SET_STRING(%1,%2,%3) set_pev(%1,pev_%2,%3) #define GET_STRING(%1,%2,%3,%4) pev(%1,pev_%2,%3,%4) #define FIND_ENT_BY_CLASS(%1,%2) engfunc(EngFunc_FindEntityByString,%1,"classname",%2) #define IS_VALID_ENT(%1) pev_valid(%1) #define CREATE_ENTITY(%1) engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,%1)) #define REMOVE_ENTITY(%1) engfunc(EngFunc_RemoveEntity,%1) #define SET_MODEL(%1,%2) engfunc(EngFunc_SetModel,%1,%2) #define MDLL_SPAWN(%1) dllfunc(DLLFunc_Spawn,%1) #define THINK(%1,%2) register_forward(FM_Think,%2) #define FAKE_TOUCH(%1,%2) dllfunc(DLLFunc_Touch,%1,%2) #define POINTCONTENTS(%1) engfunc(EngFunc_PointContents,%1) #define TRACE_LINE(%1,%2,%3,%4) engfunc(EngFunc_TraceLine,%1,%2,%3,%4) #endif
#define NEXTTHINK(%1,%2) SET_FLOAT(%1,nextthink,get_gametime()+%2) #define GET_ORIGIN(%1,%2) GET_VECTOR(%1,origin,%2) #define SET_VISIBILE(%1,%2) SET_INT(%1,effects,%2==1?GET_INT(%1,effects)&~EF_NODRAW:GET_INT(%1,effects)|EF_NODRAW)
stock FAKE_DAMAGE(idvictim,szClassname[],Float:takedmgdamage,damagetype) { new entity = CREATE_ENTITY("trigger_hurt") if (entity) { new szDamage[16] format(szDamage,15,"%f",takedmgdamage * 2) DISPATCH_KEYVALUE(entity,"dmg",szDamage) format(szDamage,15,"%i",damagetype) DISPATCH_KEYVALUE(entity,"damagetype",szDamage) MDLL_SPAWN(entity) SET_STRING(entity,classname,szClassname) FAKE_TOUCH(entity,idvictim) REMOVE_ENTITY(entity) return 1 } return 0 } | |
|