Hello, I am having trouble with something regarding the gamemode I am working on.
function weapon_set(ply,cmd,args)
if (args[2] == nil) then
if (ply:HasWeapon(args[1])) then
ply:Give(args[1])
umsg.Start("Change_Slot",ply)
umsg.String(args[1])
umsg.Char(tonumber(args[3]))
umsg.End()
end
else
if (ply:HasWeapon(args[1])) then
ply:StripWeapon(args[2])
ply:Give(args[1])
umsg.Start("Change_Slot",ply)
umsg.String(args[1])
umsg.Char(tonumber(args[3]))
umsg.End()
else
return
end
end
end
concommand.Add("weapon_set",weapon_set)
function assign_weapon_slot(SlotMsg)
for b,n in pairs(LocalPlayer():GetWeapons()) do
if ( n:GetClass() == SlotMsg:ReadString() ) then
n.Slot = SlotMsg:ReadChar()
n.slot = SlotMsg:ReadChar()
end
end
end
usermessage.Hook("Change_Slot",assign_weapon_slot)
Problem is, when it calls the usermessage, which doesn’t give an error, it doesn’t reassign the slot.