modulize fire system
This commit is contained in:
parent
ad02b2c08c
commit
cc23d6ced4
@ -36,6 +36,7 @@
|
|||||||
#include "irresistible\cnr\features\bribes.pwn"
|
#include "irresistible\cnr\features\bribes.pwn"
|
||||||
#include "irresistible\cnr\features\info_pickups.pwn"
|
#include "irresistible\cnr\features\info_pickups.pwn"
|
||||||
#include "irresistible\cnr\features\crime_reports.pwn"
|
#include "irresistible\cnr\features\crime_reports.pwn"
|
||||||
|
#include "irresistible\cnr\features\fires.pwn"
|
||||||
|
|
||||||
// disabled
|
// disabled
|
||||||
// #include "irresistible\cnr\features\eastereggs.pwn"
|
// #include "irresistible\cnr\features\eastereggs.pwn"
|
||||||
|
226
gamemodes/irresistible/cnr/features/fires.pwn
Normal file
226
gamemodes/irresistible/cnr/features/fires.pwn
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
/*
|
||||||
|
* Irresistible Gaming (c) 2018
|
||||||
|
* Developed by Lorenc Pekaj
|
||||||
|
* Module: cnr\features\fires.pwn
|
||||||
|
* Purpose: extinguishable fire system
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ** Includes ** */
|
||||||
|
#include < YSI\y_hooks >
|
||||||
|
|
||||||
|
/* ** Definitions ** */
|
||||||
|
#define MAX_FIRES ( 10 )
|
||||||
|
|
||||||
|
/* ** Variables ** */
|
||||||
|
enum E_FIRE_DATA
|
||||||
|
{
|
||||||
|
bool: E_CREATED, E_OBJECT, Float: E_HEALTH,
|
||||||
|
E_HOUSE, Text3D: E_LABEL
|
||||||
|
};
|
||||||
|
|
||||||
|
static stock
|
||||||
|
g_fireData [ MAX_FIRES ] [ E_FIRE_DATA ],
|
||||||
|
p_FireDistanceTimer [ MAX_PLAYERS ] = { -1, ... },
|
||||||
|
bool: fire_toggled = false
|
||||||
|
;
|
||||||
|
|
||||||
|
/* ** Forwards ** */
|
||||||
|
forward OnPlayerTakeOutFire ( playerid, fireid );
|
||||||
|
|
||||||
|
/* ** Hooks ** */
|
||||||
|
hook OnPlayerDisconnect( playerid, reason )
|
||||||
|
{
|
||||||
|
StopPlayerFireTracker( playerid );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined AC_INCLUDED
|
||||||
|
hook OnPlayerDeathEx( playerid, killerid, reason, Float: damage, bodypart )
|
||||||
|
#else
|
||||||
|
hook OnPlayerDeath( playerid, killerid, reason )
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
StopPlayerFireTracker( playerid );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerUpdateEx( playerid )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iKeys;
|
||||||
|
|
||||||
|
GetPlayerKeys( playerid, iKeys, tmpVariable, tmpVariable );
|
||||||
|
|
||||||
|
// Taking Out Fires
|
||||||
|
if ( p_Class[ playerid ] == CLASS_FIREMAN && ( iKeys & KEY_FIRE ) || ( iKeys & KEY_WALK ) )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iVehicle = GetPlayerVehicleID( playerid );
|
||||||
|
|
||||||
|
if ( GetPlayerWeapon( playerid ) == 42 || GetVehicleModel( iVehicle ) == 407 )
|
||||||
|
{
|
||||||
|
for( new i = 0; i < sizeof( g_fireData ); i ++ ) if ( g_fireData[ i ] [ E_CREATED ] )
|
||||||
|
{
|
||||||
|
static
|
||||||
|
Float: fX, Float: fY, Float: fZ;
|
||||||
|
|
||||||
|
if ( GetDynamicObjectPos( g_fireData[ i ] [ E_OBJECT ], fX, fY, fZ ) )
|
||||||
|
{
|
||||||
|
fZ += 2.3;
|
||||||
|
|
||||||
|
if ( IsPlayerInRangeOfPoint( playerid, ( GetVehicleModel( iVehicle ) == 407 ? 25.0 : 10.0 ), fX, fY, fZ ) )
|
||||||
|
{
|
||||||
|
if ( IsPlayerAimingAt( playerid, fX, fY, fZ, ( GetVehicleModel( iVehicle ) == 407 ? 3.0 : 1.0 ) ) )
|
||||||
|
{
|
||||||
|
if ( g_fireData[ i ] [ E_HEALTH ] > 0.0 )
|
||||||
|
{
|
||||||
|
if ( ( g_fireData[ i ] [ E_HEALTH ] -= GetVehicleModel( iVehicle ) == 407 ? ( 2.85 + fRandomEx( 1.0, 5.0 ) ) : ( 1.25 + fRandomEx( 1.0, 5.0 ) ) ) < 0.0 )
|
||||||
|
g_fireData[ i ] [ E_HEALTH ] = 0.0;
|
||||||
|
|
||||||
|
UpdateDynamic3DTextLabelText( g_fireData[ i ] [ E_LABEL ], COLOR_YELLOW, sprintf( "%0.1f", g_fireData[ i ] [ E_HEALTH ] ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ach_HandleExtinguishedFires( playerid );
|
||||||
|
SendClientMessageToFireman( -1, "{A83434}[FIREMAN]{FFFFFF} %s(%d) has extinguished house fire %d.", ReturnPlayerName( playerid ), playerid, i );
|
||||||
|
GivePlayerScore( playerid, 2 );
|
||||||
|
//GivePlayerExperience( playerid, E_FIREMAN );
|
||||||
|
GivePlayerCash( playerid, 5000 );
|
||||||
|
|
||||||
|
g_fireData[ i ] [ E_CREATED ] = false;
|
||||||
|
g_fireData[ i ] [ E_HOUSE ] = -1;
|
||||||
|
DestroyDynamicObject( g_fireData[ i ] [ E_OBJECT ] );
|
||||||
|
g_fireData[ i ] [ E_OBJECT ] = INVALID_OBJECT_ID;
|
||||||
|
DestroyDynamic3DTextLabel( g_fireData[ i ] [ E_LABEL ] );
|
||||||
|
g_fireData[ i ] [ E_LABEL ] = Text3D: INVALID_3DTEXT_ID;
|
||||||
|
g_fireData[ i ] [ E_HEALTH ] = 0.0;
|
||||||
|
UpdateDynamic3DTextLabelText( g_fireData[ i ] [ E_LABEL ], COLOR_YELLOW, sprintf( "%0.1f", g_fireData[ i ] [ E_HEALTH ] ) );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Commands ** */
|
||||||
|
CMD:firetracker( playerid, params[ ] )
|
||||||
|
{
|
||||||
|
if ( p_Class[ playerid ] != CLASS_FIREMAN )
|
||||||
|
return SendError( playerid, "You are not a fireman." );
|
||||||
|
|
||||||
|
if ( p_FireDistanceTimer[ playerid ] != -1 )
|
||||||
|
return StopPlayerFireTracker( playerid ), SendServerMessage( playerid, "You have turned off your fire tracker." );
|
||||||
|
|
||||||
|
KillTimer( p_FireDistanceTimer[ playerid ] );
|
||||||
|
p_FireDistanceTimer[ playerid ] = SetTimerEx( "OnPlayerFireDistanceUpdate", 1000, true, "d", playerid );
|
||||||
|
SendServerMessage( playerid, "Find the fires and extinguish them." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock StopPlayerFireTracker( playerid )
|
||||||
|
{
|
||||||
|
KillTimer( p_FireDistanceTimer[ playerid ] );
|
||||||
|
p_FireDistanceTimer[ playerid ] = -1;
|
||||||
|
|
||||||
|
PlayerTextDrawHide( playerid, p_FireDistance1[ playerid ] );
|
||||||
|
PlayerTextDrawHide( playerid, p_FireDistance2[ playerid ] );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Functions ** */
|
||||||
|
stock CreateFire( )
|
||||||
|
{
|
||||||
|
if ( fire_toggled )
|
||||||
|
{
|
||||||
|
for ( new i = 0; i < sizeof( g_fireData ); i ++ ) if ( g_fireData[ i ] [ E_CREATED ] == true )
|
||||||
|
{
|
||||||
|
g_fireData[ i ] [ E_CREATED ] = false;
|
||||||
|
g_fireData[ i ] [ E_HOUSE ] = -1;
|
||||||
|
DestroyDynamicObject( g_fireData[ i ] [ E_OBJECT ] );
|
||||||
|
g_fireData[ i ] [ E_OBJECT ] = INVALID_OBJECT_ID;
|
||||||
|
DestroyDynamic3DTextLabel( g_fireData[ i ] [ E_LABEL ] );
|
||||||
|
g_fireData[ i ] [ E_LABEL ] = Text3D: INVALID_3DTEXT_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
fire_toggled = false;
|
||||||
|
CreateFire( );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static
|
||||||
|
Float: X, Float: Y, Float: Z;
|
||||||
|
|
||||||
|
for ( new i = 0; i < sizeof( g_fireData ); i ++ )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
house = GetRandomCreatedHouse( );
|
||||||
|
|
||||||
|
if ( Iter_Contains( houses, house ) )
|
||||||
|
{
|
||||||
|
GetHousePos( house, X, Y, Z );
|
||||||
|
g_fireData[ i ] [ E_HEALTH ] = 100.0 + fRandomEx( 1, 25 );
|
||||||
|
g_fireData[ i ] [ E_HOUSE ] = house;
|
||||||
|
g_fireData[ i ] [ E_CREATED ] = true;
|
||||||
|
g_fireData[ i ] [ E_LABEL ] = CreateDynamic3DTextLabel( sprintf( "%0.1f", g_fireData[ i ] [ E_HEALTH ] ), COLOR_YELLOW, X, Y, Z + 0.5, 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1 );
|
||||||
|
g_fireData[ i ] [ E_OBJECT ] = CreateDynamicObject( 18691, X, Y, Z - 2.3, 0.0, 0.0, 0.0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fire_toggled = true;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock IsHouseOnFire( houseid )
|
||||||
|
{
|
||||||
|
if ( houseid < 0 || houseid > MAX_HOUSES )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( ! Iter_Contains( houses, houseid ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for( new i, Float: X, Float: Y, Float: Z; i < sizeof( g_fireData ); i++ )
|
||||||
|
{
|
||||||
|
if ( g_fireData[ i ] [ E_CREATED ] )
|
||||||
|
{
|
||||||
|
GetDynamicObjectPos( g_fireData[ i ] [ E_OBJECT ], X, Y, Z ); // Z is unused due to the object.
|
||||||
|
if ( g_houseData[ houseid ] [ E_EX ] == X && g_houseData[ houseid ] [ E_EY ] == Y )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function OnPlayerFireDistanceUpdate( playerid )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
Float: X, Float: Y, Float: Z, Float: dis,
|
||||||
|
szFire1[ 128 ], szFire2[ 128 ]
|
||||||
|
;
|
||||||
|
|
||||||
|
for( new i; i < sizeof( g_fireData ); i++ )
|
||||||
|
{
|
||||||
|
GetDynamicObjectPos( g_fireData[ i ] [ E_OBJECT ], X, Y, Z );
|
||||||
|
dis = GetPlayerDistanceFromPoint( playerid, X, Y, Z );
|
||||||
|
if ( i < floatround( sizeof( g_fireData ) / 2 ) )
|
||||||
|
{
|
||||||
|
if ( g_fireData[ i ] [ E_CREATED ] == false ) format( szFire1, sizeof( szFire1 ), "%s~r~FIRE %d:%s ~g~Stopped~n~", szFire1, i,i==1?(" "):("") );
|
||||||
|
else format( szFire1, sizeof( szFire1 ), "%s~r~FIRE %d:%s~w~ %0.0f m~n~", szFire1, i,i==1?("_"):(""), dis );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( g_fireData[ i ] [ E_CREATED ] == false ) format( szFire2, sizeof( szFire2 ), "%s~r~FIRE %d:%s ~g~Stopped~n~", szFire2, i,i==1?(" "):("") );
|
||||||
|
else format( szFire2, sizeof( szFire2 ), "%s~r~FIRE %d:%s~w~ %0.0f m~n~", szFire2, i,i==1?("_"):(""), dis );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PlayerTextDrawSetString( playerid, p_FireDistance1[ playerid ], szFire1 );
|
||||||
|
PlayerTextDrawSetString( playerid, p_FireDistance2[ playerid ], szFire2 );
|
||||||
|
PlayerTextDrawShow( playerid, p_FireDistance1[ playerid ] );
|
||||||
|
PlayerTextDrawShow( playerid, p_FireDistance2[ playerid ] );
|
||||||
|
return 1;
|
||||||
|
}
|
@ -88,7 +88,6 @@ new
|
|||||||
bool: p_MoneyBag [ MAX_PLAYERS char ],
|
bool: p_MoneyBag [ MAX_PLAYERS char ],
|
||||||
p_CopBanned [ MAX_PLAYERS char ],
|
p_CopBanned [ MAX_PLAYERS char ],
|
||||||
p_AntiEMP [ MAX_PLAYERS ],
|
p_AntiEMP [ MAX_PLAYERS ],
|
||||||
p_FireDistanceTimer [ MAX_PLAYERS ] = { 0xFF, ... },
|
|
||||||
p_Warns [ MAX_PLAYERS ],
|
p_Warns [ MAX_PLAYERS ],
|
||||||
p_Wood [ MAX_PLAYERS ],
|
p_Wood [ MAX_PLAYERS ],
|
||||||
p_LumberjackDeliver [ MAX_PLAYERS ] = { 0xFFFF, ... },
|
p_LumberjackDeliver [ MAX_PLAYERS ] = { 0xFFFF, ... },
|
||||||
|
@ -70,8 +70,6 @@ new bool: False = false;
|
|||||||
#define IsPlayerNpcEx(%0) (IsPlayerNPC(%0) || strmatch(p_PlayerIP[%0], "127.0.0.1"))
|
#define IsPlayerNpcEx(%0) (IsPlayerNPC(%0) || strmatch(p_PlayerIP[%0], "127.0.0.1"))
|
||||||
|
|
||||||
/* Beast Functions */
|
/* Beast Functions */
|
||||||
#define SendClientMessageToFireman(%1,%2,%3) \
|
|
||||||
do{foreach(new fI : Player){if (p_Class[fI]==CLASS_FIREMAN)format(szNormalString,sizeof(szNormalString),(%2),%3),SendClientMessage(fI,(%1),szNormalString);}}while(False)
|
|
||||||
#define SendClientMessageToVips(%1,%2,%3) \
|
#define SendClientMessageToVips(%1,%2,%3) \
|
||||||
do{foreach(new fI : Player){if (p_VIPLevel[fI]>=VIP_REGULAR)format(szNormalString,sizeof(szNormalString),(%2),%3),SendClientMessage(fI,(%1),szNormalString);}}while(False)
|
do{foreach(new fI : Player){if (p_VIPLevel[fI]>=VIP_REGULAR)format(szNormalString,sizeof(szNormalString),(%2),%3),SendClientMessage(fI,(%1),szNormalString);}}while(False)
|
||||||
#define SendClientMessageToAmbulance(%1,%2,%3) \
|
#define SendClientMessageToAmbulance(%1,%2,%3) \
|
||||||
@ -153,20 +151,6 @@ new
|
|||||||
Iterator:gates<MAX_GATES>
|
Iterator:gates<MAX_GATES>
|
||||||
;
|
;
|
||||||
|
|
||||||
/* ** Fire System ** */
|
|
||||||
enum E_FIRE_DATA
|
|
||||||
{
|
|
||||||
bool: E_CREATED, E_OBJECT, Float: E_HEALTH,
|
|
||||||
E_HOUSE, Text3D: E_LABEL
|
|
||||||
};
|
|
||||||
|
|
||||||
new
|
|
||||||
g_fireData [ 10 ] [ E_FIRE_DATA ],
|
|
||||||
bool: fire_toggled = false
|
|
||||||
;
|
|
||||||
|
|
||||||
public OnPlayerTakeOutFire ( playerid, fireid );
|
|
||||||
|
|
||||||
/* ** Weed System ** */
|
/* ** Weed System ** */
|
||||||
#define MAX_WEED_STORAGE 6
|
#define MAX_WEED_STORAGE 6
|
||||||
#define MAX_WEED ( 42 )
|
#define MAX_WEED ( 42 )
|
||||||
@ -794,19 +778,6 @@ public OnGameModeInit()
|
|||||||
CreateDynamicPickup( 371, 2, 1318.92200, 2002.7311, 1200.250 ); // Parachute @Shamal
|
CreateDynamicPickup( 371, 2, 1318.92200, 2002.7311, 1200.250 ); // Parachute @Shamal
|
||||||
CreateDynamicPickup( 371, 2, -1745.2754, 59.301500, 866.4556 ); // Parachute @Veloxity
|
CreateDynamicPickup( 371, 2, -1745.2754, 59.301500, 866.4556 ); // Parachute @Veloxity
|
||||||
|
|
||||||
/* ** RDM protection **
|
|
||||||
static const
|
|
||||||
Float: radius = 100.0;
|
|
||||||
|
|
||||||
for( new i = 0; i < sizeof( g_SanFierroSpawns ); i++ )
|
|
||||||
CreateNoDeathmatchZone( radius, g_SanFierroSpawns[ i ] [ RANDOM_SPAWN_X ], g_SanFierroSpawns[ i ] [ RANDOM_SPAWN_Y ] );
|
|
||||||
|
|
||||||
//CreateNoDeathmatchZone( radius, g_FiremanSpawns[ 0 ] [ RANDOM_SPAWN_X ], g_FiremanSpawns[ 0 ] [ RANDOM_SPAWN_Y ] );
|
|
||||||
CreateNoDeathmatchZone( radius, g_MedicSpawns[ 0 ] [ RANDOM_SPAWN_X ], g_MedicSpawns[ 0 ] [ RANDOM_SPAWN_Y ] );
|
|
||||||
CreateNoDeathmatchZone( radius, g_ArmySpawns[ 0 ] [ RANDOM_SPAWN_X ], g_ArmySpawns[ 0 ] [ RANDOM_SPAWN_Y ] );
|
|
||||||
CreateNoDeathmatchZone( radius, g_CIASpawns[ 0 ] [ RANDOM_SPAWN_X ], g_CIASpawns[ 0 ] [ RANDOM_SPAWN_Y ] );
|
|
||||||
CreateNoDeathmatchZone( radius, g_PoliceSpawns[ 0 ] [ RANDOM_SPAWN_X ], g_PoliceSpawns[ 0 ] [ RANDOM_SPAWN_Y ] );*/
|
|
||||||
|
|
||||||
/* ** Set everyone offline ** */
|
/* ** Set everyone offline ** */
|
||||||
mysql_single_query( "UPDATE `USERS` SET `ONLINE` = 0" );
|
mysql_single_query( "UPDATE `USERS` SET `ONLINE` = 0" );
|
||||||
|
|
||||||
@ -1108,22 +1079,6 @@ public OnPlayerEditDynamicObject( playerid, objectid, response, Float:x, Float:y
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnPlayerTakeOutFire( playerid, fireid )
|
|
||||||
{
|
|
||||||
Achievement::HandleExtinguishedFires( playerid );
|
|
||||||
SendClientMessageToFireman( -1, "{A83434}[FIREMAN]{FFFFFF} %s(%d) has extinguished house fire %d.", ReturnPlayerName( playerid ), playerid, fireid );
|
|
||||||
GivePlayerScore( playerid, 2 );
|
|
||||||
//GivePlayerExperience( playerid, E_FIREMAN );
|
|
||||||
GivePlayerCash( playerid, 5000 );
|
|
||||||
g_fireData[ fireid ] [ E_CREATED ] = false;
|
|
||||||
g_fireData[ fireid ] [ E_HOUSE ] = -1;
|
|
||||||
DestroyDynamicObject ( g_fireData[ fireid ] [ E_OBJECT ] );
|
|
||||||
g_fireData[ fireid ] [ E_OBJECT ] = INVALID_OBJECT_ID;
|
|
||||||
DestroyDynamic3DTextLabel ( g_fireData[ fireid ] [ E_LABEL ] );
|
|
||||||
g_fireData[ fireid ] [ E_LABEL ] = Text3D: 0xFFFF;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OnGameModeExit( )
|
public OnGameModeExit( )
|
||||||
{
|
{
|
||||||
KillTimer( rl_ServerUpdate );
|
KillTimer( rl_ServerUpdate );
|
||||||
@ -1136,8 +1091,8 @@ public OnGameModeExit( )
|
|||||||
public OnServerUpdateTimer( )
|
public OnServerUpdateTimer( )
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
iState, iVehicle, iWeapon, iAmmo, iKeys,
|
iState, iVehicle, iWeapon, iAmmo,
|
||||||
Float: fX, Float: fY, Float: fZ, Float: fLastRate
|
Float: fLastRate
|
||||||
;
|
;
|
||||||
|
|
||||||
// for hooks
|
// for hooks
|
||||||
@ -1189,8 +1144,6 @@ public OnServerUpdateTimer( )
|
|||||||
iWeapon = GetPlayerWeapon( playerid );
|
iWeapon = GetPlayerWeapon( playerid );
|
||||||
iState = GetPlayerState( playerid );
|
iState = GetPlayerState( playerid );
|
||||||
|
|
||||||
GetPlayerKeys( playerid, iKeys, tmpVariable, tmpVariable );
|
|
||||||
|
|
||||||
// Generally Updated textdraws
|
// Generally Updated textdraws
|
||||||
PlayerTextDrawSetString( playerid, p_LocationTD[ playerid ], GetPlayerArea( playerid ) );
|
PlayerTextDrawSetString( playerid, p_LocationTD[ playerid ], GetPlayerArea( playerid ) );
|
||||||
|
|
||||||
@ -1382,42 +1335,6 @@ public OnServerUpdateTimer( )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Taking Out Fires
|
|
||||||
if ( p_Class[ playerid ] == CLASS_FIREMAN && ( iKeys & KEY_FIRE ) || ( iKeys & KEY_WALK ) )
|
|
||||||
{
|
|
||||||
if ( iWeapon == 42 || GetVehicleModel( iVehicle ) == 407 )
|
|
||||||
{
|
|
||||||
for( new i; i < sizeof( g_fireData ); i ++ ) if ( g_fireData[ i ] [ E_CREATED ] )
|
|
||||||
{
|
|
||||||
if ( GetDynamicObjectPos( g_fireData[ i ] [ E_OBJECT ], fX, fY, fZ ) )
|
|
||||||
{
|
|
||||||
fZ += 2.3;
|
|
||||||
|
|
||||||
if ( IsPlayerInRangeOfPoint( playerid, ( GetVehicleModel( iVehicle ) == 407 ? 25.0 : 10.0 ), fX, fY, fZ ) )
|
|
||||||
{
|
|
||||||
if ( IsPlayerAimingAt( playerid, fX, fY, fZ, ( GetVehicleModel( iVehicle ) == 407 ? 3.0 : 1.0 ) ) )
|
|
||||||
{
|
|
||||||
if ( g_fireData[ i ] [ E_HEALTH ] > 0.0 )
|
|
||||||
{
|
|
||||||
if ( ( g_fireData[ i ] [ E_HEALTH ] -= GetVehicleModel( iVehicle ) == 407 ? ( 2.85 + fRandomEx( 1.0, 5.0 ) ) : ( 1.25 + fRandomEx( 1.0, 5.0 ) ) ) < 0.0 )
|
|
||||||
g_fireData[ i ] [ E_HEALTH ] = 0.0;
|
|
||||||
|
|
||||||
UpdateDynamic3DTextLabelText( g_fireData[ i ] [ E_LABEL ], COLOR_YELLOW, sprintf( "%0.1f", g_fireData[ i ] [ E_HEALTH ] ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_fireData[ i ] [ E_HEALTH ] = 0.0;
|
|
||||||
CallLocalFunction( "OnPlayerTakeOutFire", "dd", playerid, i );
|
|
||||||
UpdateDynamic3DTextLabelText( g_fireData[ i ] [ E_LABEL ], COLOR_YELLOW, sprintf( "%0.1f", g_fireData[ i ] [ E_HEALTH ] ) );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the player's VIP has expired
|
// Check if the player's VIP has expired
|
||||||
CheckPlayerVipExpiry( playerid );
|
CheckPlayerVipExpiry( playerid );
|
||||||
|
|
||||||
@ -1852,8 +1769,6 @@ public OnPlayerRequestClass( playerid, classid )
|
|||||||
TextDrawHideForPlayer( playerid, g_CurrentRankTD );
|
TextDrawHideForPlayer( playerid, g_CurrentRankTD );
|
||||||
TextDrawHideForPlayer( playerid, g_currentXPTD );
|
TextDrawHideForPlayer( playerid, g_currentXPTD );
|
||||||
TextDrawHideForPlayer( playerid, g_DoubleXPTD );
|
TextDrawHideForPlayer( playerid, g_DoubleXPTD );
|
||||||
KillTimer( p_FireDistanceTimer[ playerid ] );
|
|
||||||
p_FireDistanceTimer[ playerid ] = 0xFF;
|
|
||||||
PlayerTextDrawHide( playerid, p_FireDistance1[ playerid ] );
|
PlayerTextDrawHide( playerid, p_FireDistance1[ playerid ] );
|
||||||
PlayerTextDrawHide( playerid, p_FireDistance2[ playerid ] );
|
PlayerTextDrawHide( playerid, p_FireDistance2[ playerid ] );
|
||||||
p_MoneyBag{ playerid } = false;
|
p_MoneyBag{ playerid } = false;
|
||||||
@ -2415,8 +2330,6 @@ public OnPlayerDisconnect( playerid, reason )
|
|||||||
//p_CopTutorialProgress{ playerid } = 0;
|
//p_CopTutorialProgress{ playerid } = 0;
|
||||||
DestroyDynamicRaceCP( p_MiningExport[ playerid ] );
|
DestroyDynamicRaceCP( p_MiningExport[ playerid ] );
|
||||||
p_MiningExport[ playerid ] = 0xFFFF;
|
p_MiningExport[ playerid ] = 0xFFFF;
|
||||||
KillTimer( p_FireDistanceTimer[ playerid ] );
|
|
||||||
p_FireDistanceTimer[ playerid ] = 0xFF;
|
|
||||||
p_ContractedAmount[ playerid ] = 0;
|
p_ContractedAmount[ playerid ] = 0;
|
||||||
ClearPlayerWantedLevel( playerid );
|
ClearPlayerWantedLevel( playerid );
|
||||||
Delete3DTextLabel( p_InfoLabel[ playerid ] );
|
Delete3DTextLabel( p_InfoLabel[ playerid ] );
|
||||||
@ -3832,35 +3745,6 @@ function emp_deactivate( vehicleid )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function OnPlayerFireDistanceUpdate( playerid )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
Float: X, Float: Y, Float: Z, Float: dis,
|
|
||||||
szFire1[ 128 ], szFire2[ 128 ]
|
|
||||||
;
|
|
||||||
|
|
||||||
for( new i; i < sizeof( g_fireData ); i++ )
|
|
||||||
{
|
|
||||||
GetDynamicObjectPos( g_fireData[ i ] [ E_OBJECT ], X, Y, Z );
|
|
||||||
dis = GetPlayerDistanceFromPoint( playerid, X, Y, Z );
|
|
||||||
if ( i < floatround( sizeof( g_fireData ) / 2 ) )
|
|
||||||
{
|
|
||||||
if ( g_fireData[ i ] [ E_CREATED ] == false ) format( szFire1, sizeof( szFire1 ), "%s~r~FIRE %d:%s ~g~Stopped~n~", szFire1, i,i==1?(" "):("") );
|
|
||||||
else format( szFire1, sizeof( szFire1 ), "%s~r~FIRE %d:%s~w~ %0.0f m~n~", szFire1, i,i==1?("_"):(""), dis );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( g_fireData[ i ] [ E_CREATED ] == false ) format( szFire2, sizeof( szFire2 ), "%s~r~FIRE %d:%s ~g~Stopped~n~", szFire2, i,i==1?(" "):("") );
|
|
||||||
else format( szFire2, sizeof( szFire2 ), "%s~r~FIRE %d:%s~w~ %0.0f m~n~", szFire2, i,i==1?("_"):(""), dis );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PlayerTextDrawSetString( playerid, p_FireDistance1[ playerid ], szFire1 );
|
|
||||||
PlayerTextDrawSetString( playerid, p_FireDistance2[ playerid ], szFire2 );
|
|
||||||
PlayerTextDrawShow( playerid, p_FireDistance1[ playerid ] );
|
|
||||||
PlayerTextDrawShow( playerid, p_FireDistance2[ playerid ] );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OnPlayerLeaveGang( playerid, gangid, reason )
|
public OnPlayerLeaveGang( playerid, gangid, reason )
|
||||||
{
|
{
|
||||||
switch( reason )
|
switch( reason )
|
||||||
@ -6245,28 +6129,6 @@ CMD:idof( playerid, params[ ] )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMD:firetracker( playerid, params[ ] )
|
|
||||||
{
|
|
||||||
if ( p_Class[ playerid ] != CLASS_FIREMAN )
|
|
||||||
return SendError( playerid, "You are not a fireman." );
|
|
||||||
|
|
||||||
KillTimer( p_FireDistanceTimer[ playerid ] );
|
|
||||||
p_FireDistanceTimer[ playerid ] = 0xFF;
|
|
||||||
p_FireDistanceTimer[ playerid ] = SetTimerEx( "OnPlayerFireDistanceUpdate", 1000, true, "d", playerid );
|
|
||||||
SendServerMessage( playerid, "Fire's have been tracked and have been forwarded to you in meters. Find the fires and extinguish them." );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
CMD:rfiretracker( playerid, params[ ] )
|
|
||||||
{
|
|
||||||
KillTimer( p_FireDistanceTimer[ playerid ] );
|
|
||||||
p_FireDistanceTimer[ playerid ] = 0xFF;
|
|
||||||
PlayerTextDrawHide( playerid, p_FireDistance1[ playerid ] );
|
|
||||||
PlayerTextDrawHide( playerid, p_FireDistance2[ playerid ] );
|
|
||||||
SendServerMessage( playerid, "You have turned off your fire tracker." );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
CMD:playercolor( playerid, params[ ] ) return cmd_pc( playerid, params );
|
CMD:playercolor( playerid, params[ ] ) return cmd_pc( playerid, params );
|
||||||
CMD:pc( playerid, params[ ] )
|
CMD:pc( playerid, params[ ] )
|
||||||
{
|
{
|
||||||
@ -15432,70 +15294,6 @@ stock IsPlayerAimingAt(playerid, Float:x, Float:y, Float:z, Float:radius)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock CreateFire( )
|
|
||||||
{
|
|
||||||
static string[ 6 ];
|
|
||||||
if ( fire_toggled )
|
|
||||||
{
|
|
||||||
for( new i; i < sizeof( g_fireData ); i ++ )
|
|
||||||
{
|
|
||||||
if ( g_fireData[ i ] [ E_CREATED ] == true )
|
|
||||||
{
|
|
||||||
g_fireData[ i ] [ E_CREATED ] = false;
|
|
||||||
g_fireData[ i ] [ E_HOUSE ] = -1;
|
|
||||||
DestroyDynamicObject( g_fireData[ i ] [ E_OBJECT ] );
|
|
||||||
g_fireData[ i ] [ E_OBJECT ] = INVALID_OBJECT_ID;
|
|
||||||
DestroyDynamic3DTextLabel( g_fireData[ i ] [ E_LABEL ] );
|
|
||||||
g_fireData[ i ] [ E_LABEL ] = Text3D: 0xFFFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fire_toggled = false;
|
|
||||||
CreateFire( );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for( new i = 0; i < sizeof( g_fireData ); i ++ )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
house = GetRandomCreatedHouse( );
|
|
||||||
|
|
||||||
if ( Iter_Contains( houses, house ) )
|
|
||||||
{
|
|
||||||
g_fireData[ i ] [ E_HEALTH ] = 100.0 + fRandomEx( 1, 25 );
|
|
||||||
g_fireData[ i ] [ E_HOUSE ] = house;
|
|
||||||
g_fireData[ i ] [ E_CREATED ] = true;
|
|
||||||
format( string, sizeof( string ), "%0.1f", g_fireData[ i ] [ E_HEALTH ] );
|
|
||||||
g_fireData[ i ] [ E_LABEL ] = CreateDynamic3DTextLabel( string, COLOR_YELLOW, g_houseData[ house ] [ E_EX ], g_houseData[ house ] [ E_EY ], g_houseData[ house ] [ E_EZ ] + 0.5, 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1 );
|
|
||||||
g_fireData[ i ] [ E_OBJECT ] = CreateDynamicObject( 18691, g_houseData[ house ] [ E_EX ], g_houseData[ house ] [ E_EY ], g_houseData[ house ] [ E_EZ ] - 2.3, 0.0, 0.0, 0.0 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fire_toggled = true;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
stock IsHouseOnFire( houseid )
|
|
||||||
{
|
|
||||||
if ( houseid < 0 || houseid > MAX_HOUSES )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if ( ! Iter_Contains( houses, houseid ) )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for( new i, Float: X, Float: Y, Float: Z; i < sizeof( g_fireData ); i++ )
|
|
||||||
{
|
|
||||||
if ( g_fireData[ i ] [ E_CREATED ] )
|
|
||||||
{
|
|
||||||
GetDynamicObjectPos( g_fireData[ i ] [ E_OBJECT ], X, Y, Z ); // Z is unused due to the object.
|
|
||||||
if ( g_houseData[ houseid ] [ E_EX ] == X && g_houseData[ houseid ] [ E_EY ] == Y )
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ShowAchievement( playerid, achievement[ ], score = -1 )
|
stock ShowAchievement( playerid, achievement[ ], score = -1 )
|
||||||
{
|
{
|
||||||
if ( score != -1 ) {
|
if ( score != -1 ) {
|
||||||
@ -18835,6 +18633,19 @@ stock SendClientMessageToCops( colour, format[ ], va_args<> ) // Conversion to f
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stock SendClientMessageToFireman( colour, format[ ], va_args<> ) // Conversion to foreach 14 stuffed the define, not sure how...
|
||||||
|
{
|
||||||
|
static
|
||||||
|
out[ 144 ];
|
||||||
|
|
||||||
|
va_format( out, sizeof( out ), format, va_start<2> );
|
||||||
|
|
||||||
|
foreach ( new i : Player ) if ( p_Class[ i ] == CLASS_FIREMAN ) {
|
||||||
|
SendClientMessage( i, colour, out );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
stock GetPlayerOutsidePos( playerid, &Float: X, &Float: Y, &Float: Z ) // gets the player position, if interior then the last checkpoint position
|
stock GetPlayerOutsidePos( playerid, &Float: X, &Float: Y, &Float: Z ) // gets the player position, if interior then the last checkpoint position
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
|
Loading…
Reference in New Issue
Block a user