This is a very simple slap mod that will take all of the persons money that you have slapped , you will both recieve an event , i am still learning phpso go easy on me lol .
call this slap.php
<?php
include "globals.php";
$info=mysql_query("SELECT * FROM users WHERE userid={$_GET['ID']}");
$r=$db->fetch_row($info);
if ($ir['hospital'])
{
die ("you cant slap someone if you are in hospital");
}
else if ($ir['jail'])
{
die (" you cant slap someone if you are in jail");
}
else if ($r['hospital'])
{
die ("you can slap someone if they are already in hospital");
}
else if ($r['jail'])
{
die ("you cant slap someone if they are in jail");
}
else if ($ir['slaps'] < 1)
{
die ("you dont have any slaps");
}
else
{
$_GET['ID'] = abs((int) $_GET['ID']);
if(!((int)$_GET['ID']))
{
print "Invalid User ID";
}
else if($_GET['ID'] == $userid)
{
print "Sorry but you cant slap yourself";
}
else
{
$money=($r['money']);
mysql_query("UPDATE users SET money=money+$money WHERE userid=$userid");
mysql_query("UPDATE users SET money=0 WHERE userid={$_GET['ID']}");
mysql_query("UPDATE users SET slaps=slaps-1 WHERE userid=$userid");
print "You stole \$$money from ID {$_GET['ID']}.";
event_add($_GET['ID'],"You were slapped for \£$money by {$ir['username']}.",$c);
event_Add($userid,"you Slapped <b>{$r['username']}</b> and Stole £$money");
}
}
$h->endpage();
?>
Add this to the user table.
ALTER table users ADD slaps INT(11) NOT NULL default 0;
and finaly add the link on viewuser.php.
<a href='slap.php?ID={$r['userid']}'>Slap [{$ir['slaps']}]</a>