SA-MP Forums Archive
Stuck On Weather Texdraws - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Stuck On Weather Texdraws (/showthread.php?tid=644157)



Stuck On Weather Texdraws - AgusZ - 04.11.2017

I dont know why this code didnt work.

First, i make a statement about textdraw will change based on weather.

Example : If weather rainy, the textdraw will show Rainy.

My code.

PHP код:
new Text:WeatherWeathers;
       
//OnGameModeInit
Weather TextDrawCreate(556.000000126.000000"");
TextDrawAlignment(Weather2);
TextDrawBackgroundColor(Weather255);
TextDrawFont(Weather2);
TextDrawLetterSize(Weather0.4200001.600000);
TextDrawColor(Weather, -1);
TextDrawSetOutline(Weather1);
TextDrawSetProportional(Weather1);
TextDrawSetSelectable(Weather0);
SetTimer("RandomWeathers"60000*3true);
//Function
forward RandomWeathers();
public 
RandomWeathers()
{
Weathers random(20);
SetWeather(Weathers);
switch(
Weathers)
{
              case 
0:
            {
                new 
string[50];
                
format(stringsizeof string"Sunny");
                
TextDrawSetString(Weatherstring);
            }
           case 
1:
            {
                new 
string[50];
                
format(stringsizeof string"Sunny");
                
TextDrawSetString(Weatherstring);
            } 
Anyone know why this code didnt work?


Re: Stuck On Weather Texdraws - TrueThing - 04.11.2017

this code looks good but you formatting string to sunny in both cases


Re: Stuck On Weather Texdraws - ExTaZZ69 - 04.11.2017

I suppose you have more than 2 cases in that switch. If not, you should catch all cases:
case 0: case 1: ... case 19: ... or case 1: .. case 2: .. default: ..

The problem is that you have to show the textdraw after you set a new string for it.
Use TextDrawShowForPlayer(playerid, Weather); or TextDrawShowForAll(Weather) after that "switch".


Re: Stuck On Weather Texdraws - AgusZ - 04.11.2017

I have found the problem, its a timer.

I've set the timer 6000 milisecond * 2, this is why the textdraw not showing.

But i made a new function for the textdraw for 1000 milisecond but the textdraw didnt matches from weather id, what can i do?