shaved92bravada Posted March 15, 2008 Share Posted March 15, 2008 I need some help with something, like on the give item to user function or give item to all users either one, I want to post an even that tells them what item I gave them. So far the even tells them that I gave them X amount of item id # X. Lol how many users or me for that matter know what every items id# is. So what should I put in the script to get the itmname?? function mass_give_item_sub() { global $db,$ir,$c; $q=mysql_query("SELECT * FROM users WHERE fedjail=0",$c); while($r=mysql_fetch_array($q)) { item_add($r['userid'], $_POST['item'], $_POST['qty']); event_add($r['userid'],"The population has just been given an item {$_POST['item']}, Click [url='inventory.php']Here[/url] to check.",$c); print "Item Sent To {$r['username']}</br>"; } print " Mass item sending complete!</br> Theres no need to send a mass mail because they just got an event."; } Quote Link to comment Share on other sites More sharing options...
curious4moreknowledge Posted March 23, 2008 Share Posted March 23, 2008 Re: help with something Hint: look at the itemsend.php script to see how the event_add is coded and figure out how to merge it in your give items script. :| Just about everything you would ever need to write new scripts is somewhere in the package somewhere. You only need to look for it. Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted March 23, 2008 Share Posted March 23, 2008 Re: help with something Mmm, be careful though -- Inserting too many records in one hit can cause too much load on the DB server, think about adding only when necessary - i.e. on login or next page hit. Quote Link to comment Share on other sites More sharing options...
Analog Posted March 23, 2008 Share Posted March 23, 2008 Re: help with something function mass_give_item_sub() { global $db,$ir,$c; $id=mysql_query("SELECT * FROM items WHERE itmid = {$_POST['item']} LIMIT 1",$c) or die(mysql_error()); $item=mysql_fetch_array($id); $q=mysql_query("SELECT * FROM users WHERE fedjail=0",$c); while($r=mysql_fetch_array($q)) { item_add($r['userid'], $_POST['item'], $_POST['qty']); event_add($r['userid'],"The population has just been given {$_POST['item']} of {$item['itmname']}, Click [url='inventory.php']Here[/url] to check.",$c); print "Item Sent To {$r['username']}</br>"; } print " Mass item sending complete!</br> Theres no need to send a mass mail because they just got an event."; } That should do what you want I think. Its not tested as I have no way to try it out. However like Nyna stated its going to create a mass amount of database entries. Might be better to do something like a single news entry for them instead. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.