SA-MP Forums Archive
[FilterScript] [FS]wheather system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] [FS]wheather system (/showthread.php?tid=148232)



[FS]wheather system - legodude - 16.05.2010

a simple and easy to read wheater system.
even begginers can see how it works.
maybe ima make a update with dialogs for admins.
cyu
code:
Код:
#define FILTERSCRIPT
#include <a_samp>
forward WheaterCalc();
forward WheaterUpdate();
new temp;
public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" random weather system by [LD]Legodude");
	print("--------------------------------------\n");
	SetTimer("WheaterCalc",60000, true);
 	temp = 6;
	return 1;
}

public OnFilterScriptExit()
{
  SetWeather(1);
  print("\n-------------------------------------------------");
	print(" weather system unloaded. weather is set to sunny");
	print("-------------------------------------------------\n");
	return 1;
}

public WheaterCalc()
{
	if(temp == 16)
	{
	  temp--;
	}
	else if(temp == 1)
	{
	  temp++;
	}
	else
	{
  	new positiveornegative = random(10000);
  	if(positiveornegative >= 5000)
  	{
  	  temp++;
  	}
  	else
  	{
  	  temp--;
  	}
	}
  CallLocalFunction("WheaterUpdate","");
	return 1;
}

public WheaterUpdate()
{
	switch(temp)
	{
	  case 1:
	  {
	    SetWeather(1);
	  }
	  case 4:
	  {
	    SetWeather(4);
	  }
	  case 8:
	  {
	    SetWeather(8);
	  }
	  case 9:
	  {
	    SetWeather(9);
	  }
	  case 16:
	  {
	    SetWeather(16);
	  }
	}
	return 1;
}



Re: [FS]wheather system - ^Woozie^ - 16.05.2010

LOL

Quote:

case 1:
{
SetWeather(1);
}
case 4:
{
SetWeather(4);
}
case 8:
{
SetWeather(;
}
case 9:
{
SetWeather(9);
}




Re: [FS]wheather system - legodude - 16.05.2010

add this if you want a Dialog too.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/weather", true))
	{
	  if(IsPlayerAdmin(playerid))//remove this if you dont want it admin only.
	  {
	  	ShowPlayerDialog(playerid, 3634, DIALOG_STYLE_LIST, "choose your wheater style", "sunny\ncloudy\nstormy\nfoggy\nrainy", "Select", "Cancel");
		}
		else
		{
		  SendClientMessage(playerid, 0xff000000, "You are not a admin!");
		}
		return 1;
	}
	return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  switch(dialogid)
  {
		case 3634:
		{
    	switch(temp)
			{
	  		case 1:
	  		{
	  		  PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
	  		  SetWeather(1);
	  		}
	  		case 2:
	  		{
	  		  PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
	  		  SetWeather(4);
	  		}
	  		case 3:
	  		{
	  		  PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
	  		  SetWeather(8);
	  		}
	  		case 4:
	  		{
	  			PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
	  		  SetWeather(9);
	  		}
	  		case 5:
	  		{
	  		  PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
	    		SetWeather(16);
	  		}
			}
    }
  }
  return 1;
}



Re: [FS]wheather system - legodude - 16.05.2010

Quote:
Originally Posted by ^Psy
LOL

Quote:

case 1:
{
SetWeather(1);
}
case 4:
{
SetWeather(4);
}
case 8:
{
SetWeather(;
}
case 9:
{
SetWeather(9);
}

now THATS a smiley fail from me XD


Re: [FS]wheather system - W00Z - 04.06.2010

An interesting script. I'd do it another way. With an array.


Re: [FS]wheather system - Shadow_ - 04.06.2010

Nice i suppose ... but nothing special ... it could be made differently and in my eyes there is better ways than this.




Re: [FS]wheather system - legodude - 10.06.2010

i had this idea a far long time ago

but then i failed and i started over again and it works noW!



Re: [FS]wheather system - Jofi - 11.06.2010

Quote:
Originally Posted by legodude
Quote:
Originally Posted by ^Psy
LOL

Quote:

case 1:
{
SetWeather(1);
}
case 4:
{
SetWeather(4);
}
case 8:
{
SetWeather(;
}
case 9:
{
SetWeather(9);
}

now THATS a smiley fail from me XD
I think he didn't mean that. Why you jump from case 1 to case 4 then 8 .......


Re: [FS]wheather system - Thrarod - 11.06.2010

Both


Re: [FS]wheather system - Hiddos - 11.06.2010

I'd say SetWeather(temp) instead of:

case 0: SetWeather(0)