Temperature
#1

Код:
Temperature[playerid] -= 0.1;			 
if(Temperature[playerid] == 31.0) SM(playerid,0x00FF00FF,"{B9BCBD}TEST");
else if(Temperature[playerid] == 24.0)
{
	SM(playerid,0x00FF00FF,"{B9BCBD}TEST");
	Temperature[playerid] = 36.6;
	SetPlayerHealth(playerid, 0);
}
(Timer 1 second)
Textdraw show correctly temperature.

PROBLEM:Message not display when temperature of player is 31.0
and when Temperature of Player is 24.0 Message also not display and player not death!

SORRY FOR MY BAD ENGLISH!
Reply
#2

hmm you should show us more bit of your code buddy.
Reply
#3

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
hmm you should show us more bit of your code buddy.
Код:
new Float:Temperature[MAX_PLAYERS];
OnPlayerConnect & OnPlayerDisconnect:
Код:
Temperature[playerid] = 36.6;
Timer one second:
Код:
new temperature[128];
format(temperature,sizeof(temperature),"Temperature:%0.1f",Temperature[playerid]);
PlayerTextDrawSetString(playerid, HudTD[playerid][2], temperature);

if(Weather == 8 || Weather == 16 || Weather == 20)
	{
	    new i = random(27);
	    if(i == 6)
	    {
			 Temperature[playerid] -= 0.1;
			 
			 if(Temperature[playerid] == 31) SM(playerid,0x00FF00FF,"{B9BCBD}TEST");
			 else if(Temperature[playerid] == 24)
			 {
			    SM(playerid,0x00FF00FF,"{B9BCBD}TEST");
			    Temperature[playerid] = 36.6;
			    SetPlayerHealth(playerid, 0);
			 }
	    }
	}
REPEAT:TEXTDRAW show correctly temperature but problem is that message not display when temperature is 31.0 and 24.0.
Reply
#4

Quote:
Originally Posted by iulicxd
Посмотреть сообщение
Код:
new Float:Temperature[MAX_PLAYERS];
OnPlayerConnect & OnPlayerDisconnect:
Код:
Temperature[playerid] = 36.6;
Timer one second:
Код:
new temperature[128];
format(temperature,sizeof(temperature),"Temperature:%0.1f",Temperature[playerid]);
PlayerTextDrawSetString(playerid, HudTD[playerid][2], temperature);

if(Weather == 8 || Weather == 16 || Weather == 20)
	{
	    new i = random(27);
	    if(i == 6)
	    {
			 Temperature[playerid] -= 0.1;
			 
			 if(Temperature[playerid] == 31) SM(playerid,0x00FF00FF,"{B9BCBD}TEST");
			 else if(Temperature[playerid] == 24)
			 {
			    SM(playerid,0x00FF00FF,"{B9BCBD}TEST");
			    Temperature[playerid] = 36.6;
			    SetPlayerHealth(playerid, 0);
			 }
	    }
	}
REPEAT:TEXTDRAW show correctly temperature but problem is that message not display when temperature is 31.0 and 24.0.
From what i see from your code it should pass two if conditions to make this if make condtion true.That means weather should be 8 or 16 or 20 and the variable i which is generated by random function (that generates 0 to 26 values) and then this if condition comes i hope that you dont have any other strings attached to this part.
lets do a debugging.

PHP код:
if(Weather == || Weather == 16 || Weather == 20)
    {
printf("Passed 1st if the value of weather = %d",Weather);
        new 
random(27);
        if(
== 6)
        {
                         
printf("Passed 2nd if the value of i = %d",i);
             
Temperature[playerid] -= 0.1;
             
printf("Temperature = %d",Temperature[playerid]);
             if(
Temperature[playerid] == 31SM(playerid,0x00FF00FF,"{B9BCBD}TEST");
             else if(
Temperature[playerid] == 24)
             {
                
SM(playerid,0x00FF00FF,"{B9BCBD}TEST");
                
Temperature[playerid] = 36.6;
                
SetPlayerHealth(playerid0);
             }
        }
    } 
Tell what is printing on log..
Reply
#5

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
From what i see from your code it should pass two if conditions to make this if make condtion true.That means weather should be 8 or 16 or 20 and the variable i which is generated by random function (that generates 0 to 26 values) and then this if condition comes i hope that you dont have any other strings attached to this part.
lets do a debugging.

PHP код:
if(Weather == || Weather == 16 || Weather == 20)
    {
printf("Passed 1st if the value of weather = %d",Weather);
        new 
random(27);
        if(
== 6)
        {
                         
printf("Passed 2nd if the value of i = %d",i);
             
Temperature[playerid] -= 0.1;
             
printf("Temperature = %d",Temperature[playerid]);
             if(
Temperature[playerid] == 31SM(playerid,0x00FF00FF,"{B9BCBD}TEST");
             else if(
Temperature[playerid] == 24)
             {
                
SM(playerid,0x00FF00FF,"{B9BCBD}TEST");
                
Temperature[playerid] = 36.6;
                
SetPlayerHealth(playerid0);
             }
        }
    } 
Tell what is printing on log..
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[18:19:45] hostname = "SA-MP Server"  (string)
[18:19:45] weburl = "www.sa-mp.com"  (string)
[18:19:45] 
[18:19:45] Server Plugins
[18:19:45] --------------
[18:19:45]  Loading plugin: crashdetect
[18:19:45]   CrashDetect v4.15.1 is OK.
[18:19:45]   Loaded.
[18:19:45]  Loading plugin: streamer
[18:19:45] 

*** Streamer Plugin v2.7.9 by Incognito loaded ***

[18:19:45]   Loaded.
[18:19:45]  Loading plugin: sscanf
[18:19:45] 

[18:19:45]  ===============================

[18:19:45]       sscanf plugin loaded.     

[18:19:45]          Version:  2.8.1        

[18:19:45]    © 2012 Alex "******" Cole  

[18:19:45]  ===============================

[18:19:45]   Loaded.
[18:19:45]  Loading plugin: mysql
[18:19:45]  >> plugin.mysql: R39-5 successfully loaded.
[18:19:45]   Loaded.
[18:19:45]  Loading plugin: dc_cmd
[18:19:45]   Daniel's CMD plugin v2.8
[18:19:45]     © 2014 Daniel_Cortez
[18:19:45] 	www.pro-pawn.ru
[18:19:45]   Loaded.
[18:19:45]  Loading plugin: nativechecker
[18:19:45]   Loaded.
[18:19:45]  Loaded 6 plugins.

[18:19:45] 
[18:19:45] Ban list
[18:19:45] --------
[18:19:45]  Loaded: samp.ban
[18:19:45] 
[18:19:45] 
[18:19:45] Filterscripts
[18:19:45] ---------------
[18:19:45]   Loading filterscript 'Objects.amx'...
[18:19:45]   Loaded 1 filterscripts.

[18:19:45] Number of vehicle models: 45
[18:19:45] (22) домов загружено - (1) ms
[18:19:48] [connection] 127.0.0.1:57646 requests connection cookie.
[18:19:49] [connection] incoming connection: 127.0.0.1:57647 id: 0
[18:19:49] [join] Richard_Miguelez has joined the server (0:127.0.0.1)
[18:19:55] Passed 1st if the value of weather = 8
[18:19:56] Passed 1st if the value of weather = 8
[18:19:58] Passed 1st if the value of weather = 8
[18:19:59] Passed 1st if the value of weather = 8
[18:20:00] Passed 1st if the value of weather = 8
[18:20:01] Passed 1st if the value of weather = 8
[18:20:02] Passed 1st if the value of weather = 8
[18:20:03] Passed 1st if the value of weather = 8
[18:20:04] Passed 1st if the value of weather = 8
[18:20:05] Passed 1st if the value of weather = 8
[18:20:05] Passed 2nd if the value of i = 6
[18:20:05] Temperature = 36.5
[18:20:06] Passed 1st if the value of weather = 8
[18:20:06] Passed 2nd if the value of i = 6
[18:20:06] Temperature = 36.4
[18:20:07] Passed 1st if the value of weather = 8
[18:20:08] Passed 1st if the value of weather = 8
[18:20:10] Passed 1st if the value of weather = 8
[18:20:10] Passed 2nd if the value of i = 6
[18:20:10] Temperature = 36.3
[18:20:11] Passed 1st if the value of weather = 8
[18:20:11] Passed 2nd if the value of i = 6
[18:20:11] Temperature = 36.2
[18:20:12] Passed 1st if the value of weather = 8
[18:20:13] Passed 1st if the value of weather = 8
[18:20:14] Passed 1st if the value of weather = 8
[18:20:15] Passed 1st if the value of weather = 8
[18:20:16] Passed 1st if the value of weather = 8
[18:20:16] Passed 2nd if the value of i = 6
[18:20:16] Temperature = 36.1
[18:20:17] Passed 1st if the value of weather = 8
[18:20:18] Passed 1st if the value of weather = 8
[18:20:19] Passed 1st if the value of weather = 8
[18:20:19] Passed 2nd if the value of i = 6
[18:20:19] Temperature = 36.0
[18:20:21] Passed 1st if the value of weather = 8
[18:20:22] Passed 1st if the value of weather = 8
[18:20:23] Passed 1st if the value of weather = 8
[18:20:23] Passed 2nd if the value of i = 6
[18:20:23] Temperature = 35.9
[18:20:24] Passed 1st if the value of weather = 8
[18:20:25] Passed 1st if the value of weather = 8
[18:20:26] Passed 1st if the value of weather = 8
[18:20:26] Passed 2nd if the value of i = 6
[18:20:26] Temperature = 35.8
[18:20:27] Passed 1st if the value of weather = 8
[18:20:28] Passed 1st if the value of weather = 8
[18:20:29] Passed 1st if the value of weather = 8
[18:20:29] Passed 2nd if the value of i = 6
[18:20:29] Temperature = 35.7
[18:20:30] Passed 1st if the value of weather = 8
[18:20:31] Passed 1st if the value of weather = 8
[18:20:33] Passed 1st if the value of weather = 8
[18:20:33] Passed 2nd if the value of i = 6
[18:20:33] Temperature = 35.6
[18:20:34] Passed 1st if the value of weather = 8
[18:20:35] Passed 1st if the value of weather = 8
[18:20:36] Passed 1st if the value of weather = 8
[18:20:37] Passed 1st if the value of weather = 8
[18:20:38] Passed 1st if the value of weather = 8
[18:20:38] Passed 2nd if the value of i = 6
[18:20:38] Temperature = 35.5
[18:20:39] Passed 1st if the value of weather = 8
[18:20:40] Passed 1st if the value of weather = 8
i tell that this correct work
I think problem is in
Код:
if and else
Reply
#6

Quote:
Originally Posted by iulicxd
Посмотреть сообщение
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[18:19:45] hostname = "SA-MP Server"  (string)
[18:19:45] weburl = "www.sa-mp.com"  (string)
[18:19:45] 
[18:19:45] Server Plugins
[18:19:45] --------------
[18:19:45]  Loading plugin: crashdetect
[18:19:45]   CrashDetect v4.15.1 is OK.
[18:19:45]   Loaded.
[18:19:45]  Loading plugin: streamer
[18:19:45] 

*** Streamer Plugin v2.7.9 by Incognito loaded ***

[18:19:45]   Loaded.
[18:19:45]  Loading plugin: sscanf
[18:19:45] 

[18:19:45]  ===============================

[18:19:45]       sscanf plugin loaded.     

[18:19:45]          Version:  2.8.1        

[18:19:45]    © 2012 Alex "******" Cole  

[18:19:45]  ===============================

[18:19:45]   Loaded.
[18:19:45]  Loading plugin: mysql
[18:19:45]  >> plugin.mysql: R39-5 successfully loaded.
[18:19:45]   Loaded.
[18:19:45]  Loading plugin: dc_cmd
[18:19:45]   Daniel's CMD plugin v2.8
[18:19:45]     © 2014 Daniel_Cortez
[18:19:45] 	www.pro-pawn.ru
[18:19:45]   Loaded.
[18:19:45]  Loading plugin: nativechecker
[18:19:45]   Loaded.
[18:19:45]  Loaded 6 plugins.

[18:19:45] 
[18:19:45] Ban list
[18:19:45] --------
[18:19:45]  Loaded: samp.ban
[18:19:45] 
[18:19:45] 
[18:19:45] Filterscripts
[18:19:45] ---------------
[18:19:45]   Loading filterscript 'Objects.amx'...
[18:19:45]   Loaded 1 filterscripts.

[18:19:45] Number of vehicle models: 45
[18:19:45] (22) домов загружено - (1) ms
[18:19:48] [connection] 127.0.0.1:57646 requests connection cookie.
[18:19:49] [connection] incoming connection: 127.0.0.1:57647 id: 0
[18:19:49] [join] Richard_Miguelez has joined the server (0:127.0.0.1)
[18:19:55] Passed 1st if the value of weather = 8
[18:19:56] Passed 1st if the value of weather = 8
[18:19:58] Passed 1st if the value of weather = 8
[18:19:59] Passed 1st if the value of weather = 8
[18:20:00] Passed 1st if the value of weather = 8
[18:20:01] Passed 1st if the value of weather = 8
[18:20:02] Passed 1st if the value of weather = 8
[18:20:03] Passed 1st if the value of weather = 8
[18:20:04] Passed 1st if the value of weather = 8
[18:20:05] Passed 1st if the value of weather = 8
[18:20:05] Passed 2nd if the value of i = 6
[18:20:05] Temperature = 36.5
[18:20:06] Passed 1st if the value of weather = 8
[18:20:06] Passed 2nd if the value of i = 6
[18:20:06] Temperature = 36.4
[18:20:07] Passed 1st if the value of weather = 8
[18:20:08] Passed 1st if the value of weather = 8
[18:20:10] Passed 1st if the value of weather = 8
[18:20:10] Passed 2nd if the value of i = 6
[18:20:10] Temperature = 36.3
[18:20:11] Passed 1st if the value of weather = 8
[18:20:11] Passed 2nd if the value of i = 6
[18:20:11] Temperature = 36.2
[18:20:12] Passed 1st if the value of weather = 8
[18:20:13] Passed 1st if the value of weather = 8
[18:20:14] Passed 1st if the value of weather = 8
[18:20:15] Passed 1st if the value of weather = 8
[18:20:16] Passed 1st if the value of weather = 8
[18:20:16] Passed 2nd if the value of i = 6
[18:20:16] Temperature = 36.1
[18:20:17] Passed 1st if the value of weather = 8
[18:20:18] Passed 1st if the value of weather = 8
[18:20:19] Passed 1st if the value of weather = 8
[18:20:19] Passed 2nd if the value of i = 6
[18:20:19] Temperature = 36.0
[18:20:21] Passed 1st if the value of weather = 8
[18:20:22] Passed 1st if the value of weather = 8
[18:20:23] Passed 1st if the value of weather = 8
[18:20:23] Passed 2nd if the value of i = 6
[18:20:23] Temperature = 35.9
[18:20:24] Passed 1st if the value of weather = 8
[18:20:25] Passed 1st if the value of weather = 8
[18:20:26] Passed 1st if the value of weather = 8
[18:20:26] Passed 2nd if the value of i = 6
[18:20:26] Temperature = 35.8
[18:20:27] Passed 1st if the value of weather = 8
[18:20:28] Passed 1st if the value of weather = 8
[18:20:29] Passed 1st if the value of weather = 8
[18:20:29] Passed 2nd if the value of i = 6
[18:20:29] Temperature = 35.7
[18:20:30] Passed 1st if the value of weather = 8
[18:20:31] Passed 1st if the value of weather = 8
[18:20:33] Passed 1st if the value of weather = 8
[18:20:33] Passed 2nd if the value of i = 6
[18:20:33] Temperature = 35.6
[18:20:34] Passed 1st if the value of weather = 8
[18:20:35] Passed 1st if the value of weather = 8
[18:20:36] Passed 1st if the value of weather = 8
[18:20:37] Passed 1st if the value of weather = 8
[18:20:38] Passed 1st if the value of weather = 8
[18:20:38] Passed 2nd if the value of i = 6
[18:20:38] Temperature = 35.5
[18:20:39] Passed 1st if the value of weather = 8
[18:20:40] Passed 1st if the value of weather = 8
i tell that this correct work
I think problem is in
Код:
if and else
your temperature var didnt become 31 or 24.
Reply


Forum Jump:


Users browsing this thread: