Jump to content
MakeWebGames

Help with crons!!


michaelbraden

Recommended Posts

I am seriously needing some help. I am trying to get my Mobster of The hour Script working. I have located the script at /moth.php and I need the script to run. Here is everything on moth.php

 

<?
$result = mysql_query("SELECT id, hourlyattacks FROM grpgusers WHERE hourlyattacks > 0 DESC LIMIT 1");
$rows = mysql_num_rows($result);
if($rows == 1) {
$fetch = mysql_fetch_array($result);
send_event($fetch['id'], "You won mobster of the hour with ".$fetch['hourlyattacks']."");
$result = mysql_query("UPDATE grpgusers SET points = points + 10 WHERE id = '".$fetch['id']."'");
$reset = mysql_query("UPDATE grpgusers SET hourlyattacks = '0'");
}

?>

 

Anyhow I am using a cpanel for crons but I got no idea howthis works as I am completly new! Please help me out guys! I want the script to see how many 'hourlyattacks' there are, take the highest, reward points, and reset hourlyattacks and start over.... someone help please?

Link to comment
Share on other sites

UPDATED but not tested

 

<?php
include('dbcon.php');
$result = mysql_query("SELECT id, hourlyattacks FROM grpgusers WHERE hourlyattacks > 0 DESC LIMIT 1");
$fetch = mysql_fetch_array($result);
$usr = new User($fetch['id']);
$newpoints = $usr->points + 10;
Send_Event($usr->id, "You won mobster of the hour with ".$fetch['hourlyattacks']."");
$result = mysql_query("UPDATE grpgusers SET points = ".$newpoints." WHERE id = '".$usr->id."'");
$reset = mysql_query("UPDATE grpgusers SET hourlyattacks = '0'");
}

?>
Edited by Newbie
Link to comment
Share on other sites

I get this error when trying to run this

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/silentm2/public_html/moth.php on line 9

 

<?php
include 'dbcon.php';

include 'classes.php';

include 'updates.php';

$result = mysql_query("SELECT id, hourlyattacks FROM grpgusers WHERE hourlyattacks > 0 DESC LIMIT 1");
$rows = mysql_num_rows($result);
if($rows == 1) {
$fetch = mysql_fetch_array($result);
$usr = new User($fetch['id']);
send_event($usr->id, "You won mobster of the hour with ".$fetch['hourlyattacks']."");
$result = mysql_query("UPDATE grpgusers SET points = points + 10 WHERE id = '".$usr->id."'");
$reset = mysql_query("UPDATE grpgusers SET hourlyattacks = '0'");
}

?>

 

<?php

include 'dbcon.php';

include 'classes.php';

include 'updates.php';

$result = mysql_query("SELECT id, hourlyattacks FROM grpgusers WHERE hourlyattacks > 0 DESC LIMIT 1");

$rows = mysql_num_rows($result);

if($rows == 1) {

$fetch = mysql_fetch_array($result);

$usr = new User($fetch['id']);

send_event($usr->id, "You won mobster of the hour with ".$fetch['hourlyattacks']."");

$result = mysql_query("UPDATE grpgusers SET points = points + 10 WHERE id = '".$usr->id."'");

$reset = mysql_query("UPDATE grpgusers SET hourlyattacks = '0'");

}

?>

Link to comment
Share on other sites

try

 

<?php
include('dbcon.php');
$result = mysql_query("SELECT * FROM grpgusers ORDER BY hourlyattacks  DESC LIMIT 1");
$fetch = mysql_fetch_array($result);
$usr = new User($fetch['id']);
$newpoints = $usr->points + 10;
Send_Event($usr->id, "You won mobster of the hour with ".$fetch['hourlyattacks']."");
$result = mysql_query("UPDATE grpgusers SET points = ".$newpoints." WHERE id = '".$usr->id."'");
$reset = mysql_query("UPDATE grpgusers SET hourlyattacks = '0'");
}

?>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...