The Ace Posted June 30, 2008 Posted June 30, 2008 A bit hard for me to explain, but in my game I have it so that users can't attack admins. I would like it so that if someone tries to attack an admin, it sends an event to that admin. The things I have tried don't seem to work. Here is my code from attack.php (the bit with the user_level): else if($odata['user_level']==2) { print "{$odata['username']}'s bodyguards chase you away. You're not allowed to attack admins! [url='index.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } Any help will be highly appreciated. ;) (PS. I didn't think this was a Modification Request. That is why I have posted here. :) ) Quote
Guest Anonymous Posted June 30, 2008 Posted June 30, 2008 Re: Event Add -- stumped Do you mean something like this? else if($odata['user_level']==2) { print "{$odata['username']}'s bodyguards chase you away. You're not allowed to attack admins! [url='index.php']> Back[/url]"; $id=1; event_add($id,"text here?",$c); $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } Quote
Spudinski Posted June 30, 2008 Posted June 30, 2008 Re: Event Add -- stumped * Topic Moved * Posted relatively in the correct section, thanks. Quote
The Ace Posted June 30, 2008 Author Posted June 30, 2008 Re: Event Add -- stumped * Topic Moved * Posted relatively in the correct section, thanks. I had a feeling it was in the wrong section!! lol Do you mean something like this? else if($odata['user_level']==2) { print "{$odata['username']}'s bodyguards chase you away. You're not allowed to attack admins! [url='index.php']> Back[/url]"; $id=1; event_add($id,"text here?",$c); $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } Um, in a way. ;) What I would like is when a user attempts to attack ANY admin, that admin gets an event saying "Name Here tried to attack you." Quote
Guest Anonymous Posted June 30, 2008 Posted June 30, 2008 Re: Event Add -- stumped else if($odata['user_level']==2) { print "{$odata['username']}'s bodyguards chase you away. You're not allowed to attack admins! > Back"; $id=1; event_add($id,"The user ({$ir['username']}) tried to attack you.",$c); $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } Quote
The Ace Posted June 30, 2008 Author Posted June 30, 2008 Re: Event Add -- stumped Thanks, that worked, but whenever someone tries to attack other admins, the event comes through to me, ID 1.....what would I change $id=1; to, so it applies to ALL admins.....??? Quote
POG1 Posted June 30, 2008 Posted June 30, 2008 Re: Event Add -- stumped Thanks, that worked, but whenever someone tries to attack other admins, the event comes through to me, ID 1.....what would I change $id=1; to, so it applies to ALL admins.....??? it works with all admins just that the event is only sent to a set var. event_add($odata[userid],"The user ({$ir['username']}) tried to attack you.",$c); that should send it to the person who is being attacked and not to id (1) Quote
The Ace Posted June 30, 2008 Author Posted June 30, 2008 Re: Event Add -- stumped Thank you!! :D Quote
The Ace Posted July 17, 2008 Author Posted July 17, 2008 Re: Event Add -- stumped I have the lottery mod installed, and the winner receives an event. What I would like is that ALL users receive an even saying who won the lottery...so, what would I change this to: (from cron_weekly.php) event_add($user['userid'],"$user['userid'] won the weekly lottery and was credited £{$row['jackpot']}",$c); I'm not too sure what the event_add($user['userid'] should be.......if you need a better explanation, I'll try to explain more. lol. :-P Quote
The Ace Posted July 21, 2008 Author Posted July 21, 2008 Re: Event Add -- stumped Anyone? Please...? :) Quote
The Ace Posted July 21, 2008 Author Posted July 21, 2008 Re: Event Add -- stumped Valid point. I might try this. Would it be better if an announcement went out automatically saying "{$user['userid']} won the weekly lottery. Well done!"?? Quote
The Ace Posted July 24, 2008 Author Posted July 24, 2008 Re: Event Add -- stumped Can any help me with the announcement thing? Please. ;) Quote
Tonka Posted July 24, 2008 Posted July 24, 2008 Re: Event Add -- stumped replace your event add with this, i'm not sure if this will work but it should $db->query("INSERT INTO announcements VALUES('{$user['userid']} won the weekly lottery. Well done!', unix_timestamp())"); $db->query("UPDATE users SET new_announcements=new_announcements+1"); Quote
The Ace Posted July 24, 2008 Author Posted July 24, 2008 Re: Event Add -- stumped Thanks. I'll give it a go!! Quote
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.