#cashpoints on Herc Fluxcp ?

rituel

New member
Messages
11
Points
0
Age
36
Location
Paris
Emulator
Hello to all. 
 
Is it possible to use #CASHPOINTS during a donation on FluxCP ?
It exist a paying patch on rathena but not functional for hercules.  
default_sad.png

 
I have not found anything about Hercules.
 
Cordialy.
 
Last edited by a moderator:
hi good ... I've tried to put pro have no knowledge even more believe it is possible ... yes

 
An alternative is to just insert an item and sell that in the cash shop that can either be consumed or turned in to an NPC for Cash Points. Alternatively, and with a bit of adjusting of the default rewards NPC code, it would be possible to make it not give a physical item to the player when redeeming if the ID of the reward(s) match the ID of a specific item sold on the panel and just adjust cash points accordingly. Just an idea.
default_smile.png


 
Hello to you. 
Today I'm stuck on this part:
 
public function hasCreditsRecord($accountID) { $creditsTable = Flux::config('FluxTables.CreditsTable'); $sql = "SELECT COUNT(account_id) AS hasRecord FROM {$this->charMapDatabase}.`acc_reg_num_db` where `account_id` = ? and `key` = '#CASHPOINTS'"; $sth = $this->connection->getStatement($sql); $sth->execute(array($accountID)); if ($sth->fetch()->hasRecord) { return true; } else { return false; } } /** * */ public function depositCredits($targetAccountID, $credits, $donationAmount = null) { $sql = "SELECT COUNT(account_id) AS accountExists FROM {$this->loginDatabase}.login WHERE account_id = ?"; $sth = $this->connection->getStatement($sql); if (!$sth->execute(array($targetAccountID)) || !$sth->fetch()->accountExists) { return false; // Account doesn't exist. } $creditsTable = Flux::config('FluxTables.CreditsTable'); if (!$this->hasCreditsRecord($targetAccountID)) { $fields = 'account_id, balance'; $values = '?, ?'; /*if (!is_null($donationAmount)) { $fields .= ', last_donation_date, last_donation_amount'; $values .= ', NOW(), ?'; }*/ $sql = "INSERT INTO {$this->loginDatabase}.$creditsTable ($fields) VALUES ($values)"; $sth = $this->connection->getStatement($sql); $vals = array($targetAccountID, $credits); /*if (!is_null($donationAmount)) { $vals[] = $donationAmount; }*/ return $sth->execute($vals); } else { $vals = array(); $sql = "UPDATE {$this->loginDatabase}.$creditsTable SET balance = balance + ? "; /*if (!is_null($donationAmount)) { $sql .= ", last_donation_date = NOW(), last_donation_amount = ? "; }*/ $vals[] = $credits; /*if (!is_null($donationAmount)) { $vals[] = $donationAmount; }*/ $vals[] = $targetAccountID; $sql .= "WHERE account_id = ?"; $sth = $this->connection->getStatement($sql); return $sth->execute($vals); } }
This part, update or insert the crédtis in "cp_credits" table.
So to be on, I modified like this to write (insert into) fix values and see if it was well written.



Code:
			$sql  = "INSERT INTO {$this->loginDatabase}.$creditsTable ($fields) VALUES ($values)";			$sth  = $this->connection->getStatement($sql);			$vals = array(999, 999);
Result after credits transfert on the website:

1404818920-sans-titre.png


Now I change that (INSERT INTO & UPDATE) works (normally) in "acc_reg_num_db" table with the variable (# CASHPOINTS) 

public function hasCreditsRecord($accountID) { $creditsTable = Flux::config('FluxTables.CreditsTable'); $sql = "SELECT COUNT(account_id) AS hasRecord FROM {$this->charMapDatabase}.`acc_reg_num_db` where `account_id` = ? and `key` = '#CASHPOINTS'"; $sth = $this->connection->getStatement($sql); $sth->execute(array($accountID)); if ($sth->fetch()->hasRecord) { return true; } else { return false; } } /** * */ public function depositCredits($targetAccountID, $credits, $donationAmount = null) { $sql = "SELECT COUNT(account_id) AS accountExists FROM {$this->loginDatabase}.login WHERE account_id = ?"; $sth = $this->connection->getStatement($sql); if (!$sth->execute(array($targetAccountID)) || !$sth->fetch()->accountExists) { return false; // Account doesn't exist. } $creditsTable = Flux::config('FluxTables.CreditsTable'); if (!$this->hasCreditsRecord($targetAccountID)) { $fields = 'account_id, key, index, value'; $values = '?, ?, ?, ?'; /*if (!is_null($donationAmount)) { $fields .= ', last_donation_date, last_donation_amount'; $values .= ', NOW(), ?'; }*/ $sql = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` ($fields) VALUES ($values)"; $sth = $this->connection->getStatement($sql); $vals = array($targetAccountID, '#CASHPOINTS', 0, $credits); /*if (!is_null($donationAmount)) { $vals[] = $donationAmount; }*/ return $sth->execute($vals); } else { $vals = array(); $sql = "UPDATE {$this->charMapDatabase}.`acc_reg_num_db` SET value = value + ? "; /*if (!is_null($donationAmount)) { $sql .= ", last_donation_date = NOW(), last_donation_amount = ? "; }*/ $vals[] = $credits; /*if (!is_null($donationAmount)) { $vals[] = $donationAmount; }*/ $vals[] = $targetAccountID; $sql .= "WHERE account_id = ? and `key` = '#CASHPOINTS'"; $sth = $this->connection->getStatement($sql); return $sth->execute($vals); } }

Voila. Now try a tranferst on a player already possessing #CASHPOINTS in "acc_reg_num_db" table [uPDATE].

1404820062-sans-titre.png


1404820213-sans-titre.png


Result ?

1404820306-sans-titre.png


Finally, try transferring to a player who has not yet #CASHPOINTS in "acc_reg_num_db" table [iNSER INTO].

We will call "Fiotass" that exists in the table "char" and his account in "login" under the accound_id "2000008"

1404820933-sans-titre.png


Result ?

1404820998-sans-titre.png


I've been here yesterday but I did not find my error. 

 
Last edited by a moderator:
tried something like?

Code:
public function depositCredits($targetAccountID, $credits, $donationAmount = null)	{		$sql = "SELECT COUNT(account_id) AS accountExists FROM {$this->loginDatabase}.login WHERE account_id = ?";		$sth = $this->connection->getStatement($sql);				if (!$sth->execute(array($targetAccountID)) || !$sth->fetch()->accountExists) {			return false; // Account doesn't exist.		}				$creditsTable = Flux::config('FluxTables.CreditsTable');				$fields = 'account_id, key, index, value';		$values = '?, ?, ?, ?';				/*if (!is_null($donationAmount)) {			$fields .= ', last_donation_date, last_donation_amount';			$values .= ', NOW(), ?';		}*/				$sql  = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` ($fields) VALUES ($values) ON DUPLICATE KEY UPDATE `value`=`value`+?";		$sth  = $this->connection->getStatement($sql);		$vals = array($targetAccountID, '#CASHPOINTS', 0, $credits, $credits);				/*if (!is_null($donationAmount)) {			$vals[] = $donationAmount;		}*/				return $sth->execute($vals);	}
 
Hi

/fluxcp/lib/Flux/LoginServer.php

Unexpected error occurred.

Again and again 
default_ph34r.png


Work: (UPDATE):

else { $vals = array(); $sql = "UPDATE {$this->charMapDatabase}.`acc_reg_num_db` SET value = value + ? "; /*if (!is_null($donationAmount)) { $sql .= ", last_donation_date = NOW(), last_donation_amount = ? "; }*/ $vals[] = $credits; /*if (!is_null($donationAmount)) { $vals[] = $donationAmount; }*/ $vals[] = $targetAccountID; $sql .= "WHERE account_id = ? and `key` = '#CASHPOINTS'"; $sth = $this->connection->getStatement($sql); return $sth->execute($vals); } }
Not Work: (INSERT INTO):

if (!$this->hasCreditsRecord($targetAccountID)) { $fields = 'account_id, key, index, value'; $values = '?, ?, ?, ?'; /*if (!is_null($donationAmount)) { $fields .= ', last_donation_date, last_donation_amount'; $values .= ', NOW(), ?'; }*/ $sql = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` ($fields) VALUES ($values)ON DUPLICATE KEY UPDATE `value`=`value`+?"; $sth = $this->connection->getStatement($sql); $vals = array($targetAccountID, '#CASHPOINTS', 0, $credits); /*if (!is_null($donationAmount)) { $vals[] = $donationAmount; }*/ return $sth->execute($vals); }

Not Work: (INSERT INTO & UPDATE):

Code:
public function depositCredits($targetAccountID, $credits, $donationAmount = null)	{		$sql = "SELECT COUNT(account_id) AS accountExists FROM {$this->loginDatabase}.login WHERE account_id = ?";		$sth = $this->connection->getStatement($sql);				if (!$sth->execute(array($targetAccountID)) || !$sth->fetch()->accountExists) {			return false; // Account doesn't exist.		}				$creditsTable = Flux::config('FluxTables.CreditsTable');				$fields = 'account_id, key, index, value';		$values = '?, ?, ?, ?';				/*if (!is_null($donationAmount)) {			$fields .= ', last_donation_date, last_donation_amount';			$values .= ', NOW(), ?';		}*/				$sql  = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` ($fields) VALUES ($values) ON DUPLICATE KEY UPDATE `value`=`value`+?";		$sth  = $this->connection->getStatement($sql);		$vals = array($targetAccountID, '#CASHPOINTS', 0, $credits, $credits);				/*if (!is_null($donationAmount)) {			$vals[] = $donationAmount;		}*/				return $sth->execute($vals);	}
 
Last edited by a moderator:
if (!$this->hasCreditsRecord($targetAccountID)) { $sql = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` (`account_id`, `key`, `index`, `value`) VALUES (?,'#CASHPOINTS',0,?) ON DUPLICATE KEY UPDATE `value`=`value`+?"; $sth = $this->connection->getStatement($sql); $vals = array($targetAccountID, $credits,$credits); return $sth->execute($vals); }
Works fine for me... well for the exact error, enable the error reporting from config/error.php :

Change

$showExceptions = false;  

to

Code:
$showExceptions = true;  
 
Thanks 
default_biggrin.png


I have also been able to find my mistake.

Not work:

if (!$this->hasCreditsRecord($targetAccountID)) { $fields = $fields = 'account_id, key, index, value'; $values = '?, ?, ?, ?'; /*if (!is_null($donationAmount)) { $fields .= ', last_donation_date, last_donation_amount'; $values .= ', NOW(), ?'; }*/ $sql = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` ($fields) VALUES ($values)"; $sth = $this->connection->getStatement($sql); $vals = array($targetAccountID, '#CASHPOINTS', 0, $credits); /*if (!is_null($donationAmount)) { $vals[] = $donationAmount; }*/ return $sth->execute($vals); }

Work!

Code:
		if (!$this->hasCreditsRecord($targetAccountID)) {			$fields = $fields = '`account_id`, `key`, `index`, `value`';			$values = '?, ?, ?, ?';						/*if (!is_null($donationAmount)) {				$fields .= ', last_donation_date, last_donation_amount';				$values .= ', NOW(), ?';			}*/						$sql  = "INSERT INTO {$this->charMapDatabase}.`acc_reg_num_db` ($fields) VALUES ($values)";			$sth  = $this->connection->getStatement($sql);			$vals = array($targetAccountID, '#CASHPOINTS', 0, $credits);						/*if (!is_null($donationAmount)) {				$vals[] = $donationAmount;			}*/						return $sth->execute($vals);		}
 
Another question:
 
Is there a way that cash shop tests with sandbox.paypal, credit my game account on my Fluxcp site?
What is complicated currently for testing .
 
Fix & Work 
default_p_idea.gif

 
 
With 0.01€
1404843943-sans-titre.png

 
Last edited by a moderator:
Hey rituel, can you post the files you modified to make it work?

I'm trying to figure it out right now and it would be really appreciated.

Thank you very much,

 
Back
Top