forked from matsamilla/Razor-Enhanced
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpvm_pvp_Swap or Toggle Wep.py
126 lines (110 loc) · 4.04 KB
/
pvm_pvp_Swap or Toggle Wep.py
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Weapon Swapper by Matsamilla
# Swaps between weps you target, last targeted is first equipted
# if only one weapon targeted, acts as a wep toggle.
# To clear weps, put weps away, run offscreen & run script, cancel target
# Version 2.1: Fixed null error
leftHand = Player.GetItemOnLayer('LeftHand')
rightHand = Player.GetItemOnLayer('RightHand')
def setWeps(text, multiple=True):
Player.HeadMessage(76,text)
list = []
if multiple:
while multiple:
chosenid = Target.PromptTarget()
if chosenid > -1:
chosen = Items.FindBySerial(chosenid)
Misc.Pause(500)
list.append(chosen.Serial)
else:
multiple = False
if len(list) == 1:
return chosen
else:
return list
else:
chosenid = Target.PromptTarget()
if chosenid > -1:
chosen = Items.FindBySerial(chosenid)
Misc.Pause(500)
Misc.SendMessage("Chose {}".format(chosen.Name))
return chosenid
def swampWeps():
for i in mainWeplist:
if Items.FindBySerial(i) == None:
Player.HeadMessage(33, 'Set New Weps')
Misc.RemoveSharedValue(Player.Name + 'weplist')
Misc.RemoveSharedValue(Player.Name + 'mainWeplist')
checkList()
break
# set weps to temp list
if Misc.CheckSharedValue(Player.Name + 'weplist'):
weplist = Misc.ReadSharedValue(Player.Name + 'weplist')
else:
weplist =[]
for i in mainWeplist:
weplist.append(i)
Misc.SetSharedValue(Player.Name + 'weplist', weplist)
# clear hands
if rightHand:
Items.Move(rightHand,Player.Backpack.Serial,0)
Misc.Pause(600)
if leftHand:
Items.Move(leftHand,Player.Backpack.Serial,0)
Misc.Pause(600)
# get last list position
lastPos = len(weplist) -1
# equip next wep in list
#currentWep = Items.FindBySerial(currentWep)
Player.EquipItem(weplist[lastPos])
# delete last equipt wep from temp list
weplist.pop()
if not weplist:
Misc.RemoveSharedValue(Player.Name + 'weplist')
else:
weplist = Misc.ReadSharedValue(Player.Name + 'weplist')
def toggleWep():
if rightHand:
if rightHand.Serial == wep:
Items.Move(wep,Player.Backpack.Serial,0)
return
if leftHand:
if leftHand.Serial == wep:
Items.Move(wep,Player.Backpack.Serial,0)
else:
Player.EquipItem(wep)
else:
Player.EquipItem(wep)
# check to see if weps are saved
def checkList():
global mainWeplist
global wep
if Misc.CheckSharedValue(Player.Name + 'singlewep'):
tempwep = Items.FindBySerial(Misc.ReadSharedValue(Player.Name + 'singlewep'))
if tempwep:
wep = tempwep.Serial
else:
Misc.RemoveSharedValue(Player.Name + 'singlewep')
checkList()
elif Misc.CheckSharedValue(Player.Name + 'mainWeplist') == False:
mainWeplist = setWeps("Target Wep(s), then cancel target.")
if isinstance(mainWeplist, list):
Misc.SetSharedValue(Player.Name + 'mainWeplist', mainWeplist)
else:
Misc.SetSharedValue(Player.Name + 'singlewep', mainWeplist.Serial)
wep = mainWeplist.Serial
Misc.Pause(600)
else:
mainWeplist = Misc.ReadSharedValue(Player.Name + 'mainWeplist')
try:
checkList()
if isinstance(mainWeplist, list):
Misc.SendMessage('Swap Wep', 33)
swampWeps()
else:
Misc.SendMessage('Toggle Wep', 33)
toggleWep()
except:
Misc.RemoveSharedValue(Player.Name + 'mainWeplist')
Misc.RemoveSharedValue(Player.Name + 'singlewep')
Misc.RemoveSharedValue(Player.Name + 'weplist')
Player.HeadMessage(33, 'Something went wrong, reset weps')