-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathattacktake.php
106 lines (94 loc) · 3.93 KB
/
attacktake.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
/**************************************************************************************************
| Software Name : Ravan Scripts Online Mafia Game
| Software Author : Ravan Soft Tech
| Software Version : Version 2.0.1 Build 2101
| Website : http://www.ravan.info/
| E-mail : [email protected]
|**************************************************************************************************
| The source files are subject to the Ravan Scripts End-User License Agreement included in License Agreement.html
| The files in the package must not be distributed in whole or significant part.
| All code is copyrighted unless otherwise advised.
| Do Not Remove Powered By Ravan Scripts without permission .
|**************************************************************************************************
| Copyright (c) 2010 Ravan Scripts . All rights reserved.
|**************************************************************************************************/
$atkpage=1;
include "globals.php";
$_GET['ID']=abs((int) $_GET['ID']);
$_SESSION['attacking']=0;
$ir['attacking']=0;
$db->query("UPDATE users SET attacking=0 WHERE userid=$userid");
$od=$db->query("SELECT * FROM users WHERE userid={$_GET['ID']}");
if($_SESSION['attackwon'] != $_GET['ID'])
{
die ("Cheaters don't get anywhere.");
}
if($db->num_rows($od))
{
$r=$db->fetch_row($od);
$gq=$db->query("SELECT * FROM gangs WHERE gangID={$r['gang']}");
$ga=$db->fetch_row($gq);
if($r['hp'] == 1)
{
print "What a cheater u are.";
}
else
{
print "
<div id='mainOutput' style='text-align: center; color: white; width: 600px; border: 1px solid #222222; height: 100px;
margin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'>
You beat {$r['username']} ";
$qe=$r['level']*$r['level']*$r['level'];
$expgain=rand($qe/2,$qe);
$expperc=(int) ($expgain/$ir['exp_needed']*100);
print "and gained $expperc% EXP!<br />
You hide your weapons and drop {$r['username']} off outside the hospital entrance. Feeling satisfied, you walk home.";
$hosptime=rand(10,20);
$db->query("UPDATE users SET exp=exp+$expgain WHERE userid=$userid");
$db->query("UPDATE users SET hp=1,hospital=$hosptime,hospreason='Left by <a href=\'viewuser.php?u={$userid}\'>{$ir['username']}</a>' WHERE userid={$r['userid']}");
event_add($r['userid'],"<a href='viewuser.php?u=$userid'>{$ir['username']}</a> attacked you and left you lying outside the hospital.",$c,'combat');
$atklog=mysql_escape_string($_SESSION['attacklog']);
$db->query("INSERT INTO attacklogs VALUES('',$userid,{$_GET['ID']},'won',unix_timestamp(),-2,'$atklog');");
$_SESSION['attackwon']=0;
$warq=$db->query("SELECT * FROM gangwars WHERE (warDECLARER={$ir['gang']} AND warDECLARED={$r['gang']}) OR (warDECLARED={$ir['gang']} AND warDECLARER={$r['gang']})");
if ($db->num_rows($warq) > 0)
{
$war=$db->fetch_row($warq);
$db->query("UPDATE gangs SET gangRESPECT=gangRESPECT-1 WHERE gangID={$r['gang']}");
$ga['gangRESPECT']-=1;
$db->query("UPDATE gangs SET gangRESPECT=gangRESPECT+1 WHERE gangID={$ir['gang']}");
print "<br />You earnt 1 respect for your gang!";
}
//Gang Kill
if ($ga['gangRESPECT']<=0 && $r['gang'])
{
$db->query("UPDATE users SET gang=0 WHERE gang={$r['gang']}");
$db->query("DELETE FROM gangs WHERE gangRESPECT<='0'");
$db->query("DELETE FROM gangwars WHERE warDECLARER={$ga['gangID']} or warDECLARED={$ga['gangID']}");
}
$npcs=array(
);
if($r['user_level']==0)
{
$q=$db->query("SELECT * FROM challengebots WHERE cb_npcid={$r['userid']}");
if ($db->num_rows($q)) {
$cb=$db->fetch_row($q);
$qk=$db->query("SELECT * FROM challengesbeaten WHERE userid=$userid AND npcid={$r['userid']}");
if(!$db->num_rows($qk))
{
$m=$cb['cb_money'];
$db->query("UPDATE users SET money=money+$m WHERE userid=$userid");
print "<br /> You gained \$$m for beating the challenge bot {$r['username']}";
$db->query("INSERT INTO challengesbeaten VALUES($userid, {$r['userid']})");
}
}
}
}
}
else
{
print "You beat Mr. non-existant!";
}
$h->endpage();
?>