Newbie Spellweaver
- Joined
- Jan 9, 2012
- Messages
- 73
- Reaction score
- 0
Hey guys I'm trying to make a script where players above level 50 receives 5 gshop gold per hour played, so there won't be anyone creating new characters in order to get gold for free , so I thought that it could be even better if the players above level 100 got 10 cubi per hour.. so,
Players Level 50+ = 5 cubi per hour
Players Level 100+ = 10 cubi per hour
Well.. now the script part which is kinda hard, I suppose I need to have a crontab running on the
Virtual Machine at an interval of time. (example : every 1 hour).
So I think I would need to have the script .sh which runs the whole thing, and the script .php (configuration).. I tried to make the .php but i'm not sure if it's right.. so guys, I beg u for help, im about 1 month trying to do it myself.. I even bought some .php books that helped me a bit , but not enough :{
script .php
Thanks in advance.
Players Level 50+ = 5 cubi per hour
Players Level 100+ = 10 cubi per hour
Well.. now the script part which is kinda hard, I suppose I need to have a crontab running on the
Virtual Machine at an interval of time. (example : every 1 hour).
So I think I would need to have the script .sh which runs the whole thing, and the script .php (configuration).. I tried to make the .php but i'm not sure if it's right.. so guys, I beg u for help, im about 1 month trying to do it myself.. I even bought some .php books that helped me a bit , but not enough :{
script .php
PHP:
<?php
error_reporting(0);
include ('mymysqlsettings.php');
mysql_connect("$pwhost", "$pwuser", "$pwpass")or die("Connection failed");
mysql_select_db("$pwdb")or die("Database not exist");
$prepare_w = mysql_query("SELECT * FROM point WHERE zoneid IS NOT NULL") or die (mysql_error());
$top_num = 0;
$data = date("Y/m/d H:i:s");
$query_sn = mysql_query("SELECT sn FROM usecashnow");
$sn = mysql_num_rows($query_sn);
$sn = $sn * "-1";
if($sn <= 0) { $sn = $sn + "-1"; }
while($array = mysql_fetch_array($prepare_w)){
$id = $array["uid"];
$prepare_e = mysql_query("SELECT * FROM roles WHERE account_id = '$id' ORDER BY role_level DESC LIMIT 1") or die (mysql_error());
while($pegaLV = mysql_fetch_array($prepare_e)){
$level = $pegaLV['role_level'];
if($level >= 50){
$Amount = 500;
if($level >= 100){
$Amount = $Amount + "500";
$top_num = 0;
$top_num++;
$uweb = mysql_query("INSERT INTO usecashnow (userid, zoneid, sn, aid, point, cash, status, creatime) VALUES ('$id', '1', '$sn', '1', '0', '$Amount', '1', '$data')") or die (mysql_error());
$sn--;
}
}
}
}
echo "Total <?php
error_reporting(0);
include ('mymysqlsettings.php');
mysql_connect("$pwhost", "$pwuser", "$pwpass")or die("Connection failed");
mysql_select_db("$pwdb")or die("Database not exist");
$prepare_w = mysql_query("SELECT * FROM point WHERE zoneid IS NOT NULL") or die (mysql_error());
$top_num = 0;
$data = date("Y/m/d H:i:s");
$query_sn = mysql_query("SELECT sn FROM usecashnow");
$sn = mysql_num_rows($query_sn);
$sn = $sn * "-1";
if($sn <= 0) { $sn = $sn + "-1"; }
while($array = mysql_fetch_array($prepare_w)){
$id = $array["uid"];
$prepare_e = mysql_query("SELECT * FROM roles WHERE account_id = '$id' ORDER BY role_level DESC LIMIT 1") or die (mysql_error());
while($pegaLV = mysql_fetch_array($prepare_e)){
$level = $pegaLV['role_level'];
if($level >= 50){
$Amount = 500;
if($level >= 100){
$Amount = $Amount + "500";
$top_num = 0;
$top_num++;
$uweb = mysql_query("INSERT INTO usecashnow (userid, zoneid, sn, aid, point, cash, status, creatime) VALUES ('$id', '1', '$sn', '1', '0', '$Amount', '1', '$data')") or die (mysql_error());
$sn--;
}
}
}
}
echo "Total $top_num";
mysql_close($Link);
?>$top_num";
mysql_close($Link);
?>
Thanks in advance.