Jump to content
MakeWebGames

2 questions event add & insert item


p_T_s
 Share

Recommended Posts

I have this setup in my weeklycron.php

$db->query("UPDATE users set money=money+1000 WHERE user_level=5");

I need it to send an event to these staff members stating they have received their payment

I also want to be able to insert into inventory for these staff members will potions ie (itemid 19)

can someone help me as i have tried all night with no luck..

Link to comment
Share on other sites

Re: 2 questions event add & insert item

 

$sel = mysql_query("SELECT userid,username,user_level FROM users WHERE user_level=5");
while($soc = mysql_fetch_assoc($sel))
{

mysql_query("UPDATE users SET money=money+1000 WHERE userid=".$soc['userid']);
event_add($soc['userid'],"Hello ".$soc['user_name'].", You have been given $1, 000 for being staff. Thank you.");
item_add($soc['userid'],19,1);

}
Link to comment
Share on other sites

Re: 2 questions event add & insert item

thx guys but they dont work...

$sel = mysql_query("SELECT userid,username,user_level FROM users WHERE user_level=5");
while($soc = mysql_fetch_assoc($sel))
{

mysql_query("UPDATE users SET money=money+1000 WHERE userid=".$soc['userid']);
event_add($soc['userid'],"Hello ".$soc['user_name'].", You have been given $1, 000 for being staff. Thank you.");
item_add($soc['userid'],19,1);

}

this one pays the $1000 but no event and not item 19

 

$db->query("UPDATE users set money=money+20000 WHERE user_level=5");
event_add($_POST['user'],"You were given $1000 from the administration.",$c);

and this one dosn't do either (no money or event)

Link to comment
Share on other sites

Re: 2 questions event add & insert item

Sorry. I now know why mine does not work.

Use this:

 

$sel = mysql_query("SELECT userid,username,user_level FROM users WHERE user_level=5");
while($soc = mysql_fetch_assoc($sel))
{

  include_once("global_func.php");
  mysql_query("UPDATE users SET money=money+1000 WHERE userid=".$soc['userid']);
  event_add($soc['userid'],"Hello ".$soc['user_name'].", You have been given $1, 000 for being staff. Thank you.");
  item_add($soc['userid'],19,1);

}
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.

 Share

×
×
  • Create New...