forked from simmoo/Mafia-Game-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathequip_weapon.php
64 lines (61 loc) · 2.03 KB
/
equip_weapon.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
<?php
include "globals.php";
$_GET['ID'] = abs((int) $_GET['ID']);
$id=$db->query("SELECT iv.*,it.* FROM inventory iv LEFT JOIN items it ON iv.inv_itemid=it.itmid WHERE iv.inv_id={$_GET['ID']} AND iv.inv_userid=$userid LIMIT 1");
if($db->num_rows($id)==0)
{
print "Invalid item ID
<br />
<a href='inventory.php'>Back</a>";
$h->endpage();
exit;
}
else
{
$r=$db->fetch_row($id);
}
if(!$r['weapon'])
{
print "This item cannot be equipped to this slot.
<br />
<a href='inventory.php'>Back</a>";
$h->endpage();
exit;
}
if($_GET['type'])
{
if(!in_array($_GET['type'], array("equip_primary", "equip_secondary")))
{
print "This slot ID is not valid.
<br />
<a href='inventory.php'>Back</a>";
$h->endpage();
exit;
}
if($ir[$_GET['type']])
{
item_add($userid, $ir[$_GET['type']], 1);
}
item_remove($userid, $r['itmid'], 1);
$db->query("UPDATE users SET {$_GET['type']} = {$r['itmid']} WHERE userid={$userid}");
print "Item {$r['itmname']} equipped successfully.
<br />
<a href='inventory.php'>Back</a>";
}
else
{
print "
<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'> Equip Weapon</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'><br> <br><br>
<form action='equip_weapon.php' method='get'>
<input type='hidden' name='ID' value='{$_GET['ID']}' />
Please choose the slot to equip {$r['itmname']} to, if there is already a weapon in that slot, it will be removed back to your inventory.<br />
<input type='radio' STYLE='color: black; background-color: white;' name='type' value='equip_primary' checked='checked' /> Primary<br />
<input type='radio' STYLE='color: black; background-color: white;' name='type' value='equip_secondary' /> Secondary<br />
<input type='submit' STYLE='color: black; background-color: white;' value='Equip Weapon' /></form> </div><div><img src='images/generalinfo_btm.jpg' alt='' /></div><br></div></div></div></div></div> ";
}
$h->endpage();
?>