show % of month funding at the top
This commit is contained in:
parent
654695e4fd
commit
7ee91d8e6d
@ -26,6 +26,9 @@ enum E_DONATION_DATA
|
|||||||
E_DATE
|
E_DATE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const
|
||||||
|
Float: DONATION_GOAL_AMOUNT = 250.0; // $250.00 USD/month goal
|
||||||
|
|
||||||
static stock g_redeemVipWait = 0;
|
static stock g_redeemVipWait = 0;
|
||||||
static stock g_TopDonorWall = INVALID_OBJECT_ID;
|
static stock g_TopDonorWall = INVALID_OBJECT_ID;
|
||||||
stock Text: g_TopDonorTD = Text: INVALID_TEXT_DRAW;
|
stock Text: g_TopDonorTD = Text: INVALID_TEXT_DRAW;
|
||||||
@ -50,9 +53,15 @@ hook OnScriptInit( )
|
|||||||
TextDrawSetOutline(g_TopDonorTD, 1);
|
TextDrawSetOutline(g_TopDonorTD, 1);
|
||||||
TextDrawSetProportional(g_TopDonorTD, 1);
|
TextDrawSetProportional(g_TopDonorTD, 1);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnServerUpdate( )
|
||||||
|
{
|
||||||
|
|
||||||
/* ** Update Donation TD ** */
|
/* ** Update Donation TD ** */
|
||||||
UpdateGlobalDonated( );
|
UpdateGlobalDonated( );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||||
@ -191,29 +200,37 @@ thread OnCheckForRedeemedVIP( playerid, data[ ] )
|
|||||||
thread OnGrabLatestDonor( hidden )
|
thread OnGrabLatestDonor( hidden )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
rows;
|
rows = cache_get_row_count( );
|
||||||
|
|
||||||
cache_get_data( rows, tmpVariable );
|
printf( "Rows %d", rows );
|
||||||
|
|
||||||
if ( rows )
|
if ( rows )
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
szName[ MAX_PLAYER_NAME ],
|
szName[ MAX_PLAYER_NAME ];
|
||||||
Float: fAmount;
|
|
||||||
|
|
||||||
|
|
||||||
cache_get_field_content( 0, "NAME", szName );
|
cache_get_field_content( 0, "NAME", szName );
|
||||||
fAmount = cache_get_field_content_float( 0, "LAST_AMOUNT", dbHandle );
|
|
||||||
|
|
||||||
// Play song!
|
new Float: last_donation = cache_get_field_content_float( 0, "LAST_AMOUNT", dbHandle );
|
||||||
GameTextForAll( sprintf( "~y~~h~~h~New Donor!~n~~w~%s", szName ), 6000, 3 );
|
new Float: total_donations = cache_get_field_content_float( 0, "TOTAL_DONATIONS", dbHandle );
|
||||||
|
new Float: funding_goal_percent = total_donations / DONATION_GOAL_AMOUNT * 100.0;
|
||||||
|
|
||||||
// Play sound
|
// Prevents total revenue for the month being disclosed mathematically
|
||||||
foreach(new p : Player) if ( !IsPlayerUsingRadio( p ) ) {
|
if ( funding_goal_percent >= 100.0 ) {
|
||||||
PlayAudioStreamForPlayer( p, "http://files.sfcnr.com/game_sounds/donated.mp3" );
|
TextDrawSetString( g_TopDonorTD, sprintf( "Latest Donor %s - $%0.2f, ~g~Month Is Fully %0.2f%% Funded!", szName, last_donation, 100.0 ) );
|
||||||
|
} else {
|
||||||
|
TextDrawSetString( g_TopDonorTD, sprintf( "Latest Donor %s - $%0.2f, ~r~Month Is Only %0.2f%% Funded!", szName, last_donation, funding_goal_percent ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TextDrawSetString( g_TopDonorTD, sprintf( "Le Latest Donor %s - $%0.2f", szName, fAmount ) );
|
// Play song!
|
||||||
|
if ( ! hidden ) {
|
||||||
|
GameTextForAll( sprintf( "~y~~h~~h~New Donor!~n~~w~%s", szName ), 6000, 3 );
|
||||||
|
|
||||||
|
// Play sound
|
||||||
|
foreach(new p : Player) if ( !IsPlayerUsingRadio( p ) ) {
|
||||||
|
PlayAudioStreamForPlayer( p, "http://files.sfcnr.com/game_sounds/donated.mp3" );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -310,9 +327,7 @@ static stock UpdateGlobalDonated( playerid = INVALID_PLAYER_ID, Float: amount =
|
|||||||
}
|
}
|
||||||
|
|
||||||
// top donor
|
// top donor
|
||||||
if ( ! hidden ) {
|
mysql_tquery( dbHandle, "SELECT `NAME`,`LAST_AMOUNT`,(SELECT SUM(`AMOUNT`) FROM `TOP_DONOR`) AS `TOTAL_DONATIONS` FROM `TOP_DONOR` LEFT JOIN `USERS` ON `TOP_DONOR`.`USER_ID`=`USERS`.`ID` WHERE `LAST_AMOUNT` > 0 AND `HIDE` < 1 ORDER BY `TIME` DESC LIMIT 1", "OnGrabLatestDonor", "d", hidden );
|
||||||
mysql_tquery( dbHandle, "SELECT `NAME`,`LAST_AMOUNT` FROM `TOP_DONOR` INNER JOIN `USERS` ON `TOP_DONOR`.`USER_ID`=`USERS`.`ID` WHERE `LAST_AMOUNT` > 0 AND `HIDE` < 1 ORDER BY `TIME` DESC LIMIT 1", "OnGrabLatestDonor", "" );
|
|
||||||
}
|
|
||||||
|
|
||||||
// wall of donors
|
// wall of donors
|
||||||
mysql_tquery( dbHandle, "SELECT `USERS`.`NAME` FROM `TOP_DONOR` INNER JOIN `USERS` ON `TOP_DONOR`.`USER_ID`=`USERS`.`ID` WHERE `HIDE` < 1 ORDER BY `AMOUNT` DESC, `TIME` DESC", "OnUpdateWallOfDonors", "" );
|
mysql_tquery( dbHandle, "SELECT `USERS`.`NAME` FROM `TOP_DONOR` INNER JOIN `USERS` ON `TOP_DONOR`.`USER_ID`=`USERS`.`ID` WHERE `HIDE` < 1 ORDER BY `AMOUNT` DESC, `TIME` DESC", "OnUpdateWallOfDonors", "" );
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
#define SERVER_MODE_TEXT "Cops And Robbers / DM / Gangs"
|
#define SERVER_MODE_TEXT "Cops And Robbers / DM / Gangs"
|
||||||
#define SERVER_MAP "San Fierro"
|
#define SERVER_MAP "San Fierro"
|
||||||
#define SERVER_LANGUAGE "English"
|
#define SERVER_LANGUAGE "English"
|
||||||
|
|
||||||
#define SERVER_WEBSITE "www.sfcnr.com"
|
#define SERVER_WEBSITE "www.sfcnr.com"
|
||||||
#define SERVER_IP "54.36.127.43:7777"
|
#define SERVER_IP "54.36.127.43:7777"
|
||||||
|
|
||||||
#define SERVER_TWITTER "IrresistibleDev"
|
#define SERVER_TWITTER "IrresistibleDev"
|
||||||
|
|
||||||
/* ** Comment line to disable feature ** */
|
/* ** Comment line to disable feature ** */
|
||||||
|
Loading…
Reference in New Issue
Block a user