Merge pull request #11 from zeelorenc/master

Merge
This commit is contained in:
Dusan 2019-06-11 18:52:41 +02:00 committed by GitHub
commit ec06a00f38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 136 additions and 48 deletions

View File

@ -140,6 +140,7 @@ static stock
{ 5, "/editgate", "Editing a gate" },
{ 5, "/acunban", "Unbanning a player from AC" },
{ 5, "/safeisbugged", "Debug command for robbery safes" },
{ 5, "/replenishsafe", "Fixes bugged robbery safes" },
{ 5, "/autovehrespawn", "Setting auto respawn for vehicles" },
{ 5, "/megaban", "The Mega Ban" },
{ 5, "/achangename", "Change a players name" },

View File

@ -346,6 +346,23 @@ CMD:safeisbugged( playerid, params[ ] )
return 1;
}
CMD:replenishsafe( playerid, params[ ] )
{
new
rID;
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
else if ( sscanf( params, "d", rID ) ) return SendUsage( playerid, "/replenishsafe [SAFE_ID]" );
else if (!Iter_Contains(RobberyCount, rID)) return SendError( playerid, "This is an invalid Safe ID." );
else
{
printf( "[GM:ADMIN] %s has replenished %d! (Success: %d)", ReturnPlayerName( playerid ), rID, setSafeReplenished( rID ) );
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" You've replenished Safe ID %d: "COL_GREY"%s"COL_WHITE".", rID, g_robberyData[ rID ] [ E_NAME ] );
}
return 1;
}
CMD:autovehrespawn( playerid, params[ ] )
{
#if defined _vsync_included
@ -1001,3 +1018,41 @@ thread OnPlayerUnforceAC( playerid, player[ ], pID, bool:offline )
}
return 1;
}
CMD:giveboombox( playerid, params[ ] )
{
new
pID;
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/giveboombox [PLAYER_ID]" );
else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." );
else if ( GetPlayerBoombox( pID ) ) return SendError( playerid, "Player already has boombox in his inventory." );
else
{
SendClientMessageFormatted( pID, -1, ""COL_PINK"[ADMIN]"COL_WHITE" %s(%d) gave you boombox.", ReturnPlayerName( playerid ), playerid );
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" You have given boombox to %s(%d).", ReturnPlayerName( pID ), pID );
AddAdminLogLineFormatted( "%s(%d) has given boombox to %s(%d)", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( pID ), pID );
SetPlayerBoombox( pID, true );
}
return 1;
}
CMD:removeboombox( playerid, params[ ] )
{
new
pID;
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/removeboombox [PLAYER_ID]" );
else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." );
else if ( GetPlayerBoombox( pID ) ) return SendError( playerid, "Player doesn't have boombox in his inventory." );
else
{
SendClientMessageFormatted( pID, -1, ""COL_PINK"[ADMIN]"COL_WHITE" %s(%d) has removed your boombox.", ReturnPlayerName( playerid ), playerid );
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" You have removed boombox from %s(%d).", ReturnPlayerName( pID ), pID );
AddAdminLogLineFormatted( "%s(%d) has removed boombox from %s(%d)", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( pID ), pID );
SetPlayerBoombox( pID, false );
}
return 1;
}

View File

@ -255,23 +255,6 @@ CMD:addcomponent( playerid, params[ ] )
return 1;
}
CMD:replenishsafe( playerid, params[ ] )
{
new
rID;
if ( !IsPlayerAdmin( playerid ) ) return 0;
else if ( sscanf( params, "d", rID ) ) return SendUsage( playerid, "/replenishsafe [SAFE_ID]" );
else if (!Iter_Contains(RobberyCount, rID)) return SendError( playerid, "This is an invalid Safe ID." );
else
{
printf( "[GM:ADMIN] %s has replenished %d! (Success: %d)", ReturnPlayerName( playerid ), rID, setSafeReplenished( rID ) );
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" You've replenished Safe ID %d: "COL_GREY"%s"COL_WHITE".", rID, g_robberyData[ rID ] [ E_NAME ] );
}
return 1;
}
CMD:driveby( playerid, params[ ] )
{
if ( !IsPlayerAdmin( playerid ) ) return 0;

View File

@ -10,25 +10,26 @@
/* ** Definitions ** */
#define DEFAULT_BOOMBOX_RANGE ( 50.0 )
#define BOOMBOX_URL_LEN ( 128 )
/* ** Variables ** */
enum E_BOOMBOX_DATA
{
E_OBJECT, Text3D: E_LABEL, E_MUSIC_AREA,
E_URL[ 128 ],
Float: E_X, Float: E_Y, Float: E_Z
Float: E_X, Float: E_Y, Float: E_Z,
E_URL[ BOOMBOX_URL_LEN ]
};
static stock
g_boomboxData [ MAX_PLAYERS ] [ E_BOOMBOX_DATA ]
g_boomboxData [ MAX_PLAYERS ] [ E_BOOMBOX_DATA ],
bool: p_Boombox [ MAX_PLAYERS char ],
bool: p_UsingBoombox [ MAX_PLAYERS char ]
;
/* ** Hooks ** */
hook OnPlayerDisconnect( playerid, reason )
{
p_UsingBoombox{ playerid } = false;
p_Boombox{ playerid } = false;
Boombox_Destroy( playerid );
SetPlayerBoombox( playerid, false );
return 1;
}
@ -38,14 +39,12 @@ hook OnPlayerDeathEx( playerid, killerid, reason, Float: damage, bodypart )
hook OnPlayerDeath( playerid, killerid, reason )
#endif
{
p_UsingBoombox{ playerid } = false;
Boombox_Destroy( playerid );
return 1;
}
hook OnPlayerJailed( playerid )
{
p_UsingBoombox{ playerid } = false;
Boombox_Destroy( playerid );
return 1;
}
@ -98,21 +97,42 @@ CMD:boombox( playerid, params[ ] )
if ( ! strcmp( params, "play", false, 3 ) )
{
static
Float: X, Float: Y, Float: Z, Float: Angle;
Float: X,
Float: Y,
Float: Z,
Float: Angle,
szURL[ BOOMBOX_URL_LEN ];
new szURL[ 128 ];
if ( sscanf( params[ 5 ], "s[128]", szURL ) ) return SendUsage( playerid, "/boombox play [URL]" );
else if ( IsPlayerUsingBoombox( playerid ) ) return SendError( playerid, "You are already using Boombox." );
else if ( IsPlayerNearBoombox( playerid ) ) return SendError( playerid, "You cannot be near another Boombox if you wish to create your own." );
if ( sscanf( params[ 5 ], sprintf( "s[%d]", BOOMBOX_URL_LEN ), szURL ) ) return SendUsage( playerid, "/boombox play [URL]" );
// else if ( IsPlayerUsingBoombox( playerid ) ) return SendError( playerid, "You are already using Boombox." );
else
{
if ( GetPlayerPos( playerid, X, Y, Z ) && GetPlayerFacingAngle( playerid, Angle ) )
{
new
current_boombox = GetCurrentBoombox( playerid );
if ( current_boombox != -1 && current_boombox != playerid ) {
return SendError( playerid, "You cannot be near another Boombox if you wish to create your own." );
}
if ( IsPlayerUsingBoombox( playerid ) ) {
if ( GetPlayerDistanceFromPoint( playerid, g_boomboxData[ playerid ] [ E_X ], g_boomboxData[ playerid ] [ E_Y ], g_boomboxData[ playerid ] [ E_Z ] ) > DEFAULT_BOOMBOX_RANGE ) {
return SendError( playerid, "You are too far from your boombox. Use "COL_GREY"/boombox stop"COL_WHITE" to stop it." );
}
format( g_boomboxData[ playerid ] [ E_URL ], BOOMBOX_URL_LEN, "%s", szURL );
foreach ( new i : Player ) {
if ( GetPlayerDistanceFromPoint( i, g_boomboxData[ playerid ] [ E_X ], g_boomboxData[ playerid ] [ E_Y ], g_boomboxData[ playerid ] [ E_Z ] ) < DEFAULT_BOOMBOX_RANGE ) {
StopAudioStreamForPlayer( i );
PlayAudioStreamForPlayer( i, g_boomboxData[ playerid ] [ E_URL ], g_boomboxData[ playerid ] [ E_X ], g_boomboxData[ playerid ] [ E_Y ], g_boomboxData[ playerid ] [ E_Z ], DEFAULT_BOOMBOX_RANGE, 1 );
}
}
SendServerMessage( playerid, "You have updated your boombox stream to: "COL_GREY"%s", szURL );
} else {
SendServerMessage( playerid, "If the stream doesn't respond then it must be offline. Use "COL_GREY"/boombox stop"COL_WHITE" to stop the stream." );
Boombox_Create( playerid, szURL, X, Y, Z, Angle );
p_UsingBoombox{ playerid } = true;
SendServerMessage( playerid, "If the stream doesn't respond then it must be offline. Use "COL_GREY"/boombox stop"COL_WHITE" to stop the stream." );
}
}
}
}
@ -134,8 +154,17 @@ stock IsPlayerUsingBoombox( playerid ) return p_UsingBoombox{ playerid };
stock GetPlayerBoombox( playerid ) return p_Boombox{ playerid };
stock SetPlayerBoombox( playerid, bool: toggle )
{
if ( ( p_Boombox{ playerid } = toggle ) == false ) {
Boombox_Destroy( playerid );
}
}
stock Boombox_Destroy( playerid )
{
p_UsingBoombox{ playerid } = false;
g_boomboxData[ playerid ] [ E_X ] = 0.0;
g_boomboxData[ playerid ] [ E_Y ] = 0.0;
g_boomboxData[ playerid ] [ E_Z ] = 0.0;
@ -147,9 +176,9 @@ stock Boombox_Destroy( playerid )
return 1;
}
stock Boombox_Create( playerid, szURL[ ], Float: X, Float: Y, Float: Z, Float: Angle, Float: fDistance = DEFAULT_BOOMBOX_RANGE )
stock Boombox_Create( playerid, szURL[ BOOMBOX_URL_LEN ], Float: X, Float: Y, Float: Z, Float: Angle, Float: fDistance = DEFAULT_BOOMBOX_RANGE )
{
format( g_boomboxData[ playerid ] [ E_URL ], 128, "%s", szURL );
format( g_boomboxData[ playerid ] [ E_URL ], BOOMBOX_URL_LEN, "%s", szURL );
g_boomboxData[ playerid ] [ E_X ] = X;
g_boomboxData[ playerid ] [ E_Y ] = Y;
@ -161,12 +190,12 @@ stock Boombox_Create( playerid, szURL[ ], Float: X, Float: Y, Float: Z, Float: A
return 1;
}
stock IsPlayerNearBoombox( playerid )
stock GetCurrentBoombox( playerid )
{
foreach ( new i : Player ) {
if ( GetPlayerDistanceFromPoint( playerid, g_boomboxData[ i ] [ E_X ], g_boomboxData[ i ] [ E_Y ], g_boomboxData[ i ] [ E_Z ] ) < DEFAULT_BOOMBOX_RANGE ) {
return true;
return i;
}
}
return false;
return -1;
}

View File

@ -649,6 +649,7 @@ thread OnPlayerGangLoaded( playerid )
thread OnGangAdded( gangid )
{
g_gangData[ gangid ] [ E_SQL_ID ] = cache_insert_id( );
mysql_single_query( sprintf( "UPDATE `USERS` SET `GANG_ID`=%d WHERE `ID`=%d", g_gangData[ gangid ] [ E_SQL_ID ], g_gangData[ gangid ][ E_LEADER ] ) );
return 1;
}
@ -770,6 +771,10 @@ thread OnGangKickOffline( playerid, gangid )
mysql_single_query( sprintf( "DELETE FROM `GANG_COLEADERS` WHERE `USER_ID`=%d", player_accid ) );
mysql_single_query( sprintf( "UPDATE `USERS` SET `GANG_ID`=-1 WHERE `ID`=%d", player_accid ) );
for ( new i = 0; i < MAX_COLEADERS; i++ ) if ( g_gangData[ gangid ] [ E_COLEADER ] [ i ] == player_accid ) {
g_gangData[ gangid ] [ E_COLEADER ] [ i ] = 0;
}
SendClientMessageToGang( static_gangid, g_gangData[ static_gangid ] [ E_COLOR ], "[GANG]{FFFFFF} %s has left the gang (KICKED)", player_name );
}
else

View File

@ -106,8 +106,8 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
}
case SHOP_ITEM_BOOMBOX:
{
if ( p_Boombox{ playerid } == true ) return SendError( playerid, "You have already purchased this item." );
p_Boombox{ playerid } = true;
if ( GetPlayerBoombox( playerid ) ) return SendError( playerid, "You have already purchased this item." );
SetPlayerBoombox( playerid, true );
}
}
GivePlayerCash( playerid, -( g_shopItemData[ listitem ] [ E_PRICE ] ) );
@ -198,7 +198,7 @@ stock GetShopItemAmount( playerid, id )
case SHOP_ITEM_METAL_MELTER: return p_MetalMelter[ playerid ];
case SHOP_ITEM_WEED_SEED: return g_playerShopItems[ playerid ] [ SHOP_ITEM_WEED_SEED ];
case SHOP_ITEM_FIREWORKS: return p_Fireworks[ playerid ];
case SHOP_ITEM_BOOMBOX: return p_Boombox[ playerid ];
case SHOP_ITEM_BOOMBOX: return GetPlayerBoombox( playerid );
}
return 0;
}
@ -221,7 +221,7 @@ stock SetPlayerShopItemAmount( playerid, id, value )
case SHOP_ITEM_METAL_MELTER: p_MetalMelter[ playerid ] = value;
case SHOP_ITEM_WEED_SEED: g_playerShopItems[ playerid ] [ SHOP_ITEM_WEED_SEED ] = value;
case SHOP_ITEM_FIREWORKS: p_Fireworks[ playerid ] = value;
case SHOP_ITEM_BOOMBOX: p_Boombox[ playerid ] = !!value;
case SHOP_ITEM_BOOMBOX: SetPlayerBoombox( playerid, !!value );
}
return 1;
}

View File

@ -248,6 +248,21 @@ hook OnPlayerDeath( playerid, killerid, reason )
return 1;
}
/* ** Commands ** */
CMD:jackpots( playerid, params[ ] )
{
format( szBigString, sizeof( szBigString ), "The Visage Casino\t"COL_GREEN"%s\n\
4 Dragons Casino\t"COL_GREEN"%s\n\
Caligulas Casino\t"COL_GREEN"%s",
cash_format( g_casinoPoolData[ 2 ] [ E_POOL ] ),
cash_format( g_casinoPoolData[ 1 ] [ E_POOL ] ),
cash_format( g_casinoPoolData[ 0 ] [ E_POOL ] )
);
ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_TABLIST, ""COL_GOLD"Jackpots", szBigString, "Okay", "" );
return 1;
}
/* ** Callbacks ** */
public OnPlayerUseSlotMachine( playerid, slotid, first_combo, second_combo, third_combo )
{

View File

@ -209,9 +209,7 @@ new
p_TazingImmunity [ MAX_PLAYERS ],
p_PlayerAltBind [ MAX_PLAYERS ] = { -1, ... },
p_PlayerAltBindTick [ MAX_PLAYERS ],
p_AimedAtPolice [ MAX_PLAYERS ],
bool: p_UsingBoombox [ MAX_PLAYERS char ],
bool: p_Boombox [ MAX_PLAYERS char ]
p_AimedAtPolice [ MAX_PLAYERS ]
;
/* ** Getters And Setters** */

View File

@ -5198,7 +5198,8 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
""COL_GREY"/robstore{FFFFFF} - Displays the key to press in-order to rob a store.\n"\
""COL_GREY"/pdjail{FFFFFF} - Displays the time until jail cells are available for raiding.\n"\
""COL_GREY"/banks{FFFFFF} - Displays the time until certain banks are available for robbing.\n" );
strcat( szCMDS, ""COL_GREY"/stoprob{FFFFFF} - Stops your current robbery.\n"\
strcat( szCMDS, ""COL_GREY"/jackpots{FFFFFF} - Displays current jackpots in all casinos.\n"\
""COL_GREY"/stoprob{FFFFFF} - Stops your current robbery.\n"\
""COL_GREY"/job{FFFFFF} - Shows your job.\n"\
""COL_GREY"/911{FFFFFF} - Calls the emergency services.\n"\
""COL_GREY"/placehit{FFFFFF} - Places a hit on a specified player.\n"\
@ -5297,6 +5298,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
""COL_GREY"/radio{FFFFFF} - Shows the list of radio stations you can listen to.\n"\
""COL_GREY"/stopradio{FFFFFF} - Stops the radio from playing.\n"\
""COL_GREY"/boombox{FFFFFF} - Places a boombox at your position which plays music in small area.\n"\
""COL_GREY"/colors(/colours){FFFFFF} - Shows the list of all available colours in-game.\n"\
""COL_GREY"/moviemode{FFFFFF} - Toggles movie mode so you can record without all the text on the screen." );
ShowPlayerDialog( playerid, DIALOG_CMDS_REDIRECT, DIALOG_STYLE_MSGBOX, "{FFFFFF}Miscellaneous Commands", szCMDS, "Okay", "Back" );
}
@ -5419,7 +5421,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
""COL_GREY"Fireworks:{FFFFFF} %d\n"\
""COL_GREY"Explosive Bullets:{FFFFFF} %d\n"\
""COL_GREY"Boombox:{FFFFFF} %s\n",
szLargeString, GetPlayerShopItemAmount( playerid, SHOP_ITEM_WEED_SEED ), p_Fireworks[ pID ], p_ExplosiveBullets[ pID ], p_Boombox{ pID } == true ? ( "Yes" ) : ( "No" ) );
szLargeString, GetPlayerShopItemAmount( playerid, SHOP_ITEM_WEED_SEED ), p_Fireworks[ pID ], p_ExplosiveBullets[ pID ], GetPlayerBoombox( pID ) ? ( "Yes" ) : ( "No" ) );
ShowPlayerDialog( playerid, DIALOG_STATS_REDIRECT, DIALOG_STYLE_MSGBOX, "{FFFFFF}Item Statistics", szLargeString, "Okay", "Back" );
}