|
发表于 2004-12-2 19:49:10
|
显示全部楼层
来自 中国–河南–安阳
Post by youaibieku
你给我的那个天气变化的那个 我玩了 在DUST2里还可以下雨打雷 挺有意思的
我那天也不知道用的什么命令啊 那下雨的命令是什么啊???
还有就是下雨的时间能不能改 或是直接命令停雨啊
那天下雨没有完了 然后机子越来越卡 最后崩溃了 我挺喜欢玩黑夜的 哈哈
然后打着闪电
给你源码看看
#include <amxmodx>
#include <amxmisc>
#include <engine>
new gMsgScreenFade
new const monthname[12][32] = {"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"};
new const seasonname[4][32] = {"春", "夏", "秋", "冬"};
new const amname[2][32] = {"上午", "下午"};
new const monthdays[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
new minutes = 0;
new hour2 = 1;
new day2 = 1;
new month2 = 0;
new season = 1;
new year2 = 5;
new hightemp = 0;
new lowtemp = 0;
new starttemp = 0;
new temperature = 0;
new weathertype = 0;
new AM = 0;
new snow;
new light;
new timeofevent;
new lenghtofevent;
new bool:HeavySnow = true;
public dotime(){
minutes++;
if(minutes == (get_cvar_num("sv_minutelength"))){
hour2++;
minutes = 0;
updatetemp()
updatelights()
}
if((hour2 == timeofevent) || ((AM == 1) && ((hour2+12) == timeofevent))){
if(weathertype == 5){
new all[32], inum
get_players(all,inum)
for (new i=0;i<inum;++i) {
Flash(all)
}
timeofevent = 28
}
if(weathertype == 1){
if(season == 4){
new ran
ran = random_num(1,4)
if(ran == 1){
set_task(0.5,"snowfall",0,"",0,"a",lenghtofevent * 120)
}else if(ran == 2){
set_task(0.5,"rain_heavy",0,"",0,"a",lenghtofevent * 120)
set_task(2.0,"rain_t",0,"",0,"a",lenghtofevent * 30)
}else if(ran == 3){
set_task(0.5,"rain_light",0,"",0,"a",lenghtofevent * 120)
set_task(2.0,"rain_t",0,"",0,"a",lenghtofevent * 30)
}else if(ran == 4){
set_task(0.5,"t_storm",0,"",0,"a",lenghtofevent * 120)
}
}
if((season == 3) || (season == 1)){
new ran
ran = random_num(2,4)
if(ran == 2){
set_task(0.5,"rain_heavy",0,"",0,"a",lenghtofevent * 120)
set_task(2.0,"rain_t",0,"",0,"a",lenghtofevent * 30)
}else if(ran == 3){
set_task(0.5,"rain_light",0,"",0,"a",lenghtofevent * 120)
set_task(2.0,"rain_t",0,"",0,"a",lenghtofevent * 30)
}else if(ran == 4){
set_task(0.5,"t_storm",0,"",0,"a",lenghtofevent * 120)
}
}
if(season == 2){
new ran
ran = random_num(2,4)
if(ran == 2){
set_task(0.5,"rain_heavy",0,"",0,"a",lenghtofevent * 120)
set_task(2.0,"rain_t",0,"",0,"a",lenghtofevent * 30)
set_task(0.5,"t_storm",0,"",0,"a",lenghtofevent * 120)
}else if(ran == 3){
set_task(0.5,"rain_light",0,"",0,"a",lenghtofevent * 120)
set_task(2.0,"rain_t",0,"",0,"a",lenghtofevent * 30)
}else if(ran == 4){
set_task(0.5,"t_storm",0,"",0,"a",lenghtofevent * 120)
}
}
}
}
if((hour2 >= 13) && (AM == 0)){
AM = 1
hour2 = 1;
}
if((hour2 >= 13) && (AM == 1)){
AM = 0
day2++;
dailytemp()
hour2 = 1;
}
if(day2 >= monthdays[month2]){
month2++;
day2 = 1;
}
if(month2 == 3){
season = 1
}
if(month2 == 5){
season = 2
}
if(month2 == 9){
season = 3
}
if(month2 == 11){
season = 4
}
if(month2 >= 12){
year2++;
month2 = 0;
}
if(year2 >= 100) year2 = 0;
set_hudmessage(175,175,175,-1.0,-0.02,0,0.0,999999.0,0.0,0.0,4);
new yearformat[64];
if(year2 < 10) format(yearformat,64,"200%d",year2);
if(year2 >= 10) format(yearformat,64,"20%d",year2);
new minuteformat[64], tempformat[64];
if(minutes < 10) format(minuteformat,64,"0%d",minutes);
if(minutes >= 10) format(minuteformat,64,"%d",minutes);
format(tempformat,64,"%d",temperature);
show_hudmessage(0,"%d:%s %s %s %d, %s of %s with a temp of %s degree's",hour2,minuteformat,amname[AM],monthname[month2],day2,seasonname[season],yearformat, tempformat);
return PLUGIN_HANDLED;
}
public dailytemp(){
weathertype = random_num(1,5)
if(season == 1){
if(weathertype == 1){
hightemp = random_num(66,70)
lowtemp = random_num(40,55)
starttemp = random_num(lowtemp,hightemp)
timeofevent = random_num(3,19)
lenghtofevent = random_num(1,5)
}
if((weathertype == 2) || (weathertype == 3) || (weathertype == 4)){
hightemp = random_num(66,80)
lowtemp = random_num(40,60)
starttemp = random_num(lowtemp,hightemp)
}
if(weathertype == 5){
hightemp = random_num(66,90)
lowtemp = random_num(50,60)
starttemp = random_num(lowtemp,hightemp)
timeofevent = random_num(11,14)
lenghtofevent = random_num(1,3)
}
}
if(season == 2){
if(weathertype == 1){
hightemp = random_num(66,70)
lowtemp = random_num(40,55)
starttemp = random_num(lowtemp,hightemp)
timeofevent = random_num(3,18)
lenghtofevent = random_num(1,6)
}
if((weathertype == 2) || (weathertype == 3) || (weathertype == 4)){
hightemp = random_num(66,80)
lowtemp = random_num(40,60)
starttemp = random_num(lowtemp,hightemp)
}
if(weathertype == 5){
hightemp = random_num(66,90)
lowtemp = random_num(50,60)
starttemp = random_num(lowtemp,hightemp)
timeofevent = random_num(11,14)
lenghtofevent = random_num(1,4)
}
}
if(season == 3){
if(weathertype == 1){
hightemp = random_num(66,70)
lowtemp = random_num(40,55)
starttemp = random_num(lowtemp,hightemp)
timeofevent = random_num(3,17)
lenghtofevent = random_num(1,5)
}
if((weathertype == 2) || (weathertype == 3) || (weathertype == 4)){
hightemp = random_num(66,80)
lowtemp = random_num(40,60)
starttemp = random_num(lowtemp,hightemp)
}
if(weathertype == 5){
hightemp = random_num(66,90)
lowtemp = random_num(50,60)
starttemp = random_num(lowtemp,hightemp)
timeofevent = random_num(11,14)
lenghtofevent = random_num(1,3)
}
}
if(season == 4){
if(weathertype == 1){
hightemp = random_num(66,70)
lowtemp = random_num(40,55)
starttemp = random_num(lowtemp,hightemp)
timeofevent = random_num(3,15)
lenghtofevent = random_num(1,7)
}
if((weathertype == 2) || (weathertype == 3) || (weathertype == 4)){
hightemp = random_num(66,80)
lowtemp = random_num(40,60)
starttemp = random_num(lowtemp,hightemp)
}
if(weathertype == 5){
hightemp = random_num(66,90)
lowtemp = random_num(50,60)
starttemp = random_num(lowtemp,hightemp)
timeofevent = random_num(11,14)
lenghtofevent = random_num(1,2)
}
}
return PLUGIN_CONTINUE
}
public updatetemp(){
if(hour2 == 6){ //If its 6, make it starttemp
temperature = starttemp
}
if((hour2 < 4) && (AM == 0)){ // If its really early, only add a few
temperature = ((lowtemp + starttemp) / 2) + hour2
}
if((hour2 < 6) && (AM == 0)){ //If its between 4 and 6, then start jackin up the temp
temperature = ((lowtemp + hour2) + starttemp) / 2
}
if((hour2 > 6) && (AM == 0)){ //If its more then six in the morning, start adding on
temperature = (((hightemp + lowtemp)/2) + hour2 + starttemp) / 2
}
if((hour2 < 4) && (AM == 1)){ // If its the after noon, keep adding to the temp
temperature = (((hightemp + lowtemp)/2) + hour2 + starttemp) / 2
}
if((hour2 > 6) && (AM == 1)){ //If its after six, start taking off
temperature = ((lowtemp - hour2) + starttemp) / 2
}
if((hour2 < 6) && (AM == 1)){ //If its night, then start taking off
temperature = (((hightemp + lowtemp)/2) - hour2 + starttemp) / 2
}
return PLUGIN_CONTINUE
}
public updatelights()
{
if ( !get_cvar_num("sv_daylightchange") )
return PLUGIN_CONTINUE
new iHours
new szLights[2] = "m"
if(AM == 0){
iHours = hour2
}
if(AM == 1){
iHours = hour2 + 12
}
if((season == 1) || (season == 3)){
if(weathertype == 1){
switch(iHours)
{
case 0:szLights = "c"
case 1:szLights = "c"
case 2:szLights = "d"
case 3:szLights = "e"
case 4:szLights = "g"
case 5:szLights = "i"
case 6:szLights = "k"
case 7:szLights = "l"
case 8:szLights = "n"
case 9:szLights = "q"
case 10:szLights = "s"
case 11:szLights = "r"
case 12:szLights = "s"
case 13:szLights = "t"
case 14:szLights = "r"
case 15:szLights = "s"
case 16:szLights = "q"
case 17:szLights = "n"
case 18:szLights = "h"
case 19:szLights = "g"
case 20:szLights = "f"
case 21:szLights = "e"
case 22:szLights = "d"
case 23:szLights = "d"
case 24:szLights = "c"
case 25:szLights = "c"
}
}
if((weathertype == 2) || (weathertype == 3) || (weathertype == 4)){
switch(iHours)
{
case 0:szLights = "c"
case 1:szLights = "c"
case 2:szLights = "d"
case 3:szLights = "e"
case 4:szLights = "g"
case 5:szLights = "i"
case 6:szLights = "k"
case 7:szLights = "m"
case 8:szLights = "o"
case 9:szLights = "q"
case 10:szLights = "s"
case 11:szLights = "u"
case 12:szLights = "w"
case 13:szLights = "v"
case 14:szLights = "u"
case 15:szLights = "s"
case 16:szLights = "q"
case 17:szLights = "o"
case 18:szLights = "k"
case 19:szLights = "g"
case 20:szLights = "f"
case 21:szLights = "e"
case 22:szLights = "d"
case 23:szLights = "d"
case 24:szLights = "c"
case 25:szLights = "c"
}
}
if(weathertype == 5){
switch(iHours)
{
case 0:szLights = "c"
case 1:szLights = "c"
case 2:szLights = "d"
case 3:szLights = "e"
case 4:szLights = "g"
case 5:szLights = "j"
case 6:szLights = "k"
case 7:szLights = "n"
case 8:szLights = "o"
case 9:szLights = "q"
case 10:szLights = "s"
case 11:szLights = "u"
case 12:szLights = "w"
case 13:szLights = "v"
case 14:szLights = "w"
case 15:szLights = "s"
case 16:szLights = "q"
case 17:szLights = "o"
case 18:szLights = "m"
case 19:szLights = "h"
case 20:szLights = "f"
case 21:szLights = "e"
case 22:szLights = "d"
case 23:szLights = "d"
case 24:szLights = "c"
case 25:szLights = "c"
}
}
}
if(season == 2){
if(weathertype == 1){
switch(iHours)
{
case 0:szLights = "c"
case 1:szLights = "c"
case 2:szLights = "d"
case 3:szLights = "e"
case 4:szLights = "g"
case 5:szLights = "i"
case 6:szLights = "k"
case 7:szLights = "l"
case 8:szLights = "n"
case 9:szLights = "o"
case 10:szLights = "s"
case 11:szLights = "r"
case 12:szLights = "t"
case 13:szLights = "u"
case 14:szLights = "t"
case 15:szLights = "s"
case 16:szLights = "o"
case 17:szLights = "n"
case 18:szLights = "h"
case 19:szLights = "g"
case 20:szLights = "f"
case 21:szLights = "e"
case 22:szLights = "d"
case 23:szLights = "d"
case 24:szLights = "c"
case 25:szLights = "c"
}
}
if((weathertype == 2) || (weathertype == 3) || (weathertype == 4)){
switch(iHours)
{
case 0:szLights = "c"
case 1:szLights = "c"
case 2:szLights = "d"
case 3:szLights = "e"
case 4:szLights = "g"
case 5:szLights = "j"
case 6:szLights = "m"
case 7:szLights = "n"
case 8:szLights = "o"
case 9:szLights = "q"
case 10:szLights = "s"
case 11:szLights = "u"
case 12:szLights = "w"
case 13:szLights = "x"
case 14:szLights = "w"
case 15:szLights = "u"
case 16:szLights = "s"
case 17:szLights = "o"
case 18:szLights = "m"
case 19:szLights = "k"
case 20:szLights = "g"
case 21:szLights = "e"
case 22:szLights = "d"
case 23:szLights = "d"
case 24:szLights = "c"
case 25:szLights = "c"
}
}
if(weathertype == 5){
switch(iHours)
{
case 0:szLights = "c"
case 1:szLights = "c"
case 2:szLights = "d"
case 3:szLights = "f"
case 4:szLights = "g"
case 5:szLights = "j"
case 6:szLights = "k"
case 7:szLights = "n"
case 8:szLights = "o"
case 9:szLights = "r"
case 10:szLights = "t"
case 11:szLights = "u"
case 12:szLights = "v"
case 13:szLights = "x"
case 14:szLights = "v"
case 15:szLights = "u"
case 16:szLights = "q"
case 17:szLights = "o"
case 18:szLights = "n"
case 19:szLights = "h"
case 20:szLights = "g"
case 21:szLights = "f"
case 22:szLights = "d"
case 23:szLights = "d"
case 24:szLights = "c"
case 25:szLights = "c"
}
}
}
if(season == 4){
if(weathertype == 1){
switch(iHours)
{
case 0:szLights = "b"
case 1:szLights = "c"
case 2:szLights = "d"
case 3:szLights = "e"
case 4:szLights = "f"
case 5:szLights = "g"
case 6:szLights = "j"
case 7:szLights = "k"
case 8:szLights = "l"
case 9:szLights = "m"
case 10:szLights = "p"
case 11:szLights = "r"
case 12:szLights = "t"
case 13:szLights = "s"
case 14:szLights = "r"
case 15:szLights = "p"
case 16:szLights = "o"
case 17:szLights = "n"
case 18:szLights = "h"
case 19:szLights = "g"
case 20:szLights = "f"
case 21:szLights = "e"
case 22:szLights = "d"
case 23:szLights = "d"
case 24:szLights = "c"
case 25:szLights = "c"
}
}
if((weathertype == 2) || (weathertype == 3) || (weathertype == 4)){
switch(iHours)
{
case 0:szLights = "b"
case 1:szLights = "c"
case 2:szLights = "d"
case 3:szLights = "e"
case 4:szLights = "f"
case 5:szLights = "g"
case 6:szLights = "j"
case 7:szLights = "k"
case 8:szLights = "l"
case 9:szLights = "m"
case 10:szLights = "q"
case 11:szLights = "r"
case 12:szLights = "s"
case 13:szLights = "r"
case 14:szLights = "p"
case 15:szLights = "q"
case 16:szLights = "o"
case 17:szLights = "m"
case 18:szLights = "h"
case 19:szLights = "g"
case 20:szLights = "f"
case 21:szLights = "e"
case 22:szLights = "d"
case 23:szLights = "d"
case 24:szLights = "c"
case 25:szLights = "c"
}
}
if(weathertype == 5){
switch(iHours)
{
case 0:szLights = "b"
case 1:szLights = "c"
case 2:szLights = "d"
case 3:szLights = "f"
case 4:szLights = "g"
case 5:szLights = "j"
case 6:szLights = "k"
case 7:szLights = "n"
case 8:szLights = "o"
case 9:szLights = "r"
case 10:szLights = "s"
case 11:szLights = "t"
case 12:szLights = "u"
case 13:szLights = "s"
case 14:szLights = "r"
case 15:szLights = "p"
case 16:szLights = "q"
case 17:szLights = "n"
case 18:szLights = "m"
case 19:szLights = "h"
case 20:szLights = "g"
case 21:szLights = "f"
case 22:szLights = "d"
case 23:szLights = "d"
case 24:szLights = "c"
case 25:szLights = "c"
}
}
}
set_lights(szLights)
return PLUGIN_CONTINUE
}
public changelights(id,level,cid)
{
if (!cmd_access(id,level,cid,0))
return PLUGIN_CONTINUE
new arg[3]
read_argv(1,arg,2)
new inum = str_to_num(arg)
if (inum < 1 || inum > 26 )
return PLUGIN_HANDLED
set_Light( inum )
console_print(id,"[AMXX] Light Change Successful.")
return PLUGIN_HANDLED
}
public set_Light ( level )
{
new szLights[2]
switch( level )
{
case 1:szLights = "a"
case 2:szLights = "b"
case 3:szLights = "c"
case 4:szLights = "d"
case 5:szLights = "e"
case 6:szLights = "f"
case 7:szLights = "g"
case 8:szLights = "h"
case 9:szLights = "i"
case 10:szLights = "j"
case 11:szLights = "k"
case 12:szLights = "l"
case 13:szLights = "m"
case 14:szLights = "n"
case 15:szLights = "o"
case 16:szLights = "p"
case 17:szLights = "q"
case 18:szLights = "r"
case 19:szLights = "s"
case 20:szLights = "t"
case 21:szLights = "u"
case 22:szLights = "v"
case 23:szLights = "w"
case 24:szLights = "x"
case 25:szLights = "y"
case 26:szLights = "z"
}
set_lights(szLights)
}
public monthup(id){
new arg[32]
read_argv(1,arg,31)
month2+=str_to_num(arg);
if(month2 >= 12){
year2++;
month2 = 0;
}
new yearformat[64];
if(year2 < 10) format(yearformat,64,"200%d",year2);
if(year2 >= 10) format(yearformat,64,"20%d",year2);
new minuteformat[64];
if(minutes < 10) format(minuteformat,64,"0%d",minutes);
if(minutes >= 10) format(minuteformat,64,"%d",minutes);
updatelights()
return PLUGIN_HANDLED;
}
public yearup(id){
new arg[32]
read_argv(1,arg,31)
year2+=str_to_num(arg);
new yearformat[64];
if(year2 < 10) format(yearformat,64,"200%d",year2);
if(year2 >= 10) format(yearformat,64,"20%d",year2);
new minuteformat[64];
if(minutes < 10) format(minuteformat,64,"0%d",minutes);
if(minutes >= 10) format(minuteformat,64,"%d",minutes);
updatelights()
return PLUGIN_HANDLED;
}
public hourup(id){
new arg[32]
read_argv(1,arg,31)
hour2+=str_to_num(arg);
if(hour2 >= 24){
day2++;
hour2 = 0;
}
new yearformat[64];
if(year2 < 10) format(yearformat,64,"200%d",year2);
if(year2 >= 10) format(yearformat,64,"20%d",year2);
new minuteformat[64];
if(minutes < 10) format(minuteformat,64,"0%d",minutes);
if(minutes >= 10) format(minuteformat,64,"%d",minutes);
updatelights()
return PLUGIN_HANDLED;
}
public dayup(id){
new arg[32]
read_argv(1,arg,31)
day2+=str_to_num(arg);
if(day2 >= monthdays[month2]){
month2++;
day2 = 0;
}
new yearformat[64];
if(year2 < 10) format(yearformat,64,"200%d",year2);
if(year2 >= 10) format(yearformat,64,"20%d",year2);
new minuteformat[64];
if(minutes < 10) format(minuteformat,64,"0%d",minutes);
if(minutes >= 10) format(minuteformat,64,"%d",minutes);
updatelights()
return PLUGIN_HANDLED;
}
public reset_time(){
if(file_exists("time.ini") == 1){
new minutez[100], hourz[24], dayz[32], monthz[12], yearz[999], size
read_file("time.ini",1,minutez,2,size)
read_file("time.ini",2,hourz,2,size)
read_file("time.ini",3,dayz,2,size)
read_file("time.ini",4,monthz,2,size)
read_file("time.ini",5,yearz,3,size)
minutes = str_to_num(minutez)
hour2 = str_to_num(hourz)
day2 = str_to_num(dayz)
month2 = str_to_num(monthz)
year2 = str_to_num(yearz)
}else{
new minutez[100], hourz[24], dayz[32], monthz[12], yearz[999]
num_to_str(minutes, minutez,2)
num_to_str(hour2, hourz,2)
num_to_str(day2, dayz,2)
num_to_str(month2, monthz,2)
num_to_str(year2, yearz,3)
write_file("time.ini",minutez,1)
write_file("time.ini",hourz,2)
write_file("time.ini",dayz,3)
write_file("time.ini",monthz,4)
write_file("time.ini",yearz,5)
}
return PLUGIN_CONTINUE
}
public write_time(){
if(file_exists("time.ini") == 1){
new minutez[100], hourz[24], dayz[32], monthz[12], yearz[999]
num_to_str(minutes, minutez,2)
num_to_str(hour2, hourz,2)
num_to_str(day2, dayz,2)
num_to_str(month2, monthz,2)
num_to_str(year2, yearz,3)
write_file("time.ini",minutez,1)
write_file("time.ini",hourz,2)
write_file("time.ini",dayz,3)
write_file("time.ini",monthz,4)
write_file("time.ini",yearz,5)
}else{
new minutez[100], hourz[24], dayz[32], monthz[12], yearz[999]
num_to_str(minutes, minutez,2)
num_to_str(hour2, hourz,2)
num_to_str(day2, dayz,2)
num_to_str(month2, monthz,2)
num_to_str(year2, yearz,3)
write_file("time.ini",minutez,1)
write_file("time.ini",hourz,2)
write_file("time.ini",dayz,3)
write_file("time.ini",monthz,4)
write_file("time.ini",yearz,5)
}
return PLUGIN_CONTINUE
}
public lightning(xy[]){
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 0 )
write_coord(xy[0])
write_coord(xy[1])
write_coord(4000)
write_coord(xy[0])
write_coord(xy[1])
write_coord(-2000)
write_short( light )
write_byte( 1 ) // framestart
write_byte( 5 ) // framerate
write_byte( 2 ) // life
write_byte( 150 ) // width
write_byte( 20 ) // noise
write_byte( 200 ) // r, g, b
write_byte( 200 ) // r, g, b
write_byte( 255 ) // r, g, b
write_byte( 200 ) // brightness
write_byte( 200 ) //
message_end()
return PLUGIN_CONTINUE
}
public sqrt(num) {
new div = num
new result = 1
while (div > result) { // end when div == result, or just below
div = (div + result) / 2 // take mean value as new divisor
result = num / div
}
return div
}
public Flash(id) {
message_begin(MSG_ONE,gMsgScreenFade,{0,0,0},id)
write_short( 1<<15 )
write_short( 1<<10 )
write_short( 1<<12 )
write_byte( 255 )
write_byte( 255 )
write_byte( 255 )
write_byte( 255 )
message_end()
}
public t_storm(){
new chances = random_num(0,4)
if(chances > 2){
new xy[2]
xy[0] = random_num(-2200,2200)
xy[1] = random_num(-2200,2200)
set_task(0.3,"lightning",1324,xy,2,"a",6)
client_cmd(0, "spk ambience/thunder_clap.wav")
}
return PLUGIN_HANDLED
}
public rain_t(){
client_cmd(0,"spk ambience/sandfall1")
new chances = random_num(0,4)
if(chances > 2){
new xy[2]
xy[0] = random_num(-2200,2200)
xy[1] = random_num(-2200,2200)
set_task(0.3,"lightning",1324,xy,2,"a",6)
client_cmd(0, "spk ambience/thunder_clap.wav")
}
return PLUGIN_HANDLED
}
public snowfall(){
new vec[3]
new aimvec[3]
new snoweffvec[3]
new snoweffvec2[3]
new snoweffvec3[3]
new length
new speed = 50
new speed2 = 150
new speed3 = 320
new players[32], inum
get_players(players,inum,"c")
for(new i = 0 ;i < inum; ++i){
get_user_origin(players,vec)
get_user_origin(players,aimvec,2)
snoweffvec[0]=aimvec[0]-vec[0]
snoweffvec[1]=aimvec[1]-vec[1]
snoweffvec[2]=aimvec[2]-vec[2]
length=sqrt(snoweffvec[0]*snoweffvec[0]+snoweffvec[1]*snoweffvec[1]+snoweffvec[2]*snoweffvec[2])
snoweffvec2[0]=snoweffvec[0]*speed2/length
snoweffvec2[1]=snoweffvec[1]*speed2/length
snoweffvec2[2]=snoweffvec[2]*speed2/length
snoweffvec3[0]=snoweffvec[0]*speed3/length
snoweffvec3[1]=snoweffvec[1]*speed3/length
snoweffvec3[2]=snoweffvec[2]*speed3/length
//TE_SPRITE
if(HeavySnow == true){
snoweffvec[0]=snoweffvec[0]*speed/length
snoweffvec[1]=snoweffvec[1]*speed/length
snoweffvec[2]=snoweffvec[2]*speed/length
message_begin( MSG_ONE,SVC_TEMPENTITY,{0,0,0},players)
write_byte( 17 ) // additive sprite, plays 1 cycle
write_coord(snoweffvec[0]+vec[0])
write_coord(snoweffvec[1]+vec[1])
write_coord(snoweffvec[2]+vec[2])
write_short( snow )
write_byte( 14 ) // byte (scale in 0.1's)
write_byte( 255 ) // byte (brightness)
message_end()
}
message_begin( MSG_ONE,SVC_TEMPENTITY,{0,0,0},players)
write_byte( 17 ) // additive sprite, plays 1 cycle
write_coord(snoweffvec2[0]+vec[0])
write_coord(snoweffvec2[1]+vec[1])
write_coord(snoweffvec2[2]+vec[2])
write_short( snow )
write_byte( 30 ) // byte (scale in 0.1's)
write_byte( 255 ) // byte (brightness)
message_end()
message_begin( MSG_ONE,SVC_TEMPENTITY,{0,0,0},players)
write_byte( 17 ) // additive sprite, plays 1 cycle
write_coord(snoweffvec3[0]+vec[0])
write_coord(snoweffvec3[1]+vec[1])
write_coord(snoweffvec3[2]+vec[2])
write_short( snow )
write_byte( 60 ) // byte (scale in 0.1's)
write_byte( 255 ) // byte (brightness)
message_end()
if(HeavySnow == true){
message_begin( MSG_ONE,SVC_TEMPENTITY,{0,0,0},players)
write_byte( 17 ) // additive sprite, plays 1 cycle
write_coord(snoweffvec3[0]+vec[0])
write_coord(snoweffvec3[1]+vec[1])
write_coord(snoweffvec3[2]+vec[2])
write_short( snow )
write_byte( 30 ) // byte (scale in 0.1's)
write_byte( 255 ) // byte (brightness)
message_end()
}
}
return PLUGIN_HANDLED
}
public rain_light(){
new players[32], inum
get_players(players,inum,"")
for(new i = 0; i < inum; i++) {
new vec[3]
new aimvec[3]
new snoweffvec[3]
new snoweffvec2[3]
new snoweffvec3[3]
new rainx, rainy
new rainx2, rainy2
new length
new speed = 50
new speed2 = 150
new speed3 = 320
get_user_origin(players,vec)
get_user_origin(players,aimvec,2)
snoweffvec[0]=aimvec[0]-vec[0]
snoweffvec[1]=aimvec[1]-vec[1]
snoweffvec[2]=aimvec[2]-vec[2]
length=sqrt(snoweffvec[0]*snoweffvec[0]+snoweffvec[1]*snoweffvec[1]+snoweffvec[2]*snoweffvec[2])
snoweffvec2[0]=snoweffvec[0]*speed2/length
snoweffvec2[1]=snoweffvec[1]*speed2/length
snoweffvec2[2]=snoweffvec[2]*speed2/length
snoweffvec3[0]=snoweffvec[0]*speed3/length
snoweffvec3[1]=snoweffvec[1]*speed3/length
snoweffvec3[2]=snoweffvec[2]*speed3/length
snoweffvec[0]=snoweffvec[0]*speed/length
snoweffvec[1]=snoweffvec[1]*speed/length
snoweffvec[2]=snoweffvec[2]*speed/length
rainx = random_num( ((snoweffvec[0]+vec[0])-50),((snoweffvec[0]+vec[0])+50) )
rainx2 = random_num( ((snoweffvec2[0]+vec[0])-50),((snoweffvec2[0]+vec[0])+50) )
rainy = random_num( ((snoweffvec[1]+vec[1])-50),((snoweffvec[1]+vec[1])+50) )
rainy2 = random_num( ((snoweffvec2[1]+vec[1])-50),((snoweffvec2[1]+vec[1])+50) )
//TE_STREAK_SPLASH
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 25 ) // oriented shower of tracers
write_coord(rainx)
write_coord(rainy)
write_coord(2000)
write_coord(0) // (direction vector)
write_coord(0)
write_coord(-2000)
write_byte( 7 ) // color
write_short( 1 ) // count
write_short( 10 ) // base speed
write_short( 10 ) // random velocty
message_end()
//TE_STREAK_SPLASH
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 25 ) // oriented shower of tracers
write_coord(rainx2)
write_coord(rainy2)
write_coord(2000)
write_coord(0) // (direction vector)
write_coord(0)
write_coord(-2000)
write_byte( 7 ) // color
write_short( 1 ) // count
write_short( 10 ) // base speed
write_short( 10 ) // random velocty
message_end()
}
return PLUGIN_HANDLED
}
public rain_heavy(){
new players[32], inum
get_players(players,inum,"")
for(new i = 0; i < inum; i++) {
new vec[3]
new aimvec[3]
new snoweffvec[3]
new snoweffvec2[3]
new snoweffvec3[3]
new rainx, rainy
new rainx2, rainy2
new rainx3, rainy3
new rainx4, rainy4
new rainx5, rainy5
new length
new speed = 50
new speed2 = 150
new speed3 = 320
get_user_origin(players,vec)
get_user_origin(players,aimvec,2)
snoweffvec[0]=aimvec[0]-vec[0]
snoweffvec[1]=aimvec[1]-vec[1]
snoweffvec[2]=aimvec[2]-vec[2]
length=sqrt(snoweffvec[0]*snoweffvec[0]+snoweffvec[1]*snoweffvec[1]+snoweffvec[2]*snoweffvec[2])
snoweffvec2[0]=snoweffvec[0]*speed2/length
snoweffvec2[1]=snoweffvec[1]*speed2/length
snoweffvec2[2]=snoweffvec[2]*speed2/length
snoweffvec3[0]=snoweffvec[0]*speed3/length
snoweffvec3[1]=snoweffvec[1]*speed3/length
snoweffvec3[2]=snoweffvec[2]*speed3/length
snoweffvec[0]=snoweffvec[0]*speed/length
snoweffvec[1]=snoweffvec[1]*speed/length
snoweffvec[2]=snoweffvec[2]*speed/length
rainx = random_num( ((snoweffvec[0]+vec[0])-50),((snoweffvec[0]+vec[0])+50) )
rainx2 = random_num( ((snoweffvec2[0]+vec[0])-50),((snoweffvec2[0]+vec[0])+50) )
rainx3 = random_num( ((snoweffvec3[0]+vec[0])-50),((snoweffvec3[0]+vec[0])+50) )
rainx4 = random_num( ((snoweffvec3[0]+vec[0])-100),((snoweffvec3[0]+vec[0])+100) )
rainx5 = random_num( ((snoweffvec3[0]+vec[0])-100),((snoweffvec3[0]+vec[0])+100) )
rainy = random_num( ((snoweffvec[1]+vec[1])-50),((snoweffvec[1]+vec[1])+50) )
rainy2 = random_num( ((snoweffvec2[1]+vec[1])-50),((snoweffvec2[1]+vec[1])+50) )
rainy3 = random_num( ((snoweffvec3[1]+vec[1])-50),((snoweffvec3[1]+vec[1])+50) )
rainy4 = random_num( ((snoweffvec3[1]+vec[1])-100),((snoweffvec3[1]+vec[1])+100) )
rainy5 = random_num( ((snoweffvec3[1]+vec[1])-100),((snoweffvec3[1]+vec[1])+100) )
//TE_STREAK_SPLASH
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 25 ) // oriented shower of tracers
write_coord(rainx)
write_coord(rainy)
write_coord(2000)
write_coord(0) // (direction vector)
write_coord(0)
write_coord(-2000)
write_byte( 7 ) // color
write_short( 1 ) // count
write_short( 10 ) // base speed
write_short( 10 ) // random velocty
message_end()
//TE_STREAK_SPLASH
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 25 ) // oriented shower of tracers
write_coord(rainx2)
write_coord(rainy2)
write_coord(2000)
write_coord(0) // (direction vector)
write_coord(0)
write_coord(-2000)
write_byte( 7 ) // color
write_short( 1 ) // count
write_short( 10 ) // base speed
write_short( 10 ) // random velocty
message_end()
//TE_STREAK_SPLASH
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 25 ) // oriented shower of tracers
write_coord(rainx3)
write_coord(rainy3)
write_coord(2000)
write_coord(0) // (direction vector)
write_coord(0)
write_coord(-2000)
write_byte( 7 ) // color
write_short( 1 ) // count
write_short( 10 ) // base speed
write_short( 10 ) // random velocty
message_end()
//TE_STREAK_SPLASH
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 25 ) // oriented shower of tracers
write_coord(rainx4)
write_coord(rainy4)
write_coord(2000)
write_coord(0) // (direction vector)
write_coord(0)
write_coord(-2000)
write_byte( 7 ) // color
write_short( 1 ) // count
write_short( 10 ) // base speed
write_short( 10 ) // random velocty
message_end()
//TE_STREAK_SPLASH
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 25 ) // oriented shower of tracers
write_coord(rainx5)
write_coord(rainy5)
write_coord(2000)
write_coord(0) // (direction vector)
write_coord(0)
write_coord(-2000)
write_byte( 7 ) // color
write_short( 1 ) // count
write_short( 10 ) // base speed
write_short( 10 ) // random velocty
message_end()
}
return PLUGIN_HANDLED
}
public plugin_precache() {
snow = precache_model("sprites/snow.spr")
light = precache_model("sprites/lgtning.spr")
return PLUGIN_CONTINUE
}
public plugin_init()
{
register_plugin("Daylight Changer","1.1.7","Edit by Mel")
register_concmd("monthup","monthup",ADMIN_LEVEL_E);
register_concmd("yearup","yearup",ADMIN_LEVEL_E);
register_concmd("hourup","hourup",ADMIN_LEVEL_E);
register_concmd("dayup","dayup",ADMIN_LEVEL_E);
register_concmd("record_time","write_time",ADMIN_LEVEL_E);
set_task(1.0,"dotime",0,"",0,"b",99999);
register_concmd("amx_setlight","changelights",ADMIN_RCON," 0 ( Dark ) to 26 ( ExtraLight )")
register_cvar("sv_daylightchange", "1")
register_cvar("sv_minutelength", "60")
gMsgScreenFade = get_user_msgid("ScreenFade")
dailytemp()
updatetemp()
reset_time()
return PLUGIN_CONTINUE
} |
|