14.06.2016, 10:17
(
Последний раз редактировалось maikons; 16.06.2016 в 08:12.
)
Someone could help me to finish convert this script PHP to PAWN SAMP?
I want put it ongamemodeinit to clean my DB
PHP script base:
My pawn try
I want put it ongamemodeinit to clean my DB
PHP script base:
Код:
<?php $link = mysql_connect('IP', 'User', 'Pass'); mysql_select_db('DB', $link); $EXP = array( 50, 100, 250, 500 ); $TEMPO = array( 15 * 86400, 30 * 86400, 90 * 86400, 120 * 86400, 360 * 86400 ); $query = "DELETE * FROM `accounts` WHERE `lastlogin` UNIX_TIMESTAMP() >= (`lastlogin` + " . $TEMPO[1] .") AND `experience` <=" . $EXP[1]; mysql_query($query); $num = mysql_affected_rows(); echo "$num rows deletadas que nгo logaram nos ultimos 15 dias, com experiencia menor que 50"; $query = "DELETE * FROM `accounts` WHERE `lastlogin` UNIX_TIMESTAMP() >= (`lastlogin` + " . $TEMPO[2] .") AND `experience` <=" . $EXP[2]; mysql_query($query); $num = mysql_affected_rows(); echo "$num rows deletadas que nгo logaram nos ultimos 30 dias, com experiencia menor que 100"; $query = "DELETE * FROM `accounts` WHERE `lastlogin` UNIX_TIMESTAMP() >= (`lastlogin` + " . $TEMPO[3] .") AND `experience` <=" . $EXP[3]; mysql_query($query); $num = mysql_affected_rows(); echo "$num rows deletadas que nгo logaram nos ultimos 90 dias, com experiencia menor que 250"; $query = "DELETE * FROM `accounts` WHERE `lastlogin` UNIX_TIMESTAMP() >= (`lastlogin` + " . $TEMPO[4] .") AND `experience` <=" . $EXP[4]; mysql_query($query); $num = mysql_affected_rows(); echo "$num rows deletadas que nгo logaram nos ultimos 120 dias, com experiencia menor que 500"; $query = "DELETE * FROM `accounts` WHERE `lastlogin` UNIX_TIMESTAMP() >= (`lastlogin` + " . $TEMPO[5] .")"; mysql_query($query); $num = mysql_affected_rows(); echo "$num rows deletadas que nгo logaram nos ultimos 360 dias, com qualquer experiencia";
Код:
foward CleanDB(); public CleanDB() { new EXP[4]; EXP[1] = 20; EXP[2] = 100; EXP[3] = 500; new TEMPO[5]; TEMPO[1] = 90 * 86400; TEMPO[2] = 120 * 86400; TEMPO[3] = 300 * 86400; TEMPO[4] = 360 * 86400; new query[128], num; query = "DELETE * FROM `accounts` WHERE `lastlogin` UNIX_TIMESTAMP() >= (`lastlogin` + " , TEMPO[1] .") AND `experience` <=" , EXP[1]; mysql_query(query); num = mysql_affected_rows(); print("num rows was ben deleted because inactivity (90 days / exp 20-)"); query = "DELETE * FROM `accounts` WHERE `lastlogin` UNIX_TIMESTAMP() >= (`lastlogin` + " , TEMPO[2] .") AND `experience` <=" , EXP[2]; mysql_query(query); num = mysql_affected_rows(); print("num rows was ben deleted because inactivity (120 days / exp 100-)"); query = "DELETE * FROM `accounts` WHERE `lastlogin` UNIX_TIMESTAMP() >= (`lastlogin` + " , TEMPO[3] .") AND `experience` <=" , EXP[3]; mysql_query(query); num = mysql_affected_rows(); print("num rows was ben deleted because inactivity (300 days / exp 500-)"); query = "DELETE * FROM `accounts` WHERE `lastlogin` UNIX_TIMESTAMP() >= (`lastlogin` + " , TEMPO[4] .")"; mysql_query(query); num = mysql_affected_rows(); print("num rows was ben deleted because inactivity (360 days / exp 501+)"); }