Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Dekaron > Dekaron Private Server
You last visited: Today at 00:51

  • Please register to post and access all features, it's quick, easy and FREE!


[Question]Removing amount of coins

Discussion on [Question]Removing amount of coins within the Dekaron Private Server forum part of the Dekaron category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2008
Posts: 863
Received Thanks: 197
[Question]Removing amount of coins

Hi I want to ask what need to change in script that we have to add coins that I could remove exact amount of coins not doing it manually in SQL

This is the script to add coins :
Code:
<?php

require_once "config.inc.php";


if(isset($_SESSION[step2]) && isset($_POST[step2])) {
    //注册的最后一步
    $errorStr = formStep3();
    if($errorStr!=null){
        require_once('cash.html');
    }else{
        $success="成功给帐号:$_POST[user_id]加入商城点$_POST[cash]点";
		require_once('success.html');
		unset($_SESSION[step2], $_SESSION[step1]);
    }}
else {
    //注册的第二步
    require_once('cash.html');
    $_SESSION[step2] = 1;	}
	

function formStep3(){
    $errors = array();
    $errorStr = null;
	
//查询用户名是否存在
	$strSql1="select * from account.dbo.user_profile where user_id='$_POST[user_id]'";
    $account_odbc = odbc_connect('account','username','password'); 
    $user_result=odbc_do($account_odbc,$strSql1);
    odbc_fetch_row($user_result);
	$user_no=odbc_result($user_result,1);
	odbc_close($account_odbc);
    if ( $user_no== null)  $errors[] = "无此玩家!";
    if(!preg_match("/^[0-9]{1,12}$/i",$_POST[cash])) $errors[]="商城点只能为数字,最少为1位";
	$strSql2="select * from cash.dbo.user_cash where user_no='$user_no'";
    $cash_odbc = odbc_connect('account','username','password'); 
    $user_cash_result=odbc_do($cash_odbc,$strSql2);
    odbc_fetch_row($user_cash_result);
	$cash_id=odbc_result($user_cash_result,1);
	$user_cash=odbc_result($user_cash_result,4);
	odbc_close($cash_odbc);
    if ($cash_id== null)  $errors[] = "$user_no 此玩家从来没有打开过商城!";
    if (strlen($_POST[cash])<1) $errors[]="请输入增加的商城点数";
    if(sizeof($errors)>0){
       $errorStr .= "<br><font>";
       $errorStr .= "信息输入错误:";
       foreach($errors as $error)
               $errorStr .= "<li>$error</li>";
       $errorStr .= "</font><br><br>";
    }else{

    $cash_query="update cash.dbo.user_cash set amount=amount+$_POST[cash] where user_no='$user_no'";
    $dk_cash_odbc = odbc_connect('account','username','password'); 
    $dk_cash_result=odbc_do($dk_cash_odbc,$cash_query);
	odbc_close($dk_cash_odbc);
    }
    return $errorStr;

}

?>
So what must be changed to remove coins not to add?

Thanks if some1 will help



gedimazs is offline  
Old 06/11/2009, 21:06   #2
 
elite*gold: 20
Join Date: Nov 2007
Posts: 2,853
Received Thanks: 1,871
does it need to be a job in mssql ?


janvier123 is offline  
Old 06/11/2009, 21:27   #3
 
elite*gold: 0
Join Date: May 2008
Posts: 863
Received Thanks: 197
Quote:
Originally Posted by janvier123 View Post
does it need to be a job in mssql ?
No it must be the same system as add cash using browser by entering players username then ammount of coins and pushing the button ADD COINS. But I want that I could remove some coins like you bought something from Dshop and it is automatically removing ammount of coins. So I need a web script to do so.

Example: I have added 1000 coins to player X (with that script I have posted before) and then that player says that he wants RB wich cost 1000 coins. So now I'm doing it manually by searching that players user no. in account.dbo then going to cash.dbo find that user by his user no and taking from him 1000 and leaving him 0.
gedimazs is offline  
Old 06/11/2009, 22:05   #4
 
elite*gold: 0
Join Date: Jan 2009
Posts: 614
Received Thanks: 151
Its a simple matter of editing these lines:

$cash_query="update cash.dbo.user_cash set amount=amount+$_POST[cash] where user_no='$user_no'";
$dk_cash_odbc = odbc_connect('account','username','password');
$dk_cash_result=odbc_do($dk_cash_odbc,$cash_query) ;

$cash_query sets the amount of coins to $_POST[cash], to create that varible a form is sumitted to this function with one of the inputs having a name of 'cash'.

So here is a little form that should work, without any error checking at all and absolutly no validation

<form action=<?=$_SERVER[PHP_SELF]?> method='post'>
Coins amount:<input type='text' name='coins'><br />
User ID to change coins:<input type='text' name='userid'>
<input type='submit' value='Change Coins'>
</form>

When that form is submitted, you have to do a check on the database:

if(isset($_POST['cash'])) { // If a form is sumbitted with a cash variable
$user_no=$_POST['userid'];

$cash_query="update cash.dbo.user_cash set amount=amount+$_POST[cash] where user_no='$user_no'";
$dk_cash_odbc = odbc_connect('account','username','password');
$dk_cash_result=odbc_do($dk_cash_odbc,$cash_query) ;

}

Judging by my rough skills, this should work. However, to do this automatically, you get to create a function like subtractCoins(userid, amount);

In that function you call it with a userid (which you must already have) and an integer for amount. It would simplify it so much if you just did this the normal way though. Im not quite sure how this would even work in game, the game doesnt pass a userid or anything to a web server that you could parse into data to use this.... You could make a web store? That would be nifty

Well, I hope I helped, feel free to PM me any questions.


-8gX is offline  
Old 06/12/2009, 09:11   #5
 
elite*gold: 0
Join Date: May 2008
Posts: 863
Received Thanks: 197
Did not helped or I did something wrong. Any new ideas?
gedimazs is offline  
Old 06/12/2009, 09:27   #6
 
elite*gold: 20
Join Date: Dec 2007
Posts: 1,450
Received Thanks: 824
I am good with sql, but I would say try replacing
$cash_query="update cash.dbo.user_cash set amount=amount+$_POST[cash] where user_no='$user_no'";

with
$cash_query="update cash.dbo.user_cash set amount=amount-$_POST[cash] where user_no='$user_no'";


I am just guesing. Not too good with sql. Go and try =)
Zombe is offline  
Old 06/12/2009, 09:57   #7
 
elite*gold: 0
Join Date: May 2008
Posts: 863
Received Thanks: 197
Quote:
Originally Posted by Zombe View Post
I am good with sql, but I would say try replacing
$cash_query="update cash.dbo.user_cash set amount=amount+$_POST[cash] where user_no='$user_no'";

with
$cash_query="update cash.dbo.user_cash set amount=amount-$_POST[cash] where user_no='$user_no'";


I am just guesing. Not too good with sql. Go and try =)
Already tried that Not working. still adding not removing coins
gedimazs is offline  
Old 06/12/2009, 15:10   #8
 
elite*gold: 20
Join Date: Nov 2007
Posts: 2,853
Received Thanks: 1,871

try this one
it works for me
try to install it and login (as gm)
janvier123 is offline  
Thanks
1 User
Old 06/12/2009, 15:32   #9
 
elite*gold: 0
Join Date: May 2008
Posts: 863
Received Thanks: 197
Not working proparly to me

I can login successful


But when I choose something for example Give/take coins I get this:



Have tried thousand times and everytime the same


edited: Nvm I'm doing it manualy entering whole addres that I need and decreasing coins working thx
gedimazs is offline  
Old 06/12/2009, 16:38   #10
 
elite*gold: 0
Join Date: May 2008
Posts: 863
Received Thanks: 197
edited: Everything solved
gedimazs is offline  
Old 06/12/2009, 18:43   #11
 
elite*gold: 20
Join Date: Nov 2007
Posts: 2,853
Received Thanks: 1,871
remove the index.php and use the files in /controlpanel
remove that error message and the code that controls it
janvier123 is offline  
Old 06/12/2009, 18:54   #12
 
elite*gold: 0
Join Date: May 2008
Posts: 863
Received Thanks: 197
Everything is working now, thx for the help guys.

Close this post please


gedimazs is offline  
Thanks
1 User
Reply



« [Help]Unpacking Dat.pak File | any1 can upload sx client? »

Similar Threads
[QUESTION] Plugins that must have in Removing DC Flags?
09/04/2009 - Cabal Online - 1 Replies
Sir/Ma'am what are the plugins that we must download in removing the dc flags? thanks
just a question about coins
08/20/2009 - Dekaron Private Server - 5 Replies
anyone know how to send all the accounts made in the database a certant amount of coins but it doesnt automatically top the coins up once they use them.
[hmm? question] removing item lock, client side.
07/21/2009 - CO2 Private Server - 10 Replies
any idea where i'd have to do this? and also how? I hate this, it mainly takes all fun out of pking anymore.. TQ was stupid to implement it. I wanna revert to many older features.. beginning with this :D anyone gotsa idea on this?
Question on removing/adding bytes to Data.pak
02/20/2009 - Dekaron - 0 Replies
I have a problem with the data.pak for dekaron extreme every time i add a byte it works,but when i remove one all it does is load for 2 minutes without doing a single thing. It also freezes when put it in default edit mode Anyone know what might be the problem? Without it I am extremely limited to my hacking
Removing effects - Question
01/12/2009 - Conquer Online 2 - 5 Replies
can someone tell me how it is possible for me to remove as many special effects from CO as possible while still keeping the game playable? please give me a list of things you know works, ty



All times are GMT +2. The time now is 00:51.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

BTC: 33E6kMtxYa7dApCFzrS3Jb7U3NrVvo8nsK
ETH: 0xc6ec801B7563A4376751F33b0573308aDa611E05

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2019 elitepvpers All Rights Reserved.