Wysłany: 2014-12-21, 19:52
Zon3
Wiek: 32 Na forum: 4280 dni Posty: 66
Piwa : 4
Witam. Mam taki problem z systemem wybuchania po?ar?w. Po?ar wybucha co 1 min tak jak timer ustawi?em i gdy ugasz? go to ju? wi?cej nie wybucha. Dopiero po jakiej? 1h. Oto kod od wybuchania i gaszenia po?aru:
Pawn SetTimer ( "PlaceRandomFire" , ( 1000 * 60 ), true );
Gaszenie pozaru:
Pawn new newkeys , l , u ;
GetPlayerKeys ( playerid , newkeys , l , u );
new i ;
if( Holding ( KEY_FIRE ))
{
if( GetPlayerWeapon ( playerid ) == 42 )
{
for( i = 0 ; i < MaxFire ; i ++)
{
if( IsValidFire ( i ))
{
if( PlayerFaces ( playerid , FirePos [ i ][ 0 ], FirePos [ i ][ 1 ], FirePos [ i ][ 2 ], 1 ) && IsPlayerInRangeOfPoint ( playerid , 4 , FirePos [ i ][ 0 ], FirePos [ i ][ 1 ], FirePos [ i ][ 2 ]))
{
FireHealth [ i ]-= 2 ;
#if defined Labels
new string [ 128 ];
format ( string , sizeof (string), "%d/%d" , FireHealth [ i ], FireHealthMax [ i ]);
Update3DTextLabelText ( FireText [ i ], 0xFFFFFFFF , string );
//Delete3DTextLabel(FireText[i]);
//FireText[i] = Create3DTextLabel(string, 0xFFFFFFFF, FirePos[i][0], FirePos[i][1], FirePos[i][2], 20, 0);
#endif
if( FireHealth [ i ] <= 0 )
{
DeleteFire ( i );
CallRemoteFunction ( "OnFireDeath" , "dd" , i , playerid );
SendClientMessage ( playerid , Zolty , "Wynagrodzenie: {FFFFFF}$200 i 20 score **" ); // ustawiasz se wynagrodzenie
GiveMoneyEx ( playerid , 200 );
GiveScoreEx ( playerid , GetScoreEx ( playerid )+ 20 );
}
}
}
}
}
}
stock DeleteFire ( ID )
{
for(new i = GetMaxPlayers (), playerid ; playerid != i ; playerid ++)
{
DestroyObject ( FireObj [ ID ]);
TotalFires --;
FirePos [ ID ][ 0 ] = 0 , FirePos [ ID ][ 1 ] = 0 , FirePos [ ID ][ 2 ] = 0 ;
Delete3DTextLabel ( FireText [ ID ]);
RemovePlayerMapIcon ( playerid , 4 );
}
return 1 ;
}
stock DeleteAllFire ()
{
new ID ;
for( ID = 0 ; ID < MaxFire ; ID ++)
{
DestroyObject ( FireObj [ ID ]);
TotalFires = 0 ;
FirePos [ ID ][ 0 ] = 0 , FirePos [ ID ][ 1 ] = 0 , FirePos [ ID ][ 2 ] = 0 ;
#if defined Labels
Delete3DTextLabel ( FireText [ i ]);
#endif
}
}
stock IsValidFire ( ID )
{
if( ( FirePos [ ID ][ 0 ] != 0 ) && ( FirePos [ ID ][ 1 ] != 0 ) && ( FirePos [ ID ][ 2 ] != 0 ) ) return true ;
else return false ;
}
stock GetClosestFire ( playerid )
{
new i ;
for( i = 0 ; i < MaxFire ; i ++)
{
if( IsValidFire ( i ) && IsPlayerInRangeOfPoint ( playerid , 1 , FirePos [ i ][ 0 ], FirePos [ i ][ 1 ], FirePos [ i ][ 2 ]))
{
return i ;
}
}
return 0 ;
}
Wybuchanie pozaru:
Pawn stock AddFire ( Float : x1 , Float : y1 , Float : z1 , Health )
{
TotalFires ++;
new ID = TotalFires ;
FireObj [ ID ] = CreateObject ( 3461 , x1 , y1 , z1 - 2.61 , 0 , 0 , 0.0 );
FirePos [ ID ][ 0 ] = x1 , FirePos [ ID ][ 1 ] = y1 , FirePos [ ID ][ 2 ] = z1 ;
FireHealth [ ID ] = Health ;
FireHealthMax [ ID ] = Health ;
new string [ 128 ];
format ( string , sizeof (string), "%d/%d" , FireHealth [ ID ], FireHealthMax [ ID ]);
FireText [ ID ] = Create3DTextLabel ( string , 0xFFFFFFFFF , x1 , y1 , z1 , 20 , 0 );
return 1 ;
}
forward PlaceRandomFire ();
public PlaceRandomFire ()
{
new rand = random ( sizeof ( RandomFire ));
AddFire ( RandomFire [ rand ][ 0 ], RandomFire [ rand ][ 1 ], RandomFire [ rand ][ 2 ], 100 );
for(new i = GetMaxPlayers (), playerid ; playerid != i ; playerid ++)
{
if( IsPlayerConnected ( playerid ) && PlayerInfo [ playerid ][ Team ] == COMPANY_STRAZ )
SetPlayerMapIcon ( playerid , 4 , RandomFire [ rand ][ 0 ], RandomFire [ rand ][ 1 ], RandomFire [ rand ][ 2 ], 20 , 0 , MAPICON_GLOBAL );
}
return 1 ;
}
Prosze o szybk? pomoc.
Wysłany: 2014-12-22, 07:27
IgrexolonO
Wiek: 34 Na forum: 6809 dni Posty: 1386
Piwa : 1062
Sk?d ja znam ten magiczny kod
Kod: forward PlaceRandomFire();
public PlaceRandomFire()
{
new rand = random(sizeof(RandomFire));
AddFire(RandomFire[rand][0], RandomFire[rand][1], RandomFire[rand][2], 100);
for(new i=0;i<GetMaxPlayers();i++)
{
if(IsPlayerConnected(i) && PlayerInfo[i][Team] == COMPANY_STRAZ)
SetPlayerMapIcon(i, 4, RandomFire[rand][0], RandomFire[rand][1], RandomFire[rand][2], 20, 0, MAPICON_GLOBAL);
}
return 1;
}
HO?, HO?, HO?, MERY KRYSZTMES
Wysłany: 2014-12-22, 09:17
Zon3
Wiek: 32 Na forum: 4280 dni Posty: 66
Piwa : 4
Niestety, nadal nie dzia?a
[ Dodano : 2014-12-22, 21:10 ]
Wie kto? jak to naprawi??
[ Dodano : 2014-12-23, 00:31 ]
Pomo?e kto??
Tagi: wybuchanie :: pożaru
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: