remove xp market, completely deprecate prior xp system

This commit is contained in:
Lorenc Pekaj 2018-09-29 08:13:08 +10:00
parent 692a8fa8e0
commit 88c8bd3582
4 changed files with 23 additions and 21 deletions

View File

@ -424,7 +424,7 @@ CMD:givexp( playerid, params [ ] )
xp xp
; ;
if ( !IsPlayerAdmin( playerid ) || !IsPlayerLorenc( playerid ) ) return 0; if ( !IsPlayerAdmin( playerid ) || !IsPlayerLorenc( playerid ) ) return 0;
else if ( sscanf( params, "udd", pID, level, xp ) ) SendUsage( playerid, "/givexp [PLAYER_ID] [XP_AMOUNT]" ); else if ( sscanf( params, "udd", pID, level, xp ) ) SendUsage( playerid, "/givexp [PLAYER_ID] [LEVEL_ID] [XP_AMOUNT]" );
else if ( !IsPlayerConnected( pID ) ) SendError( playerid, "Invalid Player ID." ); else if ( !IsPlayerConnected( pID ) ) SendError( playerid, "Invalid Player ID." );
else else
{ {

View File

@ -39,7 +39,7 @@
#define DIALOG_GANG_COLOR 1027 #define DIALOG_GANG_COLOR 1027
#define DIALOG_GANG_COLOR_INPUT 1028 #define DIALOG_GANG_COLOR_INPUT 1028
#define DIALOG_RADIO 1029 #define DIALOG_RADIO 1029
#define DIALOG_XPMARKET 1030 //#define DIALOG_XPMARKET 1030
#define DIALOG_PAINTBALL 1031 #define DIALOG_PAINTBALL 1031
#define DIALOG_GPS 1032 #define DIALOG_GPS 1032
#define DIALOG_VIP_LOCKER 1033 #define DIALOG_VIP_LOCKER 1033

View File

@ -1,8 +1,8 @@
/* /*
* Irresistible Gaming (c) 2018 * Irresistible Gaming (c) 2018
* Developed by Lorenc Pekaj * Developed by Lorenc Pekaj
* Module: * Module: cnr\experience.pwn
* Purpose: * Purpose: player experience system 2.0
*/ */
/* ** Includes ** */ /* ** Includes ** */
@ -17,8 +17,8 @@
/* ** Constants ** */ /* ** Constants ** */
enum E_LEVELS { enum E_LEVELS {
E_POLICE, E_POLICE,
E_DEATHMATCH,
E_ROBBERY, E_ROBBERY,
E_DEATHMATCH,
/*E_FIREMAN, /*E_FIREMAN,
E_PARAMEDIC, E_PARAMEDIC,
@ -112,6 +112,9 @@ hook OnPlayerDisconnect( playerid, reason ) {
} }
/* ** Commands ** */ /* ** Commands ** */
CMD:experience( playerid, params[ ] ) return cmd_level( playerid, params );
CMD:levels( playerid, params[ ] ) return cmd_level( playerid, params );
CMD:xp( playerid, params[ ] ) return cmd_level( playerid, params );
CMD:level( playerid, params[ ] ) CMD:level( playerid, params[ ] )
{ {
new new
@ -139,7 +142,7 @@ CMD:level( playerid, params[ ] )
} }
SetPVarInt( playerid, "experience_watchingid", watchingid ); SetPVarInt( playerid, "experience_watchingid", watchingid );
return ShowPlayerDialog( playerid, DIALOG_VIEW_LEVEL, DIALOG_STYLE_TABLIST_HEADERS, sprintf( "{FFFFFF}%s(%d) Level - Total Level %d", ReturnPlayerName( watchingid ), 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" );
} }
/* ** SQL Threads ** */ /* ** SQL Threads ** */
@ -178,7 +181,7 @@ stock GivePlayerExperience( playerid, E_LEVELS: level, Float: default_xp = 1.0,
new Float: next_rank_xp = ( g_levelData[ _: level ] [ E_MAX_UNITS ] * g_levelData[ _: level ] [ E_XP_DILATION ] ) / ( EXP_MAX_PLAYER_LEVEL * EXP_MAX_PLAYER_LEVEL ) * float( next_rank * next_rank ); new Float: next_rank_xp = ( g_levelData[ _: level ] [ E_MAX_UNITS ] * g_levelData[ _: level ] [ E_XP_DILATION ] ) / ( EXP_MAX_PLAYER_LEVEL * EXP_MAX_PLAYER_LEVEL ) * float( next_rank * next_rank );
if ( g_playerExperience[ playerid ] [ level ] + xp_earned >= next_rank_xp ) { if ( g_playerExperience[ playerid ] [ level ] + xp_earned >= next_rank_xp ) {
ShowPlayerHelpDialog( playerid, 10000, "~y~Congratulations!~n~~n~~w~Your %s Level is now ~y~%d.", g_levelData[ _: level ] [ E_NAME ], next_rank ); ShowPlayerHelpDialog( playerid, 10000, "~p~Congratulations %s!~n~~n~~w~Your %s Level is now ~p~%d.", ReturnPlayerName( playerid ), g_levelData[ _: level ] [ E_NAME ], next_rank );
if ( !IsPlayerUsingRadio( playerid ) ) PlayAudioStreamForPlayer( playerid, "http://files.sfcnr.com/game_sounds/levelup.mp3" ); if ( !IsPlayerUsingRadio( playerid ) ) PlayAudioStreamForPlayer( playerid, "http://files.sfcnr.com/game_sounds/levelup.mp3" );
} }
@ -195,11 +198,10 @@ stock GivePlayerExperience( playerid, E_LEVELS: level, Float: default_xp = 1.0,
// save to database // save to database
format( format(
szBigString, sizeof( szBigString ), szBigString, sizeof( szBigString ),
"INSERT INTO `USER_LEVELS` (`USER_ID`,`LEVEL_ID`,`EXPERIENCE`) VALUES(%d,%d,%d) ON DUPLICATE KEY UPDATE `EXPERIENCE`=%d", "INSERT INTO `USER_LEVELS` (`USER_ID`,`LEVEL_ID`,`EXPERIENCE`) VALUES(%d,%d,%f) ON DUPLICATE KEY UPDATE `EXPERIENCE`=%f",
GetPlayerAccountID( playerid ), _: level, g_playerExperience[ playerid ] [ level ], g_playerExperience[ playerid ] [ level ] GetPlayerAccountID( playerid ), _: level, g_playerExperience[ playerid ] [ level ], g_playerExperience[ playerid ] [ level ]
); );
mysql_single_query( szBigString ); return mysql_single_query( szBigString ), 1;
return 1;
} }
function Experience_HideIncrementTD( playerid ) { function Experience_HideIncrementTD( playerid ) {

View File

@ -16,7 +16,7 @@
#pragma option -d3 #pragma option -d3
#pragma dynamic 7200000 #pragma dynamic 7200000
// #define DEBUG_MODE //#define DEBUG_MODE
#if defined DEBUG_MODE #if defined DEBUG_MODE
#pragma option -d3 #pragma option -d3
@ -2189,7 +2189,7 @@ public OnGameModeInit()
mysql_function_query( dbHandle, "UPDATE USERS SET VIP_PACKAGE=0, VIP_EXPIRE=0 WHERE UNIX_TIMESTAMP() > VIP_EXPIRE AND VIP_EXPIRE != 0", true, "onRemoveInactiveRows", "d", 1 ); mysql_function_query( dbHandle, "UPDATE USERS SET VIP_PACKAGE=0, VIP_EXPIRE=0 WHERE UNIX_TIMESTAMP() > VIP_EXPIRE AND VIP_EXPIRE != 0", true, "onRemoveInactiveRows", "d", 1 );
// Truncate accounts older than 2 months // Truncate accounts older than 2 months
mysql_function_query( dbHandle, "UPDATE USERS SET CASH=0,BANKMONEY=0,COINS=0.0 WHERE UNIX_TIMESTAMP()-`LASTLOGGED`>5259487", true, "onRemoveInactiveRows", "d", 2 ); mysql_function_query( dbHandle, "UPDATE USERS SET CASH=0,BANKMONEY=0,COINS=0.0,XP=0 WHERE UNIX_TIMESTAMP()-`LASTLOGGED`>5259487", true, "onRemoveInactiveRows", "d", 2 );
// Remove inactive homes older than 2 weeks // Remove inactive homes older than 2 weeks
mysql_function_query( dbHandle, "DELETE a2,a3 FROM `USERS` a1 " \ mysql_function_query( dbHandle, "DELETE a2,a3 FROM `USERS` a1 " \
@ -6953,7 +6953,7 @@ CMD:robitems( playerid, params[ ] )
SetPVarInt( playerid, "robitems_timestamp", g_iTime + 60 ); SetPVarInt( playerid, "robitems_timestamp", g_iTime + 60 );
GivePlayerWantedLevel( playerid, 4 ); GivePlayerWantedLevel( playerid, 4 );
GivePlayerScore( playerid, 1 ); GivePlayerScore( playerid, 1 );
GivePlayerExperience( playerid, E_ROBBERY, 0.5 ); GivePlayerExperience( playerid, E_ROBBERY );
new new
available_items[ 3 ] = { -1, -1, -1 }, available_items[ 3 ] = { -1, -1, -1 },
@ -8233,11 +8233,11 @@ thread OnPlayerWeeklyTime( playerid, irc, player[ ] )
return 1; return 1;
} }
CMD:xpmarket( playerid, params[ ] ) CMD:xpmarket( playerid, params[ ] ) return SendServerMessage( playerid, "You can no longer sell your experience anymore." );
{ /*{
ShowPlayerDialog( playerid, DIALOG_XPMARKET, DIALOG_STYLE_INPUT, "{FFFFFF}XP Market", sprintf( ""COL_WHITE"You have %s legacy XP. Current exchange rate is $10 per XP.\n\nHow many would you like to exchange?", number_format( p_XP[ playerid ] ) ), "Select", "Cancel"); ShowPlayerDialog( playerid, DIALOG_XPMARKET, DIALOG_STYLE_INPUT, "{FFFFFF}XP Market", sprintf( ""COL_WHITE"You have %s legacy XP. Current exchange rate is $10 per XP.\n\nHow many would you like to exchange?", number_format( p_XP[ playerid ] ) ), "Select", "Cancel");
return 1; return 1;
} }*/
CMD:emp( playerid, params[ ] ) CMD:emp( playerid, params[ ] )
{ {
@ -12171,7 +12171,7 @@ public OnPlayerPickUpDynamicPickup( playerid, pickupid )
GivePlayerWantedLevel( playerid, 4 ); GivePlayerWantedLevel( playerid, 4 );
GivePlayerScore( playerid, 1 ); GivePlayerScore( playerid, 1 );
GivePlayerExperience( playerid, E_ROBBERY ); GivePlayerExperience( playerid, E_ROBBERY, 0.67 );
GetPlayerPos ( playerid, X, Y, Z ); GetPlayerPos ( playerid, X, Y, Z );
Get2DCity ( szCity, X, Y, Z ); Get2DCity ( szCity, X, Y, Z );
@ -14487,7 +14487,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
} }
else ShowPlayerShopMenu( playerid ); else ShowPlayerShopMenu( playerid );
} }
if ( ( dialogid == DIALOG_XPMARKET ) && response ) /*if ( ( dialogid == DIALOG_XPMARKET ) && response )
{ {
if ( !strlen( inputtext ) || !IsNumeric( inputtext ) ) if ( !strlen( inputtext ) || !IsNumeric( inputtext ) )
return SendError( playerid, "The input you have entered is invalid, must be a numeric with over 0 characters." ), cmd_xpmarket( playerid, "" ), 1; return SendError( playerid, "The input you have entered is invalid, must be a numeric with over 0 characters." ), cmd_xpmarket( playerid, "" ), 1;
@ -14499,7 +14499,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
GivePlayerCash( playerid, strval( inputtext ) * EXCHANGE_XPCASH ); GivePlayerCash( playerid, strval( inputtext ) * EXCHANGE_XPCASH );
printf( "[xpmarket] %s -> %s", ReturnPlayerName( playerid ), cash_format( strval( inputtext ) * EXCHANGE_XPCASH ) ); // 8hska7082bmahu printf( "[xpmarket] %s -> %s", ReturnPlayerName( playerid ), cash_format( strval( inputtext ) * EXCHANGE_XPCASH ) ); // 8hska7082bmahu
SendServerMessage( playerid, "You have successfully exchanged %d XP for %s dollars.", strval( inputtext ), cash_format( strval( inputtext ) * EXCHANGE_XPCASH ) ); SendServerMessage( playerid, "You have successfully exchanged %d XP for %s dollars.", strval( inputtext ), cash_format( strval( inputtext ) * EXCHANGE_XPCASH ) );
} }*/
if ( ( dialogid == DIALOG_VIP_LOCKER ) && response ) if ( ( dialogid == DIALOG_VIP_LOCKER ) && response )
{ {
if ( IsPlayerJailed( playerid ) ) return SendError( playerid, "You cannot use this while you're in jail." ); if ( IsPlayerJailed( playerid ) ) return SendError( playerid, "You cannot use this while you're in jail." );
@ -18007,7 +18007,7 @@ stock SetPlayerColorToTeam( playerid )
return 1; return 1;
} }
stock GivePlayerXP_Legacy( playerid, amount ) /*stock GivePlayerXP_Legacy( playerid, amount )
{ {
if ( p_PlayerLogged{ playerid } == true ) if ( p_PlayerLogged{ playerid } == true )
{ {
@ -18026,7 +18026,7 @@ stock GivePlayerXP_Legacy( playerid, amount )
return 1; return 1;
} }
return 0; return 0;
} }*/
stock IsPlayerFBI( playerid ) stock IsPlayerFBI( playerid )
{ {