Merge branch 'damage_feed' of https://bitbucket.org/lorenc/cnr into damage_feed
This commit is contained in:
commit
3c4bab5596
@ -438,18 +438,18 @@ CMD:givexp( playerid, params [ ] )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMD:giveip( playerid, params [ ] )
|
CMD:givesxp( playerid, params [ ] )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
pID,
|
pID,
|
||||||
ip
|
ip
|
||||||
;
|
;
|
||||||
if ( !IsPlayerAdmin( playerid ) || ! IsPlayerLeadMaintainer( playerid ) ) return 0;
|
if ( !IsPlayerAdmin( playerid ) || ! IsPlayerLeadMaintainer( playerid ) ) return 0;
|
||||||
else if ( sscanf( params, "ud", pID, ip ) ) SendUsage( playerid, "/giveip [PLAYER_ID] [IP_AMOUNT]" );
|
else if ( sscanf( params, "ud", pID, ip ) ) SendUsage( playerid, "/givesxp [PLAYER_ID] [IP_AMOUNT]" );
|
||||||
else if ( !IsPlayerConnected( pID ) ) SendError( playerid, "Invalid Player ID." );
|
else if ( !IsPlayerConnected( pID ) ) SendError( playerid, "Invalid Player ID." );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GivePlayerIrresistiblePoints( pID, ip );
|
GivePlayerSeasonalXP( pID, ip );
|
||||||
//AddAdminLogLineFormatted( "%s(%d) has given %s(%d) %d IP", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( pID ), pID, ip );
|
//AddAdminLogLineFormatted( "%s(%d) has given %s(%d) %d IP", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( pID ), pID, ip );
|
||||||
//SendClientMessageFormatted( pID, -1, ""COL_PINK"[ADMIN]{FFFFFF} %s(%d) has given you %d IP.", ReturnPlayerName( playerid ), playerid, ip );
|
//SendClientMessageFormatted( pID, -1, ""COL_PINK"[ADMIN]{FFFFFF} %s(%d) has given you %d IP.", ReturnPlayerName( playerid ), playerid, ip );
|
||||||
//SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]{FFFFFF} You've given %s(%d) %d IP.", ReturnPlayerName( pID ), pID, ip );
|
//SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]{FFFFFF} You've given %s(%d) %d IP.", ReturnPlayerName( pID ), pID, ip );
|
||||||
|
@ -37,6 +37,12 @@ enum E_LEVEL_DATA {
|
|||||||
Float: E_MAX_UNITS, Float: E_XP_DILATION
|
Float: E_MAX_UNITS, Float: E_XP_DILATION
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum E_RANK_DATA
|
||||||
|
{
|
||||||
|
Float: E_POINTS, E_NAME[ 32 ], E_MODEL,
|
||||||
|
E_COLOR,
|
||||||
|
};
|
||||||
|
|
||||||
static const
|
static const
|
||||||
Float: EXP_MAX_PLAYER_LEVEL = 100.0;
|
Float: EXP_MAX_PLAYER_LEVEL = 100.0;
|
||||||
|
|
||||||
@ -56,18 +62,33 @@ static const
|
|||||||
{ "Drug Production", 10000.0, 6.0 }, // 10k exports drug related
|
{ "Drug Production", 10000.0, 6.0 }, // 10k exports drug related
|
||||||
{ "Mining", 1500.0, 3.0 } // 1,500 mining ores
|
{ "Mining", 1500.0, 3.0 } // 1,500 mining ores
|
||||||
*/
|
*/
|
||||||
|
},
|
||||||
|
|
||||||
|
g_seasonalRanks[ ] [ E_RANK_DATA ] =
|
||||||
|
{
|
||||||
|
{ 49860.3, "Elite V", 19780, COLOR_GOLD },
|
||||||
|
{ 27833.9, "Elite IV", 19782, COLOR_GOLD },
|
||||||
|
{ 15537.9, "Elite III", 19781, COLOR_GOLD },
|
||||||
|
{ 8673.88, "Elite II", 19784, COLOR_GOLD },
|
||||||
|
{ 4842.10, "Elite I", 19783, COLOR_GOLD },
|
||||||
|
{ 2703.04, "Silver V", 19780, COLOR_GREY },
|
||||||
|
{ 1508.94, "Silver IV", 19782, COLOR_GREY },
|
||||||
|
{ 842.365, "Silver III", 19781, COLOR_GREY },
|
||||||
|
{ 470.19, "Silver II", 19784, COLOR_GREY },
|
||||||
|
{ 262.5, "Silver I", 19783, COLOR_GREY },
|
||||||
|
{ 0.0, "unranked", 19300, COLOR_GREY }
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
/* ** Variables ** */
|
/* ** Variables ** */
|
||||||
static stock
|
static stock
|
||||||
Float: g_playerExperience [ MAX_PLAYERS ] [ E_LEVELS ],
|
Float: g_playerExperience [ MAX_PLAYERS ] [ E_LEVELS ],
|
||||||
|
Float: p_seasonalXP [ MAX_PLAYERS ],
|
||||||
|
|
||||||
PlayerText: p_playerExpTitle [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_playerExpTitle [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
PlayerText: p_playerExpAwardTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_playerExpAwardTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
PlayerBar: p_playerExpProgress [ MAX_PLAYERS ],
|
PlayerBar: p_playerExpProgress [ MAX_PLAYERS ],
|
||||||
p_playerExpHideTimer [ MAX_PLAYERS ] = { -1, ... }
|
p_playerExpHideTimer [ MAX_PLAYERS ] = { -1, ... }
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
/* ** Important ** */
|
/* ** Important ** */
|
||||||
@ -134,24 +155,48 @@ hook OnPlayerConnect( playerid )
|
|||||||
|
|
||||||
// general reward
|
// general reward
|
||||||
p_playerExpAwardTD[ playerid ] = CreatePlayerTextDraw( playerid,319.000000, 167.000000, "+20 XP" );
|
p_playerExpAwardTD[ playerid ] = CreatePlayerTextDraw( playerid,319.000000, 167.000000, "+20 XP" );
|
||||||
PlayerTextDrawAlignment( playerid,p_playerExpAwardTD[ playerid ], 2 );
|
PlayerTextDrawAlignment( playerid, p_playerExpAwardTD[ playerid ], 2 );
|
||||||
PlayerTextDrawBackgroundColor( playerid,p_playerExpAwardTD[ playerid ], 255 );
|
PlayerTextDrawBackgroundColor( playerid, p_playerExpAwardTD[ playerid ], 255 );
|
||||||
PlayerTextDrawFont( playerid,p_playerExpAwardTD[ playerid ], 3 );
|
PlayerTextDrawFont( playerid, p_playerExpAwardTD[ playerid ], 3 );
|
||||||
PlayerTextDrawLetterSize( playerid,p_playerExpAwardTD[ playerid ], 0.450000, 1.599999 );
|
PlayerTextDrawLetterSize( playerid, p_playerExpAwardTD[ playerid ], 0.450000, 1.599999 );
|
||||||
PlayerTextDrawColor( playerid,p_playerExpAwardTD[ playerid ], COLOR_GOLD );
|
PlayerTextDrawColor( playerid, p_playerExpAwardTD[ playerid ], COLOR_GOLD );
|
||||||
PlayerTextDrawSetOutline( playerid,p_playerExpAwardTD[ playerid ], 1 );
|
PlayerTextDrawSetOutline( playerid, p_playerExpAwardTD[ playerid ], 1 );
|
||||||
PlayerTextDrawSetProportional( playerid,p_playerExpAwardTD[ playerid ], 1 );
|
PlayerTextDrawSetProportional( playerid, p_playerExpAwardTD[ playerid ], 1 );
|
||||||
PlayerTextDrawSetSelectable( playerid,p_playerExpAwardTD[ playerid ], 0 );
|
PlayerTextDrawSetSelectable( playerid, p_playerExpAwardTD[ playerid ], 0 );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hook OnPlayerDisconnect( playerid, reason ) {
|
hook OnPlayerDisconnect( playerid, reason )
|
||||||
|
{
|
||||||
|
p_seasonalXP[ playerid ] = 0.0;
|
||||||
|
|
||||||
|
// reset levels
|
||||||
for ( new l = 0; l < sizeof ( g_levelData ); l ++ ) {
|
for ( new l = 0; l < sizeof ( g_levelData ); l ++ ) {
|
||||||
g_playerExperience[ playerid ] [ E_LEVELS: l ] = 0;
|
g_playerExperience[ playerid ] [ E_LEVELS: l ] = 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook OnPlayerMovieMode( playerid, bool: toggled )
|
||||||
|
{
|
||||||
|
if ( toggled )
|
||||||
|
{
|
||||||
|
TextDrawShowForPlayer( playerid, g_CurrentRankTD );
|
||||||
|
TextDrawShowForPlayer( playerid, g_currentXPTD );
|
||||||
|
PlayerTextDrawShow( playerid, p_ExperienceTD[ playerid ] );
|
||||||
|
ShowPlayerIrresistibleRank( playerid );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TextDrawHideForPlayer( playerid, g_CurrentRankTD );
|
||||||
|
TextDrawHideForPlayer( playerid, g_currentXPTD );
|
||||||
|
PlayerTextDrawHide( playerid, p_ExperienceTD[ playerid ] );
|
||||||
|
PlayerTextDrawHide( playerid, p_PlayerRankTD[ playerid ] );
|
||||||
|
PlayerTextDrawHide( playerid, p_PlayerRankTextTD[ playerid ] );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* ** Commands ** */
|
/* ** Commands ** */
|
||||||
CMD:experience( playerid, params[ ] ) return cmd_level( playerid, params );
|
CMD:experience( playerid, params[ ] ) return cmd_level( playerid, params );
|
||||||
CMD:levels( playerid, params[ ] ) return cmd_level( playerid, params );
|
CMD:levels( playerid, params[ ] ) return cmd_level( playerid, params );
|
||||||
@ -186,6 +231,22 @@ CMD:level( playerid, params[ ] )
|
|||||||
return ShowPlayerDialog( playerid, DIALOG_VIEW_LEVEL, DIALOG_STYLE_TABLIST_HEADERS, sprintf( "{FFFFFF}%s's Level - Total Level %d", ReturnPlayerName( watchingid ), player_total_lvl ), szLargeString, "Refresh", "Close" );
|
return ShowPlayerDialog( playerid, DIALOG_VIEW_LEVEL, DIALOG_STYLE_TABLIST_HEADERS, sprintf( "{FFFFFF}%s's Level - Total Level %d", ReturnPlayerName( watchingid ), player_total_lvl ), szLargeString, "Refresh", "Close" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CMD:rank( playerid, params[ ] )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
watchingid;
|
||||||
|
|
||||||
|
if ( sscanf( params, "u", watchingid ) )
|
||||||
|
watchingid = playerid;
|
||||||
|
|
||||||
|
if ( !IsPlayerConnected( watchingid ) )
|
||||||
|
watchingid = playerid;
|
||||||
|
|
||||||
|
format( szBigString, 196, "SELECT uo.NAME, (SELECT COUNT(DISTINCT ui.`SCORE`) FROM `USERS` ui WHERE ui.`SCORE` >= uo.`SCORE`) AS `GLOBAL_RANK` FROM `USERS` uo WHERE `ID`=%d", p_AccountID[ watchingid ] );
|
||||||
|
mysql_function_query( dbHandle, szBigString, true, "currentUserRank", "ii", playerid, watchingid );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* ** SQL Threads ** */
|
/* ** SQL Threads ** */
|
||||||
thread Experience_OnLoad( playerid )
|
thread Experience_OnLoad( playerid )
|
||||||
{
|
{
|
||||||
@ -208,6 +269,25 @@ thread Experience_OnLoad( playerid )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thread currentUserRank( playerid, watchingid )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
rows;
|
||||||
|
|
||||||
|
cache_get_data( rows, tmpVariable );
|
||||||
|
|
||||||
|
if ( rows )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iGroupedRank = GetPlayerRank( watchingid ),
|
||||||
|
iGlobalRank = cache_get_field_content_int( 0, "GLOBAL_RANK", dbHandle )
|
||||||
|
;
|
||||||
|
SendServerMessage( playerid, "%s(%d) is grouped in {%06x}%s"COL_WHITE" and is globally "COL_GREY"#%d"COL_WHITE".", ReturnPlayerName( watchingid ), watchingid, g_seasonalRanks[ iGroupedRank ] [ E_COLOR ] >>> 8, g_seasonalRanks[ iGroupedRank ] [ E_NAME ], iGlobalRank );
|
||||||
|
}
|
||||||
|
else SendError( playerid, "Couldn't find a rank for this user, try again later." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* ** Functions ** */
|
/* ** Functions ** */
|
||||||
stock GivePlayerExperience( playerid, E_LEVELS: level, Float: default_xp = 1.0, bool: with_dilation = true )
|
stock GivePlayerExperience( playerid, E_LEVELS: level, Float: default_xp = 1.0, bool: with_dilation = true )
|
||||||
{
|
{
|
||||||
@ -239,6 +319,9 @@ stock GivePlayerExperience( playerid, E_LEVELS: level, Float: default_xp = 1.0,
|
|||||||
SetPlayerProgressBarValue( playerid, p_playerExpProgress[ playerid ], progress );
|
SetPlayerProgressBarValue( playerid, p_playerExpProgress[ playerid ], progress );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// seasonal
|
||||||
|
GivePlayerSeasonalXP( playerid, xp_earned );
|
||||||
|
|
||||||
// alert user
|
// alert user
|
||||||
KillTimer( p_playerExpHideTimer[ playerid ] );
|
KillTimer( p_playerExpHideTimer[ playerid ] );
|
||||||
PlayerTextDrawColor( playerid, p_playerExpTitle[ playerid ], g_levelData[ _: level ] [ E_COLOUR ] );
|
PlayerTextDrawColor( playerid, p_playerExpTitle[ playerid ], g_levelData[ _: level ] [ E_COLOUR ] );
|
||||||
@ -274,6 +357,105 @@ stock GetPlayerTotalLevel( playerid, &level = 0 ) {
|
|||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stock GetRankFromXP( Float: xp ) {
|
||||||
|
new
|
||||||
|
iRank;
|
||||||
|
|
||||||
|
for( iRank = 0; iRank < sizeof( g_seasonalRanks ); iRank++ )
|
||||||
|
if ( xp >= g_seasonalRanks[ iRank ] [ E_POINTS ] )
|
||||||
|
break;
|
||||||
|
|
||||||
|
return iRank;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock GetPlayerRank( playerid ) {
|
||||||
|
return GetRankFromXP( p_seasonalXP[ playerid ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
stock ShowPlayerIrresistibleRank( playerid )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iRank = GetPlayerRank( playerid );
|
||||||
|
|
||||||
|
PlayerTextDrawColor( playerid, p_PlayerRankTextTD[ playerid ], g_seasonalRanks[ iRank ] [ E_COLOR ] );
|
||||||
|
PlayerTextDrawSetString( playerid, p_PlayerRankTextTD[ playerid ], g_seasonalRanks[ iRank ] [ E_NAME ] );
|
||||||
|
|
||||||
|
PlayerTextDrawColor( playerid, p_PlayerRankTD[ playerid ], g_seasonalRanks[ iRank ] [ E_COLOR ] );
|
||||||
|
PlayerTextDrawSetPreviewModel( playerid, p_PlayerRankTD[ playerid ], g_seasonalRanks[ iRank ] [ E_MODEL ] );
|
||||||
|
|
||||||
|
PlayerTextDrawShow( playerid, p_PlayerRankTD[ playerid ] );
|
||||||
|
PlayerTextDrawShow( playerid, p_PlayerRankTextTD[ playerid ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
stock GivePlayerSeasonalXP( playerid, Float: default_xp )
|
||||||
|
{
|
||||||
|
new Float: previous_season_xp = p_seasonalXP[ playerid ];
|
||||||
|
new Float: current_season_xp = previous_season_xp + default_xp;
|
||||||
|
|
||||||
|
// default 0
|
||||||
|
if ( current_season_xp < 0.0 )
|
||||||
|
current_season_xp = 0.0;
|
||||||
|
|
||||||
|
new Float: upper_limit = g_seasonalRanks[ 0 ] [ E_POINTS ] + 500.0;
|
||||||
|
|
||||||
|
// so that the player has a chance to be deranked
|
||||||
|
if ( current_season_xp > upper_limit )
|
||||||
|
current_season_xp = upper_limit;
|
||||||
|
|
||||||
|
for( new iRank = 0; iRank < sizeof( g_seasonalRanks ); iRank++ )
|
||||||
|
{
|
||||||
|
new bGained = ( previous_season_xp < g_seasonalRanks[ iRank ] [ E_POINTS ] <= current_season_xp );
|
||||||
|
new bLost = ( current_season_xp < g_seasonalRanks[ iRank ] [ E_POINTS ] <= previous_season_xp );
|
||||||
|
|
||||||
|
if ( bGained || bLost )
|
||||||
|
{
|
||||||
|
if ( bGained )
|
||||||
|
{
|
||||||
|
SendServerMessage( playerid, "Congratulations, your grouped ranking has been increased to {%06x}%s"COL_WHITE"!", g_seasonalRanks[ iRank ] [ E_COLOR ] >>> 8, g_seasonalRanks[ iRank ] [ E_NAME ] );
|
||||||
|
|
||||||
|
PlayerTextDrawColor( playerid, p_PlayerRankTextTD[ playerid ], g_seasonalRanks[ iRank ] [ E_COLOR ] );
|
||||||
|
PlayerTextDrawSetString( playerid, p_PlayerRankTextTD[ playerid ], g_seasonalRanks[ iRank ] [ E_NAME ] );
|
||||||
|
|
||||||
|
PlayerTextDrawColor( playerid, p_PlayerRankTD[ playerid ], g_seasonalRanks[ iRank ] [ E_COLOR ] );
|
||||||
|
PlayerTextDrawSetPreviewModel( playerid, p_PlayerRankTD[ playerid ], g_seasonalRanks[ iRank ] [ E_MODEL ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( bLost )
|
||||||
|
{
|
||||||
|
SendServerMessage( playerid, "Sorry, your grouped ranking has decreased to {%06x}%s"COL_WHITE"!", g_seasonalRanks[ iRank + 1 ] [ E_COLOR ] >>> 8, g_seasonalRanks[ iRank + 1 ] [ E_NAME ] );
|
||||||
|
|
||||||
|
PlayerTextDrawColor( playerid, p_PlayerRankTextTD[ playerid ], g_seasonalRanks[ iRank + 1 ] [ E_COLOR ] );
|
||||||
|
PlayerTextDrawSetString( playerid, p_PlayerRankTextTD[ playerid ], g_seasonalRanks[ iRank + 1 ] [ E_NAME ] );
|
||||||
|
|
||||||
|
PlayerTextDrawColor( playerid, p_PlayerRankTD[ playerid ], g_seasonalRanks[ iRank + 1 ] [ E_COLOR ] );
|
||||||
|
PlayerTextDrawSetPreviewModel( playerid, p_PlayerRankTD[ playerid ], g_seasonalRanks[ iRank + 1 ] [ E_MODEL ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerTextDrawShow( playerid, p_PlayerRankTD[ playerid ] );
|
||||||
|
PlayerTextDrawShow( playerid, p_PlayerRankTextTD[ playerid ] );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//printf( "%s: %f points", ReturnPlayerName( playerid ), current_season_xp );
|
||||||
|
p_seasonalXP[ playerid ] = current_season_xp;
|
||||||
|
|
||||||
|
// save to database
|
||||||
|
mysql_single_query( sprintf( "UPDATE `USERS` SET `RANK` = %f WHERE `ID` = %d", current_season_xp, GetPlayerAccountID( playerid ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
stock GetSeasonalRankName( rankid ) {
|
||||||
|
return g_seasonalRanks[ rankid ] [ E_NAME ];
|
||||||
|
}
|
||||||
|
|
||||||
|
stock GetSeasonalRankColour( rankid ) {
|
||||||
|
return g_seasonalRanks[ rankid ] [ E_COLOR ];
|
||||||
|
}
|
||||||
|
|
||||||
|
stock SetPlayerSeasonalXP( playerid, Float: seasonal_xp ) {
|
||||||
|
p_seasonalXP[ playerid ] = seasonal_xp;
|
||||||
|
}
|
||||||
|
|
||||||
/* ** Migrations ** */
|
/* ** Migrations ** */
|
||||||
/*
|
/*
|
||||||
CREATE TABLE IF NOT EXISTS USER_LEVELS (
|
CREATE TABLE IF NOT EXISTS USER_LEVELS (
|
||||||
@ -296,4 +478,4 @@ stock GetPlayerTotalLevel( playerid, &level = 0 ) {
|
|||||||
INSERT INTO USER_LEVELS (USER_ID, LEVEL_ID, EXPERIENCE) (SELECT ID as USER_ID, 6 as LEVEL_ID, (BLEW_JAILS + BLEW_VAULT) * 6.0 AS EXPERIENCE FROM USERS);
|
INSERT INTO USER_LEVELS (USER_ID, LEVEL_ID, EXPERIENCE) (SELECT ID as USER_ID, 6 as LEVEL_ID, (BLEW_JAILS + BLEW_VAULT) * 6.0 AS EXPERIENCE FROM USERS);
|
||||||
INSERT INTO USER_LEVELS (USER_ID, LEVEL_ID, EXPERIENCE) (SELECT ID as USER_ID, 7 as LEVEL_ID, VEHICLES_JACKED * 6.0 AS EXPERIENCE FROM USERS);
|
INSERT INTO USER_LEVELS (USER_ID, LEVEL_ID, EXPERIENCE) (SELECT ID as USER_ID, 7 as LEVEL_ID, VEHICLES_JACKED * 6.0 AS EXPERIENCE FROM USERS);
|
||||||
INSERT INTO USER_LEVELS (USER_ID, LEVEL_ID, EXPERIENCE) (SELECT ID as USER_ID, 8 as LEVEL_ID, (METH_YIELDED + (TRUCKED*0.33)) * 6.0 AS EXPERIENCE FROM USERS);
|
INSERT INTO USER_LEVELS (USER_ID, LEVEL_ID, EXPERIENCE) (SELECT ID as USER_ID, 8 as LEVEL_ID, (METH_YIELDED + (TRUCKED*0.33)) * 6.0 AS EXPERIENCE FROM USERS);
|
||||||
*/
|
*/
|
||||||
|
@ -1159,7 +1159,7 @@ hook OnPlayerDisconnect( playerid, reason )
|
|||||||
new
|
new
|
||||||
members = 0;
|
members = 0;
|
||||||
|
|
||||||
GetOnlineBusinessAssociates( playerid, members, playerid );
|
GetOnlineBusinessAssociates( businessid, members, playerid );
|
||||||
|
|
||||||
// printf ("%d online players for business %d, stopping mission?", members, businessid );
|
// printf ("%d online players for business %d, stopping mission?", members, businessid );
|
||||||
if ( members <= 0 ) {
|
if ( members <= 0 ) {
|
||||||
|
@ -11,17 +11,20 @@
|
|||||||
/* ** Definitions ** */
|
/* ** Definitions ** */
|
||||||
#define MAX_FIRES ( 10 )
|
#define MAX_FIRES ( 10 )
|
||||||
|
|
||||||
|
#define FIRE_EXTINGUISH_PAYOUT ( 5000 )
|
||||||
|
|
||||||
/* ** Variables ** */
|
/* ** Variables ** */
|
||||||
enum E_FIRE_DATA
|
enum E_FIRE_DATA
|
||||||
{
|
{
|
||||||
bool: E_CREATED, E_OBJECT, Float: E_HEALTH,
|
E_OBJECT, Float: E_HEALTH, E_HOUSE,
|
||||||
E_HOUSE, Text3D: E_LABEL
|
Text3D: E_LABEL, E_MAP_ICON
|
||||||
};
|
};
|
||||||
|
|
||||||
static stock
|
static stock
|
||||||
g_fireData [ MAX_FIRES ] [ E_FIRE_DATA ],
|
g_fireData [ MAX_FIRES ] [ E_FIRE_DATA ],
|
||||||
p_FireDistanceTimer [ MAX_PLAYERS ] = { -1, ... },
|
Iterator: fires < MAX_FIRES >,
|
||||||
bool: fire_toggled = false
|
|
||||||
|
p_FireTracker [ MAX_PLAYERS char ]
|
||||||
;
|
;
|
||||||
|
|
||||||
/* ** Forwards ** */
|
/* ** Forwards ** */
|
||||||
@ -55,48 +58,45 @@ hook OnPlayerUpdateEx( playerid )
|
|||||||
if ( p_Class[ playerid ] == CLASS_FIREMAN && ( iKeys & KEY_FIRE ) || ( iKeys & KEY_WALK ) )
|
if ( p_Class[ playerid ] == CLASS_FIREMAN && ( iKeys & KEY_FIRE ) || ( iKeys & KEY_WALK ) )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
iVehicle = GetPlayerVehicleID( playerid );
|
using_firetruck = GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 407;
|
||||||
|
|
||||||
if ( GetPlayerWeapon( playerid ) == 42 || GetVehicleModel( iVehicle ) == 407 )
|
if ( GetPlayerWeapon( playerid ) == 42 || using_firetruck )
|
||||||
{
|
{
|
||||||
for( new i = 0; i < sizeof( g_fireData ); i ++ ) if ( g_fireData[ i ] [ E_CREATED ] )
|
foreach ( new i : fires )
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
Float: fX, Float: fY, Float: fZ;
|
Float: fX, Float: fY, Float: fZ;
|
||||||
|
|
||||||
if ( GetDynamicObjectPos( g_fireData[ i ] [ E_OBJECT ], fX, fY, fZ ) )
|
if ( GetDynamicObjectPos( g_fireData[ i ] [ E_OBJECT ], fX, fY, fZ ) )
|
||||||
{
|
{
|
||||||
|
// add a bit of height cause of the fire
|
||||||
fZ += 2.3;
|
fZ += 2.3;
|
||||||
|
|
||||||
if ( IsPlayerInRangeOfPoint( playerid, ( GetVehicleModel( iVehicle ) == 407 ? 25.0 : 10.0 ), fX, fY, fZ ) )
|
// check if range of point
|
||||||
|
if ( IsPlayerInRangeOfPoint( playerid, ( using_firetruck ? 30.0 : 10.0 ), fX, fY, fZ ) )
|
||||||
{
|
{
|
||||||
if ( IsPlayerAimingAt( playerid, fX, fY, fZ, ( GetVehicleModel( iVehicle ) == 407 ? 3.0 : 1.0 ) ) )
|
if ( IsPlayerAimingAt( playerid, fX, fY, fZ, ( using_firetruck ? 3.5 : 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 ] ) );
|
new
|
||||||
|
Float: removed_health = ( 2.5 + fRandomEx( 1.0, 5.0 ) ) * ( using_firetruck ? 2.5 : 1.0 );
|
||||||
|
|
||||||
|
if ( ( g_fireData[ i ] [ E_HEALTH ] -= removed_health ) < 0.0 ) {
|
||||||
|
g_fireData[ i ] [ E_HEALTH ] = 0.0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
UpdateDynamic3DTextLabelText( g_fireData[ i ] [ E_LABEL ], 0xA83434FF, sprintf( "House Fire %0.1f%", g_fireData[ i ] [ E_HEALTH ] ) );
|
||||||
|
|
||||||
|
if ( g_fireData[ i ] [ E_HEALTH ] <= 0.0 )
|
||||||
{
|
{
|
||||||
ach_HandleExtinguishedFires( playerid );
|
ach_HandleExtinguishedFires( playerid );
|
||||||
SendClientMessageToFireman( -1, "{A83434}[FIREMAN]{FFFFFF} %s(%d) has extinguished house fire %d.", ReturnPlayerName( playerid ), playerid, i );
|
SendClientMessageToFireman( -1, "{A83434}[FIREMAN]"COL_WHITE" %s(%d) has earned "COL_GOLD"%s"COL_WHITE" for extinguishing a house fire.", ReturnPlayerName( playerid ), playerid, cash_format( FIRE_EXTINGUISH_PAYOUT ) );
|
||||||
GivePlayerScore( playerid, 2 );
|
GivePlayerScore( playerid, 2 );
|
||||||
//GivePlayerExperience( playerid, E_FIREMAN );
|
//GivePlayerExperience( playerid, E_FIREMAN );
|
||||||
GivePlayerCash( playerid, 5000 );
|
GivePlayerCash( playerid, FIRE_EXTINGUISH_PAYOUT );
|
||||||
|
HouseFire_Remove( i );
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,74 +106,140 @@ hook OnPlayerUpdateEx( playerid )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook OnServerUpdate( )
|
||||||
|
{
|
||||||
|
// create fires if there are no fires existing and houses available
|
||||||
|
if ( ! Iter_Count( fires ) && Iter_Count( houses ) ) {
|
||||||
|
HouseFire_Create( );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnServerGameDayEnd( )
|
||||||
|
{
|
||||||
|
HouseFire_Create( );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerDriveVehicle( playerid, vehicleid )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
modelid = GetVehicleModel( vehicleid );
|
||||||
|
|
||||||
|
if ( modelid == 407 ) {
|
||||||
|
ShowPlayerHelpDialog( playerid, 2500, "You can see where fires are using ~g~/fires" );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* ** Commands ** */
|
/* ** Commands ** */
|
||||||
CMD:firetracker( playerid, params[ ] )
|
CMD:firetracker( playerid, params[ ] ) cmd_fires( playerid, params );
|
||||||
|
CMD:fires( playerid, params[ ] )
|
||||||
{
|
{
|
||||||
if ( p_Class[ playerid ] != CLASS_FIREMAN )
|
if ( p_Class[ playerid ] != CLASS_FIREMAN )
|
||||||
return SendError( playerid, "You are not a fireman." );
|
return SendError( playerid, "You are not a fireman." );
|
||||||
|
|
||||||
if ( p_FireDistanceTimer[ playerid ] != -1 )
|
p_FireTracker{ playerid } = ! p_FireTracker{ playerid };
|
||||||
return StopPlayerFireTracker( playerid ), SendServerMessage( playerid, "You have turned off your fire tracker." );
|
|
||||||
|
|
||||||
KillTimer( p_FireDistanceTimer[ playerid ] );
|
if ( p_FireTracker{ 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 )
|
UpdatePlayerFireTracker( playerid );
|
||||||
{
|
return SendServerMessage( playerid, "All house fires are now in your minimap as red markers." );
|
||||||
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
|
else
|
||||||
{
|
{
|
||||||
static
|
StopPlayerFireTracker( playerid );
|
||||||
Float: X, Float: Y, Float: Z;
|
return SendServerMessage( playerid, "You have hidden all the fires from your radar." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for ( new i = 0; i < sizeof( g_fireData ); i ++ )
|
/* ** Functions ** */
|
||||||
{
|
stock HouseFire_Create( )
|
||||||
new
|
{
|
||||||
house = GetRandomCreatedHouse( );
|
// create house house fires for random homes
|
||||||
|
for ( new fireid = 0; fireid < MAX_FIRES; fireid ++ ) if ( ! Iter_Contains( fires, fireid ) )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
houseid = HouseFire_GetRandomHome( );
|
||||||
|
|
||||||
if ( Iter_Contains( houses, house ) )
|
if ( Iter_Contains( houses, houseid ) )
|
||||||
{
|
{
|
||||||
GetHousePos( house, X, Y, Z );
|
static
|
||||||
g_fireData[ i ] [ E_HEALTH ] = 100.0 + fRandomEx( 1, 25 );
|
Float: X, Float: Y, Float: Z;
|
||||||
g_fireData[ i ] [ E_HOUSE ] = house;
|
|
||||||
g_fireData[ i ] [ E_CREATED ] = true;
|
GetHousePos( houseid, X, Y, Z );
|
||||||
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 );
|
g_fireData[ fireid ] [ E_HEALTH ] = 100.0 + fRandomEx( 1, 25 );
|
||||||
}
|
g_fireData[ fireid ] [ E_HOUSE ] = houseid;
|
||||||
|
g_fireData[ fireid ] [ E_LABEL ] = CreateDynamic3DTextLabel( sprintf( "House Fire %0.1f%", g_fireData[ fireid ] [ E_HEALTH ] ), 0xA83434FF, X, Y, Z + 0.5, 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1 );
|
||||||
|
g_fireData[ fireid ] [ E_OBJECT ] = CreateDynamicObject( 18691, X, Y, Z - 2.3, 0.0, 0.0, 0.0 );
|
||||||
|
|
||||||
|
// fire map icons
|
||||||
|
g_fireData[ fireid ] [ E_MAP_ICON ] = CreateDynamicMapIcon( X, Y, Z, 0, 0xA83434FF, -1, -1, 0, 6000.0, MAPICON_GLOBAL );
|
||||||
|
Streamer_RemoveArrayData( STREAMER_TYPE_MAP_ICON, g_fireData[ fireid ] [ E_MAP_ICON ], E_STREAMER_PLAYER_ID, 0 );
|
||||||
|
|
||||||
|
Iter_Add( fires, fireid );
|
||||||
}
|
}
|
||||||
fire_toggled = true;
|
}
|
||||||
|
|
||||||
|
// show on radar when it is created
|
||||||
|
foreach ( new playerid : Player ) if ( GetPlayerClass( playerid ) == CLASS_FIREMAN && p_FireTracker{ playerid } ) {
|
||||||
|
UpdatePlayerFireTracker( playerid );
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stock HouseFire_Remove( fireid )
|
||||||
|
{
|
||||||
|
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: INVALID_3DTEXT_ID;
|
||||||
|
DestroyDynamicMapIcon( g_fireData[ fireid ] [ E_MAP_ICON ] );
|
||||||
|
g_fireData[ fireid ] [ E_MAP_ICON ] = -1;
|
||||||
|
Iter_Remove( fires, fireid );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock HouseFire_GetRandomHome( )
|
||||||
|
{
|
||||||
|
if ( ! Iter_Count( houses ) ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static szCity[ MAX_ZONE_NAME ];
|
||||||
|
new ignoredHomes[ MAX_HOUSES ] = { -1, ... };
|
||||||
|
|
||||||
|
// first find homes to ignore
|
||||||
|
for ( new i = 0; i < MAX_HOUSES; i ++ )
|
||||||
|
{
|
||||||
|
// Avoid Hills / Avoid V.I.P or Clan Homes
|
||||||
|
if ( ! Iter_Contains( houses, i ) || g_houseData[ i ] [ E_EZ ] > 300.0 || g_houseData[ i ] [ E_COST ] < 500000 ) {
|
||||||
|
ignoredHomes[ i ] = i;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for house fire
|
||||||
|
if ( IsHouseOnFire( i ) ) {
|
||||||
|
ignoredHomes[ i ] = i;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// San Fierro only
|
||||||
|
Get2DCity( szCity, g_houseData[ i ] [ E_EX ], g_houseData[ i ] [ E_EY ], g_houseData[ i ] [ E_EZ ] );
|
||||||
|
if ( ! strmatch( szCity, "San Fierro" ) ) {
|
||||||
|
ignoredHomes[ i ] = i;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
random_home = randomExcept( ignoredHomes, sizeof( ignoredHomes ) );
|
||||||
|
|
||||||
|
// apparently 'safer' to return value from variable
|
||||||
|
return random_home;
|
||||||
|
}
|
||||||
|
|
||||||
stock IsHouseOnFire( houseid )
|
stock IsHouseOnFire( houseid )
|
||||||
{
|
{
|
||||||
if ( houseid < 0 || houseid > MAX_HOUSES )
|
if ( houseid < 0 || houseid > MAX_HOUSES )
|
||||||
@ -182,45 +248,111 @@ stock IsHouseOnFire( houseid )
|
|||||||
if ( ! Iter_Contains( houses, houseid ) )
|
if ( ! Iter_Contains( houses, houseid ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for( new i, Float: X, Float: Y, Float: Z; i < sizeof( g_fireData ); i++ )
|
static
|
||||||
|
Float: X, Float: Y, Float: Z, Float: HX, Float: HY;
|
||||||
|
|
||||||
|
foreach ( new fireid : fires )
|
||||||
{
|
{
|
||||||
if ( g_fireData[ i ] [ E_CREATED ] )
|
GetDynamicObjectPos( g_fireData[ fireid ] [ E_OBJECT ], X, Y, Z ); // Z is unused due to the object.
|
||||||
{
|
GetHousePos( houseid, HX, HY, Z );
|
||||||
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 )
|
if ( HX == X && HY == Y )
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function OnPlayerFireDistanceUpdate( playerid )
|
stock UpdatePlayerFireTracker( playerid )
|
||||||
{
|
{
|
||||||
new
|
// add player to map icon list
|
||||||
Float: X, Float: Y, Float: Z, Float: dis,
|
foreach ( new fireid : fires ) {
|
||||||
szFire1[ 128 ], szFire2[ 128 ]
|
Streamer_AppendArrayData( STREAMER_TYPE_MAP_ICON, g_fireData[ fireid ] [ E_MAP_ICON ], E_STREAMER_PLAYER_ID, playerid );
|
||||||
;
|
|
||||||
|
|
||||||
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stock StopPlayerFireTracker( playerid )
|
||||||
|
{
|
||||||
|
// remove player from map icon list
|
||||||
|
foreach ( new fireid : fires ) if ( Streamer_IsInArrayData( STREAMER_TYPE_MAP_ICON, g_fireData[ fireid ] [ E_MAP_ICON ], E_STREAMER_PLAYER_ID, playerid ) ) {
|
||||||
|
Streamer_RemoveArrayData( STREAMER_TYPE_MAP_ICON, g_fireData[ fireid ] [ E_MAP_ICON ], E_STREAMER_PLAYER_ID, playerid );
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset firetracker
|
||||||
|
p_FireTracker{ playerid } = false;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock Float: GetPointAngleToPoint( Float: x2, Float: y2, Float: X, Float: Y )
|
||||||
|
{
|
||||||
|
new Float: DX, Float: DY;
|
||||||
|
new Float: angle;
|
||||||
|
|
||||||
|
DX = floatabs( floatsub( x2, X ) );
|
||||||
|
DY = floatabs( floatsub( y2, Y ) );
|
||||||
|
|
||||||
|
if ( DY == 0.0 || DX == 0.0 )
|
||||||
|
{
|
||||||
|
if ( DY == 0 && DX > 0 ) angle = 0.0;
|
||||||
|
else if ( DY == 0 && DX < 0 ) angle = 180.0;
|
||||||
|
else if ( DY > 0 && DX == 0 ) angle = 90.0;
|
||||||
|
else if ( DY < 0 && DX == 0 ) angle = 270.0;
|
||||||
|
else if ( DY == 0 && DX == 0 ) angle = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
angle = atan( DX / DY );
|
||||||
|
if ( X > x2 && Y <= y2 ) angle += 90.0;
|
||||||
|
else if ( X <= x2 && Y < y2 ) angle = floatsub( 90.0, angle );
|
||||||
|
else if ( X < x2 && Y >= y2 ) angle -= 90.0;
|
||||||
|
else if ( X >= x2 && Y > y2 ) angle = floatsub( 270.0, angle );
|
||||||
|
}
|
||||||
|
return floatadd( angle, 90.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
stock Float: DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ, Float:ObjX, Float:ObjY, Float:ObjZ, Float:FrX, Float:FrY, Float:FrZ) {
|
||||||
|
|
||||||
|
new Float: TGTDistance;
|
||||||
|
|
||||||
|
TGTDistance = floatsqroot( ( CamX - ObjX) * ( CamX - ObjX ) + ( CamY - ObjY ) * ( CamY - ObjY ) + ( CamZ - ObjZ ) * ( CamZ - ObjZ ) );
|
||||||
|
|
||||||
|
new Float: tmpX, Float: tmpY, Float: tmpZ;
|
||||||
|
|
||||||
|
tmpX = FrX * TGTDistance + CamX;
|
||||||
|
tmpY = FrY * TGTDistance + CamY;
|
||||||
|
tmpZ = FrZ * TGTDistance + CamZ;
|
||||||
|
|
||||||
|
return floatsqroot( ( tmpX - ObjX ) * ( tmpX - ObjX ) + ( tmpY - ObjY ) * ( tmpY - ObjY ) + ( tmpZ - ObjZ ) * ( tmpZ - ObjZ ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
stock IsPlayerAimingAt( playerid, Float: x, Float: y, Float: z, Float: radius ) // forgot who made this
|
||||||
|
{
|
||||||
|
new Float: camera_x, Float: camera_y, Float: camera_z;
|
||||||
|
new Float: vector_x, Float: vector_y, Float: vector_z;
|
||||||
|
|
||||||
|
GetPlayerCameraPos( playerid, camera_x, camera_y, camera_z );
|
||||||
|
GetPlayerCameraFrontVector( playerid, vector_x, vector_y, vector_z );
|
||||||
|
|
||||||
|
new Float: vertical, Float: horizontal;
|
||||||
|
|
||||||
|
switch ( GetPlayerWeapon( playerid ) )
|
||||||
|
{
|
||||||
|
case 34, 35, 36: return DistanceCameraTargetToLocation( camera_x, camera_y, camera_z, x, y, z, vector_x, vector_y, vector_z ) < radius;
|
||||||
|
case 30, 31: vertical = 4.0, horizontal = -1.6;
|
||||||
|
case 33: vertical = 2.7, horizontal = -1.0;
|
||||||
|
default: vertical = 6.0, horizontal = -2.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
new Float: angle = GetPointAngleToPoint( 0, 0, floatsqroot( vector_x * vector_x + vector_y * vector_y ), vector_z ) - 270.0;
|
||||||
|
new Float: resize_x, Float: resize_y, Float: resize_z = floatsin( angle + vertical, degrees );
|
||||||
|
|
||||||
|
GetXYInFrontOfPoint( resize_x, resize_y, GetPointAngleToPoint( 0, 0, vector_x, vector_y ) + horizontal, floatcos( angle + vertical, degrees ) );
|
||||||
|
return DistanceCameraTargetToLocation(camera_x, camera_y, camera_z, x, y, z, resize_x, resize_y, resize_z) < radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock GetXYInFrontOfPoint( &Float: x, &Float: y, Float: angle, Float: distance ) {
|
||||||
|
x += ( distance * floatsin( -angle, degrees ) );
|
||||||
|
y += ( distance * floatcos( -angle, degrees ) );
|
||||||
|
}
|
||||||
|
@ -620,9 +620,6 @@ thread OnHouseLoad( )
|
|||||||
SetHouseOwner( houseid, 1, "Lorenc" );
|
SetHouseOwner( houseid, 1, "Lorenc" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The server crashes when the fires aren't correctly loaded.
|
|
||||||
CreateFire( );
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ public OnMethamphetamineCooking( playerid, vehicleid, last_chemical )
|
|||||||
ShowPlayerHelpDialog( playerid, 5000, "The process is done. Bag it up and do another round if you wish." );
|
ShowPlayerHelpDialog( playerid, 5000, "The process is done. Bag it up and do another round if you wish." );
|
||||||
SendServerMessage( playerid, "Process is done. Bag it up, and do another round if you wish. Export it for money." );
|
SendServerMessage( playerid, "Process is done. Bag it up, and do another round if you wish. Export it for money." );
|
||||||
GivePlayerWantedLevel( playerid, 12 );
|
GivePlayerWantedLevel( playerid, 12 );
|
||||||
GivePlayerScore( playerid, 3, .multiplier = 0.30 );
|
GivePlayerScore( playerid, 3 );
|
||||||
ach_HandleMethYielded( playerid );
|
ach_HandleMethYielded( playerid );
|
||||||
SetGVarInt( "meth_yield", CreateDynamicObject( 1579, 2083.684082, 1233.945922, 414.875244, 0.000000, 0.000000, 90.000000, GetPlayerVirtualWorld( playerid ) ), vehicleid );
|
SetGVarInt( "meth_yield", CreateDynamicObject( 1579, 2083.684082, 1233.945922, 414.875244, 0.000000, 0.000000, 90.000000, GetPlayerVirtualWorld( playerid ) ), vehicleid );
|
||||||
PlayerPlaySound( playerid, 1057, 0.0, 0.0, 0.0 );
|
PlayerPlaySound( playerid, 1057, 0.0, 0.0, 0.0 );
|
||||||
|
@ -30,7 +30,7 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys ) {
|
|||||||
new
|
new
|
||||||
player_vehicle = GetPlayerVehicleID( playerid );
|
player_vehicle = GetPlayerVehicleID( playerid );
|
||||||
|
|
||||||
if ( PRESSED( KEY_AIM ) && player_vehicle && GetPlayerClass( playerid ) == CLASS_POLICE && p_inFBI{ playerid } )
|
if ( PRESSED( KEY_CROUCH ) && player_vehicle && GetPlayerClass( playerid ) == CLASS_POLICE && p_inFBI{ playerid } )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
vehicle_model = GetVehicleModel( player_vehicle );
|
vehicle_model = GetVehicleModel( player_vehicle );
|
||||||
@ -224,3 +224,6 @@ stock ClearPlayerSpikeStrips( playerid, bool: distance_check = true )
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stock encode_tires( tires1, tires2, tires3, tires4 )
|
||||||
|
return tires1 | (tires2 << 1) | (tires3 << 2) | (tires4 << 3);
|
||||||
|
@ -209,7 +209,6 @@ new
|
|||||||
p_TrainMissions [ MAX_PLAYERS ],
|
p_TrainMissions [ MAX_PLAYERS ],
|
||||||
p_KidnapImmunity [ MAX_PLAYERS ],
|
p_KidnapImmunity [ MAX_PLAYERS ],
|
||||||
p_GangSplitProfits [ MAX_PLAYERS ],
|
p_GangSplitProfits [ MAX_PLAYERS ],
|
||||||
Float: p_IrresistiblePoints [ MAX_PLAYERS ],
|
|
||||||
p_SafeHelperTimer [ MAX_PLAYERS ] = { -1, ... },
|
p_SafeHelperTimer [ MAX_PLAYERS ] = { -1, ... },
|
||||||
p_HouseOfferer [ MAX_PLAYERS ],
|
p_HouseOfferer [ MAX_PLAYERS ],
|
||||||
p_HouseOfferTicks [ MAX_PLAYERS ],
|
p_HouseOfferTicks [ MAX_PLAYERS ],
|
||||||
|
@ -46,9 +46,7 @@ new
|
|||||||
PlayerText: p_TruckingTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_TruckingTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
PlayerText: p_TrackPlayerTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_TrackPlayerTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
PlayerText: p_GPSInformation [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_GPSInformation [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
PlayerText: p_AchievementTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_AchievementTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }
|
||||||
PlayerText: p_FireDistance1 [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
|
||||||
PlayerText: p_FireDistance2 [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }
|
|
||||||
;
|
;
|
||||||
|
|
||||||
/* ** Hooks ** */
|
/* ** Hooks ** */
|
||||||
@ -516,22 +514,6 @@ hook OnPlayerConnect( playerid )
|
|||||||
PlayerTextDrawSetOutline(playerid, p_RobberyAmountTD[ playerid ], 1);
|
PlayerTextDrawSetOutline(playerid, p_RobberyAmountTD[ playerid ], 1);
|
||||||
PlayerTextDrawSetProportional(playerid, p_RobberyAmountTD[ playerid ], 1);
|
PlayerTextDrawSetProportional(playerid, p_RobberyAmountTD[ playerid ], 1);
|
||||||
PlayerTextDrawSetSelectable(playerid, p_RobberyAmountTD[ playerid ], 0);
|
PlayerTextDrawSetSelectable(playerid, p_RobberyAmountTD[ playerid ], 0);
|
||||||
|
|
||||||
p_FireDistance1[ playerid ] = CreatePlayerTextDraw(playerid, 26.000000, 182.000000, "_");
|
|
||||||
PlayerTextDrawBackgroundColor(playerid, p_FireDistance1[ playerid ], 255);
|
|
||||||
PlayerTextDrawFont(playerid, p_FireDistance1[ playerid ], 2);
|
|
||||||
PlayerTextDrawLetterSize(playerid, p_FireDistance1[ playerid ], 0.210000, 1.200000);
|
|
||||||
PlayerTextDrawColor(playerid, p_FireDistance1[ playerid ], -1);
|
|
||||||
PlayerTextDrawSetOutline(playerid, p_FireDistance1[ playerid ], 1);
|
|
||||||
PlayerTextDrawSetProportional(playerid, p_FireDistance1[ playerid ], 1);
|
|
||||||
|
|
||||||
p_FireDistance2[ playerid ] = CreatePlayerTextDraw(playerid, 26.000000, 236.000000, "_");
|
|
||||||
PlayerTextDrawBackgroundColor(playerid, p_FireDistance2[ playerid ], 255);
|
|
||||||
PlayerTextDrawFont(playerid, p_FireDistance2[ playerid ], 2);
|
|
||||||
PlayerTextDrawLetterSize(playerid, p_FireDistance2[ playerid ], 0.209999, 1.200000);
|
|
||||||
PlayerTextDrawColor(playerid, p_FireDistance2[ playerid ], -1);
|
|
||||||
PlayerTextDrawSetOutline(playerid, p_FireDistance2[ playerid ], 1);
|
|
||||||
PlayerTextDrawSetProportional(playerid, p_FireDistance2[ playerid ], 1);
|
|
||||||
return Y_HOOKS_CONTINUE_RETURN_1;
|
return Y_HOOKS_CONTINUE_RETURN_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,28 +342,6 @@ new
|
|||||||
;
|
;
|
||||||
|
|
||||||
/* ** Rank System ** */
|
/* ** Rank System ** */
|
||||||
enum E_RANK_DATA
|
|
||||||
{
|
|
||||||
Float: E_POINTS, E_NAME[ 32 ], E_MODEL,
|
|
||||||
E_COLOR,
|
|
||||||
};
|
|
||||||
|
|
||||||
stock const
|
|
||||||
g_aPlayerRanks[ ] [ E_RANK_DATA ] =
|
|
||||||
{
|
|
||||||
{ 11871.5, "Elite V", 19780, COLOR_GOLD },
|
|
||||||
{ 6627.13, "Elite IV", 19782, COLOR_GOLD },
|
|
||||||
{ 3699.51, "Elite III", 19781, COLOR_GOLD },
|
|
||||||
{ 2065.21, "Elite II", 19784, COLOR_GOLD },
|
|
||||||
{ 1152.88, "Elite I", 19783, COLOR_GOLD },
|
|
||||||
{ 643.581, "Silver V", 19780, COLOR_GREY },
|
|
||||||
{ 359.271, "Silver IV", 19782, COLOR_GREY },
|
|
||||||
{ 200.563, "Silver III", 19781, COLOR_GREY },
|
|
||||||
{ 111.95, "Silver II", 19784, COLOR_GREY },
|
|
||||||
{ 62.5, "Silver I", 19783, COLOR_GREY },
|
|
||||||
{ 0.0, "unranked", 19300, COLOR_GREY }
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
/* ** Race System ** */
|
/* ** Race System ** */
|
||||||
#define MAX_RACES ( 32 )
|
#define MAX_RACES ( 32 )
|
||||||
@ -1435,7 +1413,6 @@ public ZoneTimer( )
|
|||||||
g_WorldDayCount = ( g_WorldDayCount == 6 ? 0 : g_WorldDayCount + 1 );
|
g_WorldDayCount = ( g_WorldDayCount == 6 ? 0 : g_WorldDayCount + 1 );
|
||||||
TextDrawSetString( g_WorldDayTD, GetDayToString( g_WorldDayCount ) );
|
TextDrawSetString( g_WorldDayTD, GetDayToString( g_WorldDayCount ) );
|
||||||
|
|
||||||
CreateFire( );
|
|
||||||
RenewWeed( );
|
RenewWeed( );
|
||||||
PlayerPlaceRandomHits( );
|
PlayerPlaceRandomHits( );
|
||||||
|
|
||||||
@ -1572,7 +1549,7 @@ public ZoneTimer( )
|
|||||||
|
|
||||||
if ( IsPlayerSpawned( d ) && ! IsPlayerAFK( d ) && p_Class[ d ] == CLASS_CIVILIAN && p_GangID[ d ] == attacker_gang && ! IsPlayerInPaintBall( d ) ) {
|
if ( IsPlayerSpawned( d ) && ! IsPlayerAFK( d ) && p_Class[ d ] == CLASS_CIVILIAN && p_GangID[ d ] == attacker_gang && ! IsPlayerInPaintBall( d ) ) {
|
||||||
if ( in_area ) {
|
if ( in_area ) {
|
||||||
GivePlayerScore( d, 2, .multiplier = 0.5 );
|
GivePlayerScore( d, 2 );
|
||||||
GivePlayerWantedLevel( d, 6 );
|
GivePlayerWantedLevel( d, 6 );
|
||||||
}
|
}
|
||||||
PlayerPlaySound( d, 36205, 0.0, 0.0, 0.0 );
|
PlayerPlaySound( d, 36205, 0.0, 0.0, 0.0 );
|
||||||
@ -1725,8 +1702,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 );
|
||||||
PlayerTextDrawHide( playerid, p_FireDistance1[ playerid ] );
|
|
||||||
PlayerTextDrawHide( playerid, p_FireDistance2[ playerid ] );
|
|
||||||
p_MoneyBag{ playerid } = false;
|
p_MoneyBag{ playerid } = false;
|
||||||
RemovePlayerAttachedObject( playerid, 1 );
|
RemovePlayerAttachedObject( playerid, 1 );
|
||||||
|
|
||||||
@ -2250,7 +2225,6 @@ public OnPlayerDisconnect( playerid, reason )
|
|||||||
p_GangSplitProfits[ playerid ] = 0;
|
p_GangSplitProfits[ playerid ] = 0;
|
||||||
p_IrresistibleCoins[ playerid ] = 0.0;
|
p_IrresistibleCoins[ playerid ] = 0.0;
|
||||||
p_QuitToAvoidTimestamp[ playerid ] = 0;
|
p_QuitToAvoidTimestamp[ playerid ] = 0;
|
||||||
p_IrresistiblePoints[ playerid ] = 0.0;
|
|
||||||
p_AntiExportCarSpam[ playerid ] = 0;
|
p_AntiExportCarSpam[ playerid ] = 0;
|
||||||
p_TruckedCargo[ playerid ] = 0;
|
p_TruckedCargo[ playerid ] = 0;
|
||||||
p_PilotMissions[ playerid ] = 0;
|
p_PilotMissions[ playerid ] = 0;
|
||||||
@ -2691,12 +2665,12 @@ public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float:
|
|||||||
|
|
||||||
// Explosive Bullets
|
// Explosive Bullets
|
||||||
if ( hittype != BULLET_HIT_TYPE_OBJECT ) {
|
if ( hittype != BULLET_HIT_TYPE_OBJECT ) {
|
||||||
CreateExplosiveBullet( playerid );
|
CreateExplosiveBullet( playerid, hittype, hitid );
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock CreateExplosiveBullet( playerid ) {
|
stock CreateExplosiveBullet( playerid, hittype = BULLET_HIT_TYPE_OBJECT, hitid = INVALID_OBJECT_ID ) {
|
||||||
|
|
||||||
if ( IsPlayerInCasino( playerid ) || IsPlayerInPaintBall( playerid ) || IsPlayerInEvent( playerid ) || IsPlayerInMinigame( playerid ) )
|
if ( IsPlayerInCasino( playerid ) || IsPlayerInPaintBall( playerid ) || IsPlayerInEvent( playerid ) || IsPlayerInMinigame( playerid ) )
|
||||||
return;
|
return;
|
||||||
@ -2706,8 +2680,14 @@ stock CreateExplosiveBullet( playerid ) {
|
|||||||
static Float: fromX, Float: fromY, Float: fromZ;
|
static Float: fromX, Float: fromY, Float: fromZ;
|
||||||
static Float: toX, Float: toY, Float: toZ;
|
static Float: toX, Float: toY, Float: toZ;
|
||||||
|
|
||||||
// Cool effect
|
if ( GetPlayerLastShotVectors( playerid, fromX, fromY, fromZ, toX, toY, toZ ) )
|
||||||
if ( GetPlayerLastShotVectors( playerid, fromX, fromY, fromZ, toX, toY, toZ ) ) {
|
{
|
||||||
|
// create explosion at the core of the vehicle
|
||||||
|
if ( hittype == BULLET_HIT_TYPE_VEHICLE ) {
|
||||||
|
GetVehiclePos( hitid, toX, toY, toZ );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cool effect
|
||||||
new objectid = CreateDynamicObject( 19296, fromX, fromY, fromZ, 0.0, 0.0, 0.0 );
|
new objectid = CreateDynamicObject( 19296, fromX, fromY, fromZ, 0.0, 0.0, 0.0 );
|
||||||
new milliseconds = MoveDynamicObject( objectid, toX, toY, toZ, 500.0 );
|
new milliseconds = MoveDynamicObject( objectid, toX, toY, toZ, 500.0 );
|
||||||
SetTimerEx( "Timer_DestroyObject", milliseconds + 200, false, "d", objectid );
|
SetTimerEx( "Timer_DestroyObject", milliseconds + 200, false, "d", objectid );
|
||||||
@ -3243,7 +3223,7 @@ public OnPlayerDeath( playerid, killerid, reason )
|
|||||||
if ( p_Class[ killerid ] != CLASS_POLICE )
|
if ( p_Class[ killerid ] != CLASS_POLICE )
|
||||||
{
|
{
|
||||||
GivePlayerWantedLevel( killerid, 12 );
|
GivePlayerWantedLevel( killerid, 12 );
|
||||||
GivePlayerScore( killerid, 1, .multiplier = 0.2 );
|
GivePlayerScore( killerid, 1 );
|
||||||
|
|
||||||
new
|
new
|
||||||
Float: default_experience = 1.0;
|
Float: default_experience = 1.0;
|
||||||
@ -3271,7 +3251,7 @@ public OnPlayerDeath( playerid, killerid, reason )
|
|||||||
SaveGangData( playerGangId ), g_gangData[ playerGangId ] [ E_DEATHS ]++;
|
SaveGangData( playerGangId ), g_gangData[ playerGangId ] [ E_DEATHS ]++;
|
||||||
|
|
||||||
p_Deaths[ playerid ] ++; // Usually other events do nothing
|
p_Deaths[ playerid ] ++; // Usually other events do nothing
|
||||||
GivePlayerIrresistiblePoints( playerid, -1 ); // Deduct points, it's meant to be hard!!!
|
GivePlayerSeasonalXP( playerid, -10.0 ); // Deduct points, it's meant to be hard!!!
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearPlayerWantedLevel( playerid );
|
ClearPlayerWantedLevel( playerid );
|
||||||
@ -4490,41 +4470,6 @@ CMD:highscores( playerid, params[ ] )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMD:rank( playerid, params[ ] )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
watchingid;
|
|
||||||
|
|
||||||
if ( sscanf( params, "u", watchingid ) )
|
|
||||||
watchingid = playerid;
|
|
||||||
|
|
||||||
if ( !IsPlayerConnected( watchingid ) )
|
|
||||||
watchingid = playerid;
|
|
||||||
|
|
||||||
format( szBigString, 196, "SELECT uo.NAME, (SELECT COUNT(DISTINCT ui.`SCORE`) FROM `USERS` ui WHERE ui.`SCORE` >= uo.`SCORE`) AS `GLOBAL_RANK` FROM `USERS` uo WHERE `ID`=%d", p_AccountID[ watchingid ] );
|
|
||||||
mysql_function_query( dbHandle, szBigString, true, "currentUserRank", "ii", playerid, watchingid );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
thread currentUserRank( playerid, watchingid )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
rows;
|
|
||||||
|
|
||||||
cache_get_data( rows, tmpVariable );
|
|
||||||
|
|
||||||
if ( rows )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
iGroupedRank = GetPlayerRank( watchingid ),
|
|
||||||
iGlobalRank = cache_get_field_content_int( 0, "GLOBAL_RANK", dbHandle )
|
|
||||||
;
|
|
||||||
SendServerMessage( playerid, "%s(%d) is grouped in {%06x}%s"COL_WHITE" and is globally "COL_GREY"#%d"COL_WHITE".", ReturnPlayerName( watchingid ), watchingid, g_aPlayerRanks[ iGroupedRank ] [ E_COLOR ] >>> 8, g_aPlayerRanks[ iGroupedRank ] [ E_NAME ], iGlobalRank );
|
|
||||||
}
|
|
||||||
else SendError( playerid, "Couldn't find a rank for this user, try again later." );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
CMD:request( playerid, params[ ] )
|
CMD:request( playerid, params[ ] )
|
||||||
{
|
{
|
||||||
/* ** Anti Spammy Commands ** */
|
/* ** Anti Spammy Commands ** */
|
||||||
@ -6141,10 +6086,7 @@ CMD:moviemode( playerid, params[ ] )
|
|||||||
case true:
|
case true:
|
||||||
{
|
{
|
||||||
ShowPlayerTogglableTextdraws( playerid );
|
ShowPlayerTogglableTextdraws( playerid );
|
||||||
TextDrawShowForPlayer( playerid, g_CurrentRankTD );
|
|
||||||
TextDrawShowForPlayer( playerid, g_currentXPTD );
|
|
||||||
PlayerTextDrawShow( playerid, p_LocationTD[ playerid ] );
|
PlayerTextDrawShow( playerid, p_LocationTD[ playerid ] );
|
||||||
PlayerTextDrawShow( playerid, p_ExperienceTD[ playerid ] );
|
|
||||||
if ( IsDoubleXP( ) ) TextDrawShowForPlayer( playerid, g_DoubleXPTD );
|
if ( IsDoubleXP( ) ) TextDrawShowForPlayer( playerid, g_DoubleXPTD );
|
||||||
TextDrawShowForPlayer( playerid, g_WebsiteTD );
|
TextDrawShowForPlayer( playerid, g_WebsiteTD );
|
||||||
if ( p_WantedLevel[ playerid ] ) PlayerTextDrawShow( playerid, p_WantedLevelTD[ playerid ] );
|
if ( p_WantedLevel[ playerid ] ) PlayerTextDrawShow( playerid, p_WantedLevelTD[ playerid ] );
|
||||||
@ -6153,7 +6095,6 @@ CMD:moviemode( playerid, params[ ] )
|
|||||||
if ( p_FPSCounter{ playerid } ) TextDrawShowForPlayer( playerid, p_FPSCounterTD[ playerid ] );
|
if ( p_FPSCounter{ playerid } ) TextDrawShowForPlayer( playerid, p_FPSCounterTD[ playerid ] );
|
||||||
if ( p_AdminOnDuty{ playerid } ) TextDrawShowForPlayer( playerid, g_AdminOnDutyTD );
|
if ( p_AdminOnDuty{ playerid } ) TextDrawShowForPlayer( playerid, g_AdminOnDutyTD );
|
||||||
TextDrawShowForPlayer( playerid, g_WorldDayTD );
|
TextDrawShowForPlayer( playerid, g_WorldDayTD );
|
||||||
ShowPlayerIrresistibleRank( playerid );
|
|
||||||
PlayerTextDrawShow( playerid, g_ZoneOwnerTD[ playerid ] );
|
PlayerTextDrawShow( playerid, g_ZoneOwnerTD[ playerid ] );
|
||||||
for( new i; i < sizeof( g_MovieModeTD ); i ++ ) TextDrawHideForPlayer( playerid, g_MovieModeTD[ i ] );
|
for( new i; i < sizeof( g_MovieModeTD ); i ++ ) TextDrawHideForPlayer( playerid, g_MovieModeTD[ i ] );
|
||||||
p_inMovieMode{ playerid } = false;
|
p_inMovieMode{ playerid } = false;
|
||||||
@ -6163,16 +6104,11 @@ CMD:moviemode( playerid, params[ ] )
|
|||||||
{
|
{
|
||||||
PlayerTextDrawHide( playerid, g_ZoneOwnerTD[ playerid ] );
|
PlayerTextDrawHide( playerid, g_ZoneOwnerTD[ playerid ] );
|
||||||
HidePlayerTogglableTextdraws( playerid );
|
HidePlayerTogglableTextdraws( playerid );
|
||||||
TextDrawHideForPlayer( playerid, g_CurrentRankTD );
|
|
||||||
TextDrawHideForPlayer( playerid, g_currentXPTD );
|
|
||||||
PlayerTextDrawHide( playerid, p_LocationTD[ playerid ] );
|
PlayerTextDrawHide( playerid, p_LocationTD[ playerid ] );
|
||||||
PlayerTextDrawHide( playerid, p_ExperienceTD[ playerid ] );
|
|
||||||
PlayerTextDrawHide( playerid, p_WantedLevelTD[ playerid ] );
|
PlayerTextDrawHide( playerid, p_WantedLevelTD[ playerid ] );
|
||||||
TextDrawHideForPlayer( playerid, g_WebsiteTD );
|
TextDrawHideForPlayer( playerid, g_WebsiteTD );
|
||||||
TextDrawHideForPlayer( playerid, g_AdminOnDutyTD );
|
TextDrawHideForPlayer( playerid, g_AdminOnDutyTD );
|
||||||
TextDrawHideForPlayer( playerid, g_DoubleXPTD );
|
TextDrawHideForPlayer( playerid, g_DoubleXPTD );
|
||||||
PlayerTextDrawHide( playerid, p_PlayerRankTD[ playerid ] );
|
|
||||||
PlayerTextDrawHide( playerid, p_PlayerRankTextTD[ playerid ] );
|
|
||||||
TextDrawHideForPlayer( playerid, g_MotdTD );
|
TextDrawHideForPlayer( playerid, g_MotdTD );
|
||||||
TextDrawHideForPlayer( playerid, g_NotManyPlayersTD );
|
TextDrawHideForPlayer( playerid, g_NotManyPlayersTD );
|
||||||
TextDrawHideForPlayer( playerid, g_WorldDayTD );
|
TextDrawHideForPlayer( playerid, g_WorldDayTD );
|
||||||
@ -9150,7 +9086,7 @@ public OnPlayerEnterDynamicCP( playerid, checkpointid )
|
|||||||
GameTextForPlayer( victimid, "~r~Busted!", 4000, 0 );
|
GameTextForPlayer( victimid, "~r~Busted!", 4000, 0 );
|
||||||
ClearAnimations( victimid );
|
ClearAnimations( victimid );
|
||||||
JailPlayer( victimid, totalSeconds );
|
JailPlayer( victimid, totalSeconds );
|
||||||
GivePlayerIrresistiblePoints( victimid, -2 );
|
GivePlayerSeasonalXP( victimid, -2 );
|
||||||
SendGlobalMessage( -1, ""COL_GOLD"[JAIL]{FFFFFF} %s(%d) has sent %s(%d) to jail for %d seconds!", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( victimid ), victimid, totalSeconds );
|
SendGlobalMessage( -1, ""COL_GOLD"[JAIL]{FFFFFF} %s(%d) has sent %s(%d) to jail for %d seconds!", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( victimid ), victimid, totalSeconds );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9383,7 +9319,7 @@ public OnPlayerEnterDynamicRaceCP( playerid, checkpointid )
|
|||||||
}
|
}
|
||||||
items = GetGVarInt( szItems );
|
items = GetGVarInt( szItems );
|
||||||
score = floatround( items / 2 );
|
score = floatround( items / 2 );
|
||||||
GivePlayerScore( playerid, score == 0 ? 1 : score, .multiplier = 0.4 );
|
GivePlayerScore( playerid, score == 0 ? 1 : score );
|
||||||
//GivePlayerExperience( playerid, E_BURGLAR, float( items ) * 0.2 );
|
//GivePlayerExperience( playerid, E_BURGLAR, float( items ) * 0.2 );
|
||||||
DestroyDynamicMapIcon( p_PawnStoreMapIcon[ playerid ] );
|
DestroyDynamicMapIcon( p_PawnStoreMapIcon[ playerid ] );
|
||||||
p_PawnStoreMapIcon[ playerid ] = 0xFFFF;
|
p_PawnStoreMapIcon[ playerid ] = 0xFFFF;
|
||||||
@ -9743,7 +9679,7 @@ public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Explosive Bullets
|
// Explosive Bullets
|
||||||
if ( p_ExplosiveBullets[ playerid ] > 0 && PRESSED( KEY_YES ) ) {
|
if ( p_ExplosiveBullets[ playerid ] > 0 && PRESSED( KEY_NO ) ) {
|
||||||
if ( GetPVarInt( playerid, "explosive_rounds" ) == 1 ) {
|
if ( GetPVarInt( playerid, "explosive_rounds" ) == 1 ) {
|
||||||
DeletePVar( playerid, "explosive_rounds" );
|
DeletePVar( playerid, "explosive_rounds" );
|
||||||
ShowPlayerHelpDialog( playerid, 2000, "Explosive rounds ~r~disabled." );
|
ShowPlayerHelpDialog( playerid, 2000, "Explosive rounds ~r~disabled." );
|
||||||
@ -10272,7 +10208,6 @@ thread OnAttemptPlayerLogin( playerid, password[ ] )
|
|||||||
p_MethYielded[ playerid ] = cache_get_field_content_int( 0, "METH_YIELDED", dbHandle );
|
p_MethYielded[ playerid ] = cache_get_field_content_int( 0, "METH_YIELDED", dbHandle );
|
||||||
p_drillStrength[ playerid ] = cache_get_field_content_int( 0, "DRILL", dbHandle );
|
p_drillStrength[ playerid ] = cache_get_field_content_int( 0, "DRILL", dbHandle );
|
||||||
p_IrresistibleCoins[ playerid ] = cache_get_field_content_float( 0, "COINS", dbHandle );
|
p_IrresistibleCoins[ playerid ] = cache_get_field_content_float( 0, "COINS", dbHandle );
|
||||||
p_IrresistiblePoints[ playerid ]= cache_get_field_content_float( 0, "RANK", dbHandle );
|
|
||||||
p_ExtraAssetSlots{ playerid } = cache_get_field_content_int( 0, "EXTRA_SLOTS", dbHandle );
|
p_ExtraAssetSlots{ playerid } = cache_get_field_content_int( 0, "EXTRA_SLOTS", dbHandle );
|
||||||
p_forcedAnticheat[ playerid ] = cache_get_field_content_int( 0, "FORCE_AC", dbHandle );
|
p_forcedAnticheat[ playerid ] = cache_get_field_content_int( 0, "FORCE_AC", dbHandle );
|
||||||
|
|
||||||
@ -10283,6 +10218,9 @@ thread OnAttemptPlayerLogin( playerid, password[ ] )
|
|||||||
p_AddedEmail{ playerid } = !!cache_get_field_content_int( 0, "USED_EMAIL", dbHandle );
|
p_AddedEmail{ playerid } = !!cache_get_field_content_int( 0, "USED_EMAIL", dbHandle );
|
||||||
// p_TaxTime[ playerid ] = cache_get_field_content_int( 0, "TAX_TIME", dbHandle );
|
// p_TaxTime[ playerid ] = cache_get_field_content_int( 0, "TAX_TIME", dbHandle );
|
||||||
|
|
||||||
|
// seasonal xp
|
||||||
|
SetPlayerSeasonalXP( playerid, cache_get_field_content_float( 0, "RANK", dbHandle ) );
|
||||||
|
|
||||||
// spawn location
|
// spawn location
|
||||||
new
|
new
|
||||||
spawn_location[ 10 ];
|
spawn_location[ 10 ];
|
||||||
@ -11594,7 +11532,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
|||||||
""COL_GREY"Admin Level:{FFFFFF} %d\n"\
|
""COL_GREY"Admin Level:{FFFFFF} %d\n"\
|
||||||
""COL_GREY"Time Online:{FFFFFF} %s\n"\
|
""COL_GREY"Time Online:{FFFFFF} %s\n"\
|
||||||
""COL_GREY"Irresistible Rank:{FFFFFF} %s\n"\
|
""COL_GREY"Irresistible Rank:{FFFFFF} %s\n"\
|
||||||
""COL_GREY"Irresistible Coins:{FFFFFF} %f\n", ReturnPlayerName( pID ), pID, p_AccountID[ pID ], p_AdminLevel[ pID ], secondstotime( p_Uptime[ pID ] ), g_aPlayerRanks[ GetPlayerRank( pID ) ] [ E_NAME ], p_IrresistibleCoins[ pID ] );
|
""COL_GREY"Irresistible Coins:{FFFFFF} %f\n", ReturnPlayerName( pID ), pID, p_AccountID[ pID ], p_AdminLevel[ pID ], secondstotime( p_Uptime[ pID ] ), GetSeasonalRankName( GetPlayerRank( pID ) ), p_IrresistibleCoins[ pID ] );
|
||||||
|
|
||||||
format( szLargeString, 750, "%s"COL_GREY"V.I.P Level:{FFFFFF} %s\n"\
|
format( szLargeString, 750, "%s"COL_GREY"V.I.P Level:{FFFFFF} %s\n"\
|
||||||
""COL_GREY"V.I.P Expiry:{FFFFFF} %s\n"\
|
""COL_GREY"V.I.P Expiry:{FFFFFF} %s\n"\
|
||||||
@ -12917,16 +12855,10 @@ thread OnHighScoreCheck( playerid, highscore_item )
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
new
|
new Float: score_value = cache_get_field_content_float( row, "SCORE_VAL", dbHandle );
|
||||||
Float: score_value = cache_get_field_content_float( row, "SCORE_VAL", dbHandle ), rank;
|
new rank = GetRankFromXP( score_value );
|
||||||
|
|
||||||
for( rank = 0; rank < sizeof( g_aPlayerRanks ); rank++ ) {
|
format( szLargeString, sizeof( szLargeString ), "%s%s%s\t{%06x}%s\n", szLargeString, strmatch( name, ReturnPlayerName( playerid ) ) ? COL_GREEN : COL_WHITE, name, GetSeasonalRankColour( rank ) >>> 8, GetSeasonalRankName( rank ) );
|
||||||
if ( score_value >= g_aPlayerRanks[ rank ] [ E_POINTS ] ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
format( szLargeString, sizeof( szLargeString ), "%s%s%s\t{%06x}%s\n", szLargeString, strmatch( name, ReturnPlayerName( playerid ) ) ? COL_GREEN : COL_WHITE, name, g_aPlayerRanks[ rank ] [ E_COLOR ] >>> 8, g_aPlayerRanks[ rank ] [ E_NAME ] );
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@ -13284,12 +13216,12 @@ stock SavePlayerData( playerid, bool: logout = false )
|
|||||||
p_ContractedAmount[ playerid ], p_WeedGrams[ playerid ], logout ? ( bQuitToAvoid ? 1 : 0 ) : 0,
|
p_ContractedAmount[ playerid ], p_WeedGrams[ playerid ], logout ? ( bQuitToAvoid ? 1 : 0 ) : 0,
|
||||||
p_drillStrength[ playerid ] );
|
p_drillStrength[ playerid ] );
|
||||||
|
|
||||||
format( Query, sizeof( Query ), "%s`BLEW_JAILS`=%d,`BLEW_VAULT`=%d,`VEHICLES_JACKED`=%d,`METH_YIELDED`=%d,`LAST_IP`='%s',`VIP_JOB`=%d,`TRUCKED`=%d,`COINS`=%f,`EXPLOSIVE_BULLETS`=%d,`RANK`=%f,`ONLINE`=%d,`HIT_SOUND`=%d,`EXTRA_SLOTS`=%d,`PILOT`=%d,`TRAIN`=%d WHERE `ID`=%d",
|
format( Query, sizeof( Query ), "%s`BLEW_JAILS`=%d,`BLEW_VAULT`=%d,`VEHICLES_JACKED`=%d,`METH_YIELDED`=%d,`LAST_IP`='%s',`VIP_JOB`=%d,`TRUCKED`=%d,`COINS`=%f,`EXPLOSIVE_BULLETS`=%d,`ONLINE`=%d,`HIT_SOUND`=%d,`EXTRA_SLOTS`=%d,`PILOT`=%d,`TRAIN`=%d WHERE `ID`=%d",
|
||||||
Query,
|
Query,
|
||||||
p_JailsBlown[ playerid ], p_BankBlown[ playerid ], p_CarsJacked[ playerid ],
|
p_JailsBlown[ playerid ], p_BankBlown[ playerid ], p_CarsJacked[ playerid ],
|
||||||
p_MethYielded[ playerid ], mysql_escape( ReturnPlayerIP( playerid ) ),
|
p_MethYielded[ playerid ], mysql_escape( ReturnPlayerIP( playerid ) ),
|
||||||
p_VIPJob{ playerid }, p_TruckedCargo[ playerid ], p_IrresistibleCoins[ playerid ],
|
p_VIPJob{ playerid }, p_TruckedCargo[ playerid ], p_IrresistibleCoins[ playerid ],
|
||||||
p_ExplosiveBullets[ playerid ], p_IrresistiblePoints[ playerid ],
|
p_ExplosiveBullets[ playerid ],
|
||||||
!logout, p_HitmarkerSound{ playerid }, p_ExtraAssetSlots{ playerid },
|
!logout, p_HitmarkerSound{ playerid }, p_ExtraAssetSlots{ playerid },
|
||||||
p_PilotMissions[ playerid ], p_TrainMissions[ playerid ],
|
p_PilotMissions[ playerid ], p_TrainMissions[ playerid ],
|
||||||
p_AccountID[ playerid ] );
|
p_AccountID[ playerid ] );
|
||||||
@ -13697,7 +13629,7 @@ stock IsWeaponBanned( weaponid ) {
|
|||||||
return 0 <= weaponid < MAX_WEAPONS && ( weaponid == 36 || weaponid == 37 || weaponid == 38 || weaponid == 39 || weaponid == 44 || weaponid == 45 );
|
return 0 <= weaponid < MAX_WEAPONS && ( weaponid == 36 || weaponid == 37 || weaponid == 38 || weaponid == 39 || weaponid == 44 || weaponid == 45 );
|
||||||
}
|
}
|
||||||
|
|
||||||
stock GivePlayerScore( playerid, score, Float: multiplier = 0.75 )
|
stock GivePlayerScore( playerid, score )
|
||||||
{
|
{
|
||||||
if ( IsPlayerAdminOnDuty( playerid ) )
|
if ( IsPlayerAdminOnDuty( playerid ) )
|
||||||
return 0;
|
return 0;
|
||||||
@ -13705,11 +13637,9 @@ stock GivePlayerScore( playerid, score, Float: multiplier = 0.75 )
|
|||||||
new
|
new
|
||||||
gangid = p_GangID[ playerid ];
|
gangid = p_GangID[ playerid ];
|
||||||
|
|
||||||
if ( gangid != INVALID_GANG_ID )
|
if ( gangid != INVALID_GANG_ID ) {
|
||||||
SaveGangData( gangid ), g_gangData[ gangid ] [ E_SCORE ] += score;
|
SaveGangData( gangid ), g_gangData[ gangid ] [ E_SCORE ] += score;
|
||||||
|
}
|
||||||
//GivePlayerXP_Legacy( playerid, score * 10 );
|
|
||||||
GivePlayerIrresistiblePoints( playerid, score < 0 ? ( score * 1.0 ) : ( score * multiplier ) );
|
|
||||||
return SetPlayerScore( playerid, GetPlayerScore( playerid ) + score );
|
return SetPlayerScore( playerid, GetPlayerScore( playerid ) + score );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14114,9 +14044,6 @@ stock SetObjectFacePoint(iObjectID, Float: fX, Float: fY, Float: fOffset, bool:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stock encode_tires( tires1, tires2, tires3, tires4 )
|
|
||||||
return tires1 | (tires2 << 1) | (tires3 << 2) | (tires4 << 3);
|
|
||||||
|
|
||||||
stock TimeConvert( seconds )
|
stock TimeConvert( seconds )
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
@ -14126,44 +14053,6 @@ stock TimeConvert( seconds )
|
|||||||
return szTime;
|
return szTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock GetRandomCreatedHouse( )
|
|
||||||
{
|
|
||||||
if ( ! Iter_Count( houses ) ) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static szCity[ MAX_ZONE_NAME ];
|
|
||||||
new ignoredHomes[ MAX_HOUSES ] = { -1, ... };
|
|
||||||
|
|
||||||
// first find homes to ignore
|
|
||||||
for ( new i = 0; i < MAX_HOUSES; i ++ )
|
|
||||||
{
|
|
||||||
// Avoid Hills / Avoid V.I.P or Clan Homes
|
|
||||||
if ( ! Iter_Contains( houses, i ) || g_houseData[ i ] [ E_EZ ] > 300.0 || g_houseData[ i ] [ E_COST ] < 500000 ) {
|
|
||||||
ignoredHomes[ i ] = i;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for house fire
|
|
||||||
if ( IsHouseOnFire( i ) ) {
|
|
||||||
ignoredHomes[ i ] = i;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// San Fierro only
|
|
||||||
Get2DCity( szCity, g_houseData[ i ] [ E_EX ], g_houseData[ i ] [ E_EY ], g_houseData[ i ] [ E_EZ ] );
|
|
||||||
if ( ! strmatch( szCity, "San Fierro" ) ) {
|
|
||||||
ignoredHomes[ i ] = i;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
new
|
|
||||||
random_home = randomExcept( ignoredHomes, sizeof( ignoredHomes ) );
|
|
||||||
|
|
||||||
return random_home;
|
|
||||||
}
|
|
||||||
|
|
||||||
stock SetPlayerFacePoint(playerid, Float: fX, Float: fY, Float: offset = 0.0)
|
stock SetPlayerFacePoint(playerid, Float: fX, Float: fY, Float: offset = 0.0)
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
@ -14939,84 +14828,6 @@ stock GetDayToString( day )
|
|||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ, Float:ObjX, Float:ObjY, Float:ObjZ, Float:FrX, Float:FrY, Float:FrZ) {
|
|
||||||
|
|
||||||
new Float:TGTDistance;
|
|
||||||
|
|
||||||
TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));
|
|
||||||
|
|
||||||
new Float:tmpX, Float:tmpY, Float:tmpZ;
|
|
||||||
|
|
||||||
tmpX = FrX * TGTDistance + CamX;
|
|
||||||
tmpY = FrY * TGTDistance + CamY;
|
|
||||||
tmpZ = FrZ * TGTDistance + CamZ;
|
|
||||||
|
|
||||||
return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
|
|
||||||
}
|
|
||||||
|
|
||||||
stock Float:GetPointAngleToPoint(Float:x2, Float:y2, Float:X, Float:Y) {
|
|
||||||
|
|
||||||
new Float:DX, Float:DY;
|
|
||||||
new Float:angle;
|
|
||||||
|
|
||||||
DX = floatabs(floatsub(x2,X));
|
|
||||||
DY = floatabs(floatsub(y2,Y));
|
|
||||||
|
|
||||||
if (DY == 0.0 || DX == 0.0) {
|
|
||||||
if (DY == 0 && DX > 0) angle = 0.0;
|
|
||||||
else if (DY == 0 && DX < 0) angle = 180.0;
|
|
||||||
else if (DY > 0 && DX == 0) angle = 90.0;
|
|
||||||
else if (DY < 0 && DX == 0) angle = 270.0;
|
|
||||||
else if (DY == 0 && DX == 0) angle = 0.0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
angle = atan(DX/DY);
|
|
||||||
|
|
||||||
if (X > x2 && Y <= y2) angle += 90.0;
|
|
||||||
else if (X <= x2 && Y < y2) angle = floatsub(90.0, angle);
|
|
||||||
else if (X < x2 && Y >= y2) angle -= 90.0;
|
|
||||||
else if (X >= x2 && Y > y2) angle = floatsub(270.0, angle);
|
|
||||||
}
|
|
||||||
|
|
||||||
return floatadd(angle, 90.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
stock GetXYInFrontOfPoint(&Float:x, &Float:y, Float:angle, Float:distance) {
|
|
||||||
x += (distance * floatsin(-angle, degrees));
|
|
||||||
y += (distance * floatcos(-angle, degrees));
|
|
||||||
}
|
|
||||||
|
|
||||||
stock IsPlayerAimingAt(playerid, Float:x, Float:y, Float:z, Float:radius)
|
|
||||||
{
|
|
||||||
new Float:camera_x;
|
|
||||||
new Float:camera_y;
|
|
||||||
new Float:camera_z;
|
|
||||||
new Float:vector_x;
|
|
||||||
new Float:vector_y;
|
|
||||||
new Float:vector_z;
|
|
||||||
|
|
||||||
GetPlayerCameraPos(playerid, camera_x, camera_y, camera_z);
|
|
||||||
GetPlayerCameraFrontVector(playerid, vector_x, vector_y, vector_z);
|
|
||||||
|
|
||||||
new Float:vertical, Float:horizontal;
|
|
||||||
|
|
||||||
switch (GetPlayerWeapon( playerid )) {
|
|
||||||
case 34,35,36:
|
|
||||||
{
|
|
||||||
if (DistanceCameraTargetToLocation(camera_x, camera_y, camera_z, x, y, z, vector_x, vector_y, vector_z) < radius) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
case 30,31: {vertical = 4.0; horizontal = -1.6;}
|
|
||||||
case 33: {vertical = 2.7; horizontal = -1.0;}
|
|
||||||
default: {vertical = 6.0; horizontal = -2.2;}
|
|
||||||
}
|
|
||||||
new Float:angle = GetPointAngleToPoint(0, 0, floatsqroot(vector_x*vector_x+vector_y*vector_y), vector_z) - 270.0;
|
|
||||||
new Float:resize_x, Float:resize_y, Float:resize_z = floatsin(angle+vertical, degrees);
|
|
||||||
GetXYInFrontOfPoint(resize_x, resize_y, GetPointAngleToPoint(0, 0, vector_x, vector_y)+horizontal, floatcos(angle+vertical, degrees));
|
|
||||||
|
|
||||||
if (DistanceCameraTargetToLocation(camera_x, camera_y, camera_z, x, y, z, resize_x, resize_y, resize_z) < radius) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ShowAchievement( playerid, achievement[ ], score = -1 )
|
stock ShowAchievement( playerid, achievement[ ], score = -1 )
|
||||||
{
|
{
|
||||||
@ -16632,88 +16443,6 @@ stock SplitPlayerCashForGang( playerid, Float: cashRobbed )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock GetPlayerRank( playerid )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
iRank;
|
|
||||||
|
|
||||||
for( iRank = 0; iRank < sizeof( g_aPlayerRanks ); iRank++ )
|
|
||||||
if ( p_IrresistiblePoints[ playerid ] >= g_aPlayerRanks[ iRank ] [ E_POINTS ] )
|
|
||||||
break;
|
|
||||||
|
|
||||||
return iRank;
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ShowPlayerIrresistibleRank( playerid )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
iRank = GetPlayerRank( playerid );
|
|
||||||
|
|
||||||
PlayerTextDrawColor( playerid, p_PlayerRankTextTD[ playerid ], g_aPlayerRanks[ iRank ] [ E_COLOR ] );
|
|
||||||
PlayerTextDrawSetString( playerid, p_PlayerRankTextTD[ playerid ], g_aPlayerRanks[ iRank ] [ E_NAME ] );
|
|
||||||
|
|
||||||
PlayerTextDrawColor( playerid, p_PlayerRankTD[ playerid ], g_aPlayerRanks[ iRank ] [ E_COLOR ] );
|
|
||||||
PlayerTextDrawSetPreviewModel( playerid, p_PlayerRankTD[ playerid ], g_aPlayerRanks[ iRank ] [ E_MODEL ] );
|
|
||||||
|
|
||||||
PlayerTextDrawShow( playerid, p_PlayerRankTD[ playerid ] );
|
|
||||||
PlayerTextDrawShow( playerid, p_PlayerRankTextTD[ playerid ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
stock GivePlayerIrresistiblePoints( playerid, Float: points )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
Float: fPreviousPoints = p_IrresistiblePoints[ playerid ],
|
|
||||||
Float: fCurrentPoints = fPreviousPoints + points
|
|
||||||
;
|
|
||||||
|
|
||||||
if ( fCurrentPoints < 0.0 )
|
|
||||||
fCurrentPoints = 0.0;
|
|
||||||
|
|
||||||
new Float: upper_limit = g_aPlayerRanks[ 0 ] [ E_POINTS ] + 500.0;
|
|
||||||
|
|
||||||
if ( fCurrentPoints > upper_limit )
|
|
||||||
fCurrentPoints = upper_limit;
|
|
||||||
|
|
||||||
for( new iRank = 0; iRank < sizeof( g_aPlayerRanks ); iRank++ )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
bGained = ( fPreviousPoints < g_aPlayerRanks[ iRank ] [ E_POINTS ] <= fCurrentPoints ),
|
|
||||||
bLost = ( fCurrentPoints < g_aPlayerRanks[ iRank ] [ E_POINTS ] <= fPreviousPoints )
|
|
||||||
;
|
|
||||||
|
|
||||||
if ( bGained || bLost )
|
|
||||||
{
|
|
||||||
if ( bGained )
|
|
||||||
{
|
|
||||||
SendServerMessage( playerid, "Congratulations, your grouped ranking has been increased to {%06x}%s"COL_WHITE"!", g_aPlayerRanks[ iRank ] [ E_COLOR ] >>> 8, g_aPlayerRanks[ iRank ] [ E_NAME ] );
|
|
||||||
|
|
||||||
PlayerTextDrawColor( playerid, p_PlayerRankTextTD[ playerid ], g_aPlayerRanks[ iRank ] [ E_COLOR ] );
|
|
||||||
PlayerTextDrawSetString( playerid, p_PlayerRankTextTD[ playerid ], g_aPlayerRanks[ iRank ] [ E_NAME ] );
|
|
||||||
|
|
||||||
PlayerTextDrawColor( playerid, p_PlayerRankTD[ playerid ], g_aPlayerRanks[ iRank ] [ E_COLOR ] );
|
|
||||||
PlayerTextDrawSetPreviewModel( playerid, p_PlayerRankTD[ playerid ], g_aPlayerRanks[ iRank ] [ E_MODEL ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( bLost )
|
|
||||||
{
|
|
||||||
SendServerMessage( playerid, "Sorry, your grouped ranking has decreased to {%06x}%s"COL_WHITE"!", g_aPlayerRanks[ iRank + 1 ] [ E_COLOR ] >>> 8, g_aPlayerRanks[ iRank + 1 ] [ E_NAME ] );
|
|
||||||
|
|
||||||
PlayerTextDrawColor( playerid, p_PlayerRankTextTD[ playerid ], g_aPlayerRanks[ iRank + 1 ] [ E_COLOR ] );
|
|
||||||
PlayerTextDrawSetString( playerid, p_PlayerRankTextTD[ playerid ], g_aPlayerRanks[ iRank + 1 ] [ E_NAME ] );
|
|
||||||
|
|
||||||
PlayerTextDrawColor( playerid, p_PlayerRankTD[ playerid ], g_aPlayerRanks[ iRank + 1 ] [ E_COLOR ] );
|
|
||||||
PlayerTextDrawSetPreviewModel( playerid, p_PlayerRankTD[ playerid ], g_aPlayerRanks[ iRank + 1 ] [ E_MODEL ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerTextDrawShow( playerid, p_PlayerRankTD[ playerid ] );
|
|
||||||
PlayerTextDrawShow( playerid, p_PlayerRankTextTD[ playerid ] );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//printf( "%s: %f points", ReturnPlayerName( playerid ), fCurrentPoints );
|
|
||||||
p_IrresistiblePoints[ playerid ] = fCurrentPoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ShowPlayerTogglableTextdraws( playerid, bool: force = false )
|
stock ShowPlayerTogglableTextdraws( playerid, bool: force = false )
|
||||||
{
|
{
|
||||||
// Current Coins
|
// Current Coins
|
||||||
@ -18019,7 +17748,7 @@ stock ArrestPlayer( victimid, playerid )
|
|||||||
if ( GetPlayerState( playerid ) == PLAYER_STATE_WASTED ) return SendError( playerid, "You cannot use this command since you are dead." );
|
if ( GetPlayerState( playerid ) == PLAYER_STATE_WASTED ) return SendError( playerid, "You cannot use this command since you are dead." );
|
||||||
new totalCash = ( p_WantedLevel[ victimid ] < MAX_WANTED_LVL ? p_WantedLevel[ victimid ] : MAX_WANTED_LVL ) * ( 300 );
|
new totalCash = ( p_WantedLevel[ victimid ] < MAX_WANTED_LVL ? p_WantedLevel[ victimid ] : MAX_WANTED_LVL ) * ( 300 );
|
||||||
new totalSeconds = p_WantedLevel[ victimid ] * ( JAIL_SECONDS_MULTIPLIER );
|
new totalSeconds = p_WantedLevel[ victimid ] * ( JAIL_SECONDS_MULTIPLIER );
|
||||||
GivePlayerScore( playerid, 2, .multiplier = 1.5 );
|
GivePlayerScore( playerid, 2 );
|
||||||
GivePlayerExperience( playerid, E_POLICE );
|
GivePlayerExperience( playerid, E_POLICE );
|
||||||
GivePlayerCash( playerid, totalCash );
|
GivePlayerCash( playerid, totalCash );
|
||||||
if ( totalCash > 20000 ) printf("[police arrest] %s -> %s - %s", ReturnPlayerName( playerid ), ReturnPlayerName( victimid ), cash_format( totalCash ) ); // 8hska7082bmahu
|
if ( totalCash > 20000 ) printf("[police arrest] %s -> %s - %s", ReturnPlayerName( playerid ), ReturnPlayerName( victimid ), cash_format( totalCash ) ); // 8hska7082bmahu
|
||||||
@ -18027,7 +17756,7 @@ stock ArrestPlayer( victimid, playerid )
|
|||||||
GameTextForPlayer( victimid, "~r~Busted!", 4000, 0 );
|
GameTextForPlayer( victimid, "~r~Busted!", 4000, 0 );
|
||||||
CallLocalFunction( "OnPlayerArrested", "dddd", playerid, victimid, p_Arrests[ playerid ], 1 );
|
CallLocalFunction( "OnPlayerArrested", "dddd", playerid, victimid, p_Arrests[ playerid ], 1 );
|
||||||
Untaze( victimid, 6 );
|
Untaze( victimid, 6 );
|
||||||
GivePlayerIrresistiblePoints( victimid, -2 );
|
GivePlayerSeasonalXP( victimid, -20.0 );
|
||||||
SendGlobalMessage( -1, ""COL_GOLD"[JAIL]{FFFFFF} %s(%d) has sent %s(%d) to jail for %d seconds!", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( victimid ), victimid, totalSeconds );
|
SendGlobalMessage( -1, ""COL_GOLD"[JAIL]{FFFFFF} %s(%d) has sent %s(%d) to jail for %d seconds!", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( victimid ), victimid, totalSeconds );
|
||||||
JailPlayer( victimid, totalSeconds );
|
JailPlayer( victimid, totalSeconds );
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2,5 +2,11 @@
|
|||||||
(+) Pilot and train minijobs are now saved to the database (and in /highscores).
|
(+) Pilot and train minijobs are now saved to the database (and in /highscores).
|
||||||
(+) Adds some strippers in the LV brothel (for fun).
|
(+) Adds some strippers in the LV brothel (for fun).
|
||||||
(+) Adds Hide From Minimap perk (costs $25,000) ... hides you for 1 minute.
|
(+) Adds Hide From Minimap perk (costs $25,000) ... hides you for 1 minute.
|
||||||
|
(/) You can now set spikes in non-air and non-sea vehicles using your AIM key.
|
||||||
|
(/) Car jackers now need to wait only 1 min before exporting another vehicle (before 2 min).
|
||||||
|
(/) Players with level 100 in a specific level are able to accrue more XP in the level.
|
||||||
(*) Should be faster to place multiple drills using left alt.
|
(*) Should be faster to place multiple drills using left alt.
|
||||||
(*) Fixes death bug with players suiciding in a vehicle.
|
(*) Fixes death bug with players suiciding in a vehicle.
|
||||||
|
(*) Fixed Alcatraz map escaping issues.
|
||||||
|
(*) Addressed issue with being unable to rob ChuffSec.
|
||||||
|
(-) Removed a counter in cluckin' bell for ease of access to the safe.
|
Loading…
Reference in New Issue
Block a user