Online time cash
#1

Hello everyone.

Would anybody happen to have a script to add online time cash? (Specific amount after a specific time auto)

Thanks in advance!

#2

You should create a MariaDB event. You can easy manage from navicat

/monthly_2021_04/image.png.3e2d3a6f86045023acb2d1d661512696.png" />

By the way, this question has been already solved by Wizatek, you just need to search in the forum

#3

Well but is the question just normal online time cash OR rather X cash for being online for X minutes/hours?

#4

#!/bin/bash

host=localhost
user=root
pass=
auth_db=ep5_lcdbauth
user_db=ep5_lcdbauth
cash=30
date=`date +"%d-%m-%Y %H:%M"`
date2=`date -I`

#Cash-Script

select=`mysql -D $user_db -h $host --user=$user --password=$pass --skip-column-names -e "SELECT a_portal_index FROM t_users WHERE a_zone_num > -1"`

for online in ${select[@]}

do

setcash=`mysql -D $auth_db -h $host --user=$user --password=$pass --skip-column-names -e "UPDATE bg_user SET cash = cash +'$cash' WHERE user_code = '$online'"`

done

#Create a logfile to your specified path how much Accounts was online and how much cash was added.

path="/root/CashLog_$date2.txt"

echo -e "================================================= "$date" =================================================" >> $path

id=$(mysql -D $user_db -h $host --user=$user --password=$pass --skip-column-names -e "SELECT count(*) FROM t_users WHERE a_zone_num > -1")

amount=$(($id * $cash));

echo -e "" >> $path

echo -e "Accounts=$id
Cash=$amount" >> $path

select=`mysql -D $user_db -h $host --user=$user --password=$pass --skip-column-names -e "SELECT a_idname FROM t_users WHERE a_zone_num > -1"`
i=1
for online in ${select[@]}

do
echo -e "$i. Account = $online" >> $path
let i=$i+1
done

echo "Succesfully $amount Cash added distributed $id Accounts."

add to crontab event and its done

#5


2 hours ago, rondo157 said:





#!/bin/bash

host=localhost
user=root
pass=
auth_db=ep5_lcdbauth
user_db=ep5_lcdbauth
cash=30
date=`date +"%d-%m-%Y %H:%M"`
date2=`date -I`

#Cash-Script

select=`mysql -D $user_db -h $host --user=$user --password=$pass --skip-column-names -e "SELECT a_portal_index FROM t_users WHERE a_zone_num > -1"`

for online in ${select[@]}

do

setcash=`mysql -D $auth_db -h $host --user=$user --password=$pass --skip-column-names -e "UPDATE bg_user SET cash = cash +'$cash' WHERE user_code = '$online'"`

done

#Create a logfile to your specified path how much Accounts was online and how much cash was added.

path="/root/CashLog_$date2.txt"

echo -e "================================================= "$date" =================================================" >> $path

id=$(mysql -D $user_db -h $host --user=$user --password=$pass --skip-column-names -e "SELECT count(*) FROM t_users WHERE a_zone_num > -1")

amount=$(($id * $cash));

echo -e "" >> $path

echo -e "Accounts=$id
Cash=$amount" >> $path

select=`mysql -D $user_db -h $host --user=$user --password=$pass --skip-column-names -e "SELECT a_idname FROM t_users WHERE a_zone_num > -1"`
i=1
for online in ${select[@]}

do
echo -e "$i. Account = $online" >> $path
let i=$i+1
done

echo "Succesfully $amount Cash added distributed $id Accounts."


add to crontab event and its done




really nice bash skills! However, I guess the simplest way is to add it directly in the database event, as /index.php?/profile/2-wizatek/&do=hovercard" data-mentionid="2" href="/index.php?/profile/2-wizatek/" rel="">@Wizatek said. You can always check mysql in case of error

 

CREATE EVENT `OnlineCashAdd`

ON SCHEDULE

EVERY 5 MINUTE STARTS '2014-08-06 00:34:11'

ON COMPLETION PRESERVE

ENABLE

COMMENT ''

DO UPDATE newproject_auth.bg_user SET cash = cash + 50 WHERE user_code IN (SELECT a_portal_index FROM newproject_auth.t_users WHERE a_zone_num != -1)

 

#6


2 hours ago, Scura said:




really nice bash skills! However, I guess the simplest way is to add it directly in the database event, as /index.php?/profile/2-wizatek/&do=hovercard" data-mentionid="2" href="/index.php?/profile/2-wizatek/" rel="">@Wizatek said. You can always check mysql in case of error



 




CREATE EVENT `OnlineCashAdd`

ON SCHEDULE

EVERY 5 MINUTE STARTS '2014-08-06 00:34:11'

ON COMPLETION PRESERVE

ENABLE

COMMENT ''

DO UPDATE newproject_auth.bg_user SET cash = cash + 50 WHERE user_code IN (SELECT a_portal_index FROM newproject_auth.t_users WHERE a_zone_num != -1)


 




I tried to do Wizatek's one but it still doesn't do it

2

#7


5 hours ago, Veni said:




Well but is the question just normal online time cash OR rather X cash for being online for X minutes/hours?




yeah like x cash for being online x minutes. adding cash to all online players that I know but it's not working for me to make it auto every x minutes

#8


2 hours ago, AliceW said:




I tried to do Wizatek's one but it still doesn't do it

2




you should be able to add it as query ofc you need to replace with your databases's names

#9


21 hours ago, AliceW said:




I tried to do Wizatek's one but it still doesn't do it

2




SET GLOBAL event_scheduler = ON;

#10

So you want this for example?:



10 minutes online = 1 cash

1 hour online = 6 cash



Or simple onlinetime cash?



Forum Jump:


Users browsing this thread: 1 Guest(s)