sprintf("SELECT CROWDFUND_PACKAGES.*, CROWDFUNDS.DESCRIPTION AS CF_DESCRIPTION FROM CROWDFUND_PACKAGES INNER JOIN CROWDFUNDS ON CROWDFUNDS.ID = CROWDFUND_PACKAGES.CROWDFUND_ID WHERE CROWDFUND_ID = %d ORDER BY REQUIRED_AMOUNT DESC",viewing_crowdfund),
sprintf("SELECT USERS.NAME, SUM(AMOUNT) AS TOTAL FROM CROWDFUND_PATREONS INNER JOIN USERS ON USERS.ID = CROWDFUND_PATREONS.USER_ID WHERE CROWDFUND_PATREONS.CROWDFUND_ID = %d GROUP BY CROWDFUND_PATREONS.USER_ID ORDER BY TOTAL DESC",viewing_crowdfund),
returnShowPlayerDialog(playerid,DIALOG_CROWDFUND_DONATE,DIALOG_STYLE_INPUT,""COL_GOLD"Feature Crowdfunding",""COL_WHITE"Please specify the amount of IC you wish to contribute:\n\n"COL_ORANGE"Warning: There is no confirmation dialog.","Contribute","Back");
returnSendError(playerid,"There was an error. Please attempt to contribute to the crowdfund again.");
}
new
Float:amount;
if(sscanf(inputtext,"f",amount)){
returnShowPlayerDialog(playerid,DIALOG_CROWDFUND_DONATE,DIALOG_STYLE_INPUT,""COL_GOLD"Feature Crowdfunding",""COL_WHITE"Please specify the amount of IC you wish to contribute:\n\n"COL_RED"Please specify a decimal number!","Contribute","Close");
}elseif(amount<10.0){
returnShowPlayerDialog(playerid,DIALOG_CROWDFUND_DONATE,DIALOG_STYLE_INPUT,""COL_GOLD"Feature Crowdfunding",""COL_WHITE"Please specify the amount of IC you wish to contribute:\n\n"COL_RED"The minimum amount you can contribute is 10.00 IC!","Contribute","Close");
returnShowPlayerDialog(playerid,DIALOG_CROWDFUND_DONATE,DIALOG_STYLE_INPUT,""COL_GOLD"Feature Crowdfunding",""COL_WHITE"Please specify the amount of IC you wish to contribute:\n\n"COL_RED"You do not have this many coins in your account!","Contribute","Close");
}else{
// check if expired/ended/valid before even submitting
mysql_tquery(dbHandle,sprintf("SELECT FEATURE, UNIX_TIMESTAMP(RELEASE_DATE) AS `RELEASE`, UNIX_TIMESTAMP(END_DATE) AS `END` FROM CROWDFUNDS WHERE ID = %d",viewing_crowdfund),"OnPlayerCrowdfundContribute","ddf",playerid,viewing_crowdfund,amount);
"SELECT CROWDFUNDS.ID, CROWDFUNDS.FEATURE, CROWDFUNDS.FUND_TARGET, SUM(CROWDFUND_PATREONS.AMOUNT) AS RAISED, UNIX_TIMESTAMP(RELEASE_DATE) AS RELASE, UNIX_TIMESTAMP(END_DATE) AS END FROM CROWDFUNDS "\
"LEFT JOIN CROWDFUND_PATREONS on CROWDFUNDS.ID = CROWDFUND_PATREONS.CROWDFUND_ID "\
"GROUP BY CROWDFUNDS.ID ORDER BY CROWDFUNDS.ID DESC LIMIT "# MAX_CROWDFUNDS,
SendError(playerid,"You can no longer contribute to this crowdfund as the contribution amount is invalid.");
returnShowPlayerCrowdfunds(playerid);
}
// get feature name
cache_get_field_content(0,"FEATURE",feature);
// notify and deduct ic
GivePlayerIrresistibleCoins(playerid,-amount);
SendClientMessageToAllFormatted(-1,""COL_GOLD"[CROWDFUND]"COL_WHITE" %s(%d) has donated %s IC to the %s Crowdfund! <3",ReturnPlayerName(playerid),playerid,number_format(amount,.prefix='\0',.decimals=2),feature);
SavePlayerData(playerid);// force save just incase
// insert into database
mysql_format(
dbHandle,szBigString,sizeof(szBigString),
"INSERT INTO CROWDFUND_PATREONS (USER_ID, CROWDFUND_ID, AMOUNT) VALUES (%d, %d, %f)",
GetPlayerAccountID(playerid),crowdfund_id,amount
);
mysql_single_query(szBigString);
return1;
}
else
{
returnSendError(playerid,"The crowdfund you are attempting to contribute to no longer exists.");
format(szHugeString,sizeof(szHugeString),"%s"COL_GOLD"%s (%s IC+)"COL_WHITE"\n%s"COL_GREY"... (read more on sfcnr.com)\n\n",szHugeString,title,number_format(req_amount,.prefix='\0',.decimals=2),description);