place constants where fit on functions

This commit is contained in:
Lorenc Pekaj 2018-12-23 17:26:46 +11:00
parent 7fe17a317f
commit d2d0bfd8f7
11 changed files with 42 additions and 37 deletions

View File

@ -302,7 +302,7 @@ thread OnEntrancesLoad( )
}
/* ** Functions ** */
stock CreateEntrance( name[ ], Float: X, Float: Y, Float: Z, Float: lX, Float: lY, Float: lZ, interior, world, bool: custom = false, bool: viponly = false, mapicon = -1, savedId = 0 )
stock CreateEntrance( const name[ ], Float: X, Float: Y, Float: Z, Float: lX, Float: lY, Float: lZ, interior, world, bool: custom = false, bool: viponly = false, mapicon = -1, savedId = 0 )
{
new
ID = Iter_Free(entrances);

View File

@ -381,7 +381,7 @@ stock CreateLoopingAnimation( playerid, animlib[ ], animname[ ], Float:Speed, lo
return 1;
}
stock IsPlayingAnimation( playerid, library[ ], animation[ ] )
stock IsPlayingAnimation( playerid, const library[ ], const animation[ ] )
{
if ( IsPlayerConnected( playerid ) )
{

View File

@ -1385,7 +1385,7 @@ thread OnUpdateBusinessTitle( businessid )
}
/* ** Functions ** */
stock CreateBusiness( iAccountID, szBusiness[ 32 ], iPrice, iType, Float: fX, Float: fY, Float: fZ, iSupply = 0, iProduct = 0, iProductionTimestamp = 0, iBank = 0, iSecurity = 0, iExistingID = ITER_NONE )
stock CreateBusiness( iAccountID, const szBusiness[ 32 ], iPrice, iType, Float: fX, Float: fY, Float: fZ, iSupply = 0, iProduct = 0, iProductionTimestamp = 0, iBank = 0, iSecurity = 0, iExistingID = ITER_NONE )
{
new
iBusiness = iExistingID != ITER_NONE ? iExistingID : Iter_Free(business);

View File

@ -1353,7 +1353,7 @@ stock Pool_QueueNextPlayer( poolid, current_player )
Pool_ResetBallPositions( poolid );
}
stock Pool_SendTableMessage( poolid, colour, format[ ], va_args<> ) // Conversion to foreach 14 stuffed the define, not sure how...
stock Pool_SendTableMessage( poolid, colour, const format[ ], va_args<> ) // Conversion to foreach 14 stuffed the define, not sure how...
{
static
out[ 144 ];

View File

@ -663,7 +663,7 @@ CMD:race( playerid, params[ ] )
/* ** Functions ** */
stock SendClientMessageToRace( raceid, colour, format[ ], va_args<> )
stock SendClientMessageToRace( raceid, colour, const format[ ], va_args<> )
{
static
out[ 144 ];

View File

@ -636,7 +636,7 @@ stock GetCivilianNpcFromPlayer( playerid )
return -1;
}
stock TriggerClosestCivilians( playerid, clerkid = -1, Float: radius = 50.0, &Float: distance = FLOAT_INFINITY )
stock TriggerClosestCivilians( playerid, clerkid = -1, Float: radius = 50.0 )
{
if ( ! IsPlayerConnected( playerid ) )
return;

View File

@ -615,21 +615,10 @@ hook OnPlayerEndModelPreview( playerid, handleid )
/* ** Commands ** */
CMD:toys( playerid, params[ ] )
{
if ( !IsPlayerSpawned( playerid ) ) return SendError( playerid, "You cannot use this command while you are not spawned." );
if ( !IsPlayerSpawned( playerid ) )
return SendError( playerid, "You cannot use this command while you are not spawned." );
new
iToy[ 3 ] [ 24 ] = { { "None" }, { "None" }, { "None" } };
for( new i = 0; i < sizeof( g_ToyData ); i++ ) {
for( new x = 0; x < sizeof( iToy ); x++ ) {
if ( g_ToyData[ i ] [ E_MODEL ] == p_AttachedObjectsData[ playerid ] [ x ] [ E_MODELID ] )
strcpy( iToy[ x ], g_ToyData[ i ] [ E_NAME ] );
}
}
format( szNormalString, sizeof( szNormalString ), ""COL_GREY"Disable All Toys\nSlot 1 (%s)\nSlot 2 (%s)\nSlot 3 (%s)", iToy[ 0 ], iToy[ 1 ], iToy[ 2 ] );
ShowPlayerDialog( playerid, DIALOG_TOYS_MAIN, DIALOG_STYLE_LIST, "{FFFFFF}Toys", szNormalString, "Select", "Close" );
return 1;
return ShowPlayerToys( playerid );
}
/* ** SQL Threads ** */
@ -789,3 +778,19 @@ stock reloadPlayerToys( playerid )
}
return 1;
}
stock ShowPlayerToys( playerid )
{
new
iToy[ 3 ] [ 24 ] = { { "None" }, { "None" }, { "None" } };
for( new i = 0; i < sizeof( g_ToyData ); i++ ) {
for( new x = 0; x < sizeof( iToy ); x++ ) {
if ( g_ToyData[ i ] [ E_MODEL ] == p_AttachedObjectsData[ playerid ] [ x ] [ E_MODELID ] )
strcpy( iToy[ x ], g_ToyData[ i ] [ E_NAME ] );
}
}
format( szNormalString, sizeof( szNormalString ), ""COL_GREY"Disable All Toys\nSlot 1 (%s)\nSlot 2 (%s)\nSlot 3 (%s)", iToy[ 0 ], iToy[ 1 ], iToy[ 2 ] );
return ShowPlayerDialog( playerid, DIALOG_TOYS_MAIN, DIALOG_STYLE_LIST, "{FFFFFF}Toys", szNormalString, "Select", "Close" ), 1;
}

View File

@ -65,7 +65,7 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
}
/* ** Functions ** */
stock ShowProgressBar( playerid, title[ ], progress_id, total_time = 1000, color, params = 0 )
stock ShowProgressBar( playerid, title[ 64 ], progress_id, total_time = 1000, color, params = 0 )
{
if ( !IsPlayerConnected( playerid ) )
return 0;

View File

@ -43,7 +43,7 @@ stock const g_aVehicleNames[ 212 ] [ ] =
};
/* ** Functions ** */
stock GetVehicleModelFromName( szVehicleName[ ] )
stock GetVehicleModelFromName( const szVehicleName[ ] )
{
for( new i = 400; i <= 611; i++ )
if( strfind( g_aVehicleNames[ i - 400 ], szVehicleName, true ) != -1 )

View File

@ -69,7 +69,7 @@ stock __svrticks__GetTickCount( )
#define GetTickCount __svrticks__GetTickCount
/* ** Functions ** */
stock SendClientMessageFormatted( playerid, colour, format[ ], va_args<> )
stock SendClientMessageFormatted( playerid, colour, const format[ ], va_args<> )
{
static
out[ 144 ];
@ -84,7 +84,7 @@ stock SendClientMessageFormatted( playerid, colour, format[ ], va_args<> )
}
// purpose: send client message to all rcon admins
stock SendClientMessageToRCON( colour, format[ ], va_args<> )
stock SendClientMessageToRCON( colour, const format[ ], va_args<> )
{
static
out[ 144 ];

View File

@ -7577,7 +7577,7 @@ stock SavePlayerData( playerid, bool: logout = false )
return 1;
}
stock SendClientMessageToGang( gangid, colour, format[ ], va_args<> ) // Conversion to foreach 14 stuffed the define, not sure how...
stock SendClientMessageToGang( gangid, colour, const format[ ], va_args<> ) // Conversion to foreach 14 stuffed the define, not sure how...
{
static
out[ 144 ];
@ -7592,7 +7592,7 @@ stock SendClientMessageToGang( gangid, colour, format[ ], va_args<> ) // Convers
return 1;
}
stock SendGlobalMessage( colour, format[ ], va_args<> )
stock SendGlobalMessage( colour, const format[ ], va_args<> )
{
static
out[ 144 ];
@ -7832,7 +7832,7 @@ stock IsNumeric(const str[ ])
return true;
}
stock AddFileLogLine( file[ ], input[ ] )
stock AddFileLogLine( const file[ ], input[ ] )
{
new
File: fHandle
@ -7843,7 +7843,7 @@ stock AddFileLogLine( file[ ], input[ ] )
return 1;
}
stock GetPlayerIDFromName( pName[ ] )
stock GetPlayerIDFromName( const pName[ ] )
{
foreach(new i : Player)
{
@ -8404,7 +8404,7 @@ stock SyncObject( playerid, Float: offsetX = 0.005, Float: offsetY = 0.005, Floa
SetPlayerPos( playerid, X + offsetX, Y + offsetY, Z + offsetZ );
}
stock AddAdminLogLineFormatted( format[ ], va_args<> )
stock AddAdminLogLineFormatted( const format[ ], va_args<> )
{
static
out[ sizeof( log__Text[ ] ) ];
@ -8425,7 +8425,7 @@ stock AddAdminLogLine( szMessage[ sizeof( log__Text[ ] ) ] )
return TextDrawSetString( g_AdminLogTD, szLargeString );
}
stock SaveToAdminLogFormatted( playerid, id, format[ ], va_args<> )
stock SaveToAdminLogFormatted( playerid, id, const format[ ], va_args<> )
{
static
out[ sizeof( log__Text[ ] ) ];
@ -8434,12 +8434,12 @@ stock SaveToAdminLogFormatted( playerid, id, format[ ], va_args<> )
return SaveToAdminLog( playerid, id, out );
}
stock SaveToAdminLog( playerid, id, message[ ] )
stock SaveToAdminLog( playerid, id, const message[ ] )
{
if ( id ) {
format( szBigString, sizeof( szBigString ),"INSERT INTO `ADMIN_LOG` (`USER_ID`, `ACTION`, `ACTION_ID`) VALUES (%d, '%s', %d)", p_AccountID[ playerid ], mysql_escape( message ), id );
mysql_format( dbHandle, szBigString, sizeof( szBigString ), "INSERT INTO `ADMIN_LOG` (`USER_ID`, `ACTION`, `ACTION_ID`) VALUES (%d, '%e', %d)", p_AccountID[ playerid ], message, id );
} else {
format( szBigString, sizeof( szBigString ),"INSERT INTO `ADMIN_LOG` (`USER_ID`, `ACTION`) VALUES (%d, '%s')", p_AccountID[ playerid ], mysql_escape( message ) );
mysql_format( dbHandle, szBigString, sizeof( szBigString ), "INSERT INTO `ADMIN_LOG` (`USER_ID`, `ACTION`) VALUES (%d, '%e')", p_AccountID[ playerid ], message );
}
mysql_single_query( szBigString );
return 1;
@ -8694,7 +8694,7 @@ stock getCurrentTime( )
new
p_HideHelpDialogTimer[ MAX_PLAYERS ] = { -1, ... };
stock ShowPlayerHelpDialog( playerid, timeout, format[ ], va_args<> )
stock ShowPlayerHelpDialog( playerid, timeout, const format[ ], va_args<> )
{
static
out[ 255 ]
@ -9593,7 +9593,7 @@ stock GivePlayerLeoWeapons( playerid ) {
}
}
stock IsSafeGameText(string[])
stock IsSafeGameText(const string[])
{
new count;
for(new num, len = strlen(string); num < len; num++)
@ -9633,7 +9633,7 @@ function ope_Unfreeze( a )
TogglePlayerControllable( a, 1 );
}
stock SendClientMessageToAdmins( colour, format[ ], va_args<> ) // Conversion to foreach 14 stuffed the define, not sure how...
stock SendClientMessageToAdmins( colour, const format[ ], va_args<> ) // Conversion to foreach 14 stuffed the define, not sure how...
{
static
out[ 144 ];
@ -9757,7 +9757,7 @@ stock IsPlayerInMinigame( playerid ) {
return IsPlayerInPaintBall( playerid ) || IsPlayerDueling( playerid ) || IsPlayerPlayingPool( playerid ) || IsPlayerPlayingPoker( playerid );
}
stock SendClientMessageToCops( colour, format[ ], va_args<> ) // Conversion to foreach 14 stuffed the define, not sure how...
stock SendClientMessageToCops( colour, const format[ ], va_args<> ) // Conversion to foreach 14 stuffed the define, not sure how...
{
static
out[ 144 ];