Jump to content
MakeWebGames

Event Add -- stumped


The Ace

Recommended Posts

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. :) )

Link to comment
Share on other sites

Guest Anonymous

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;
}
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Guest Anonymous

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;

}

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
Share on other sites

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");
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...