Announcement

Collapse
No announcement yet.

SetPlayerWeapon Not Working

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    SetPlayerWeapon Not Working

    Has anyone been successful with the code example form the Wiki?

    I created a package with that code example and it doesn't seem to work. If I don't add a parameter correctly, the AddPlayerChat fires to let me know, but if I add parameters correctly, nothing happens. I'm not sure if this is due to the code example not working, or if it's because I need to have something configured on the server in order for weapons to work.

    This is the code example from the wiki:
    Code:
     function cmd_w(player, weapon, slot, ammo)
         if (weapon == nil or slot == nil or ammo == nil) then
              return AddPlayerChat(player, "Usage: /w <weapon> <slot> <ammo>")
         end  
    
         SetPlayerWeapon(player, weapon, ammo, true, slot, true)
    end
    AddCommand("w", cmd_w)
    AddCommand("weapon", cmd_w)

    #2
    It works for me uhm. what error are you getting?

    Comment


      #3
      No errors oddly enough. Like I said, it's weird that the if I don't add a parameter, the chat message appears telling me that I need to enter the correct parameters. But if I enter it correctly, nothing is happening. No errors in the server console, server logs or in chat.

      Comment


        #4
        This appears to have been an issue with the server. After experiencing an issue with my original server, I created a new one and it's working just fine now.

        Comment


          #5
          Okay.. that's great.

          Comment

          Working...
          X