rebel1324 / NutScript

A free role-play framework for Garry's Mod.
http://nutscript.net
MIT License
65 stars 31 forks source link

Some questions with hands and characters #248

Closed Gandalfor closed 5 years ago

Gandalfor commented 5 years ago

Hi! I'm currently trying to change my Star Wars SV to nutscript. But I have a few of little questions that I don't really find how to solve. Hope someone can help me, meanwhile I keep searching and trying configs.

1.- How to remove the hands, I mean, the hands that are by default, I wont use them, because I need the weapons to be allways raised.

2.- Is there any way to create character via ULX or something like that? I mean, users can create just 1 character and admins +, 2 characters.

3.- Is thre any way to change the model when you change faction? I mean, i've set the faction models, but when I do /plytransfer, the model doesn't change and I have to set it manually.

4.- I'd like to know if exists a command where you put the class to somebody. Because I saw the /beclass, wich one lets you be a specific class from the faction, but, exists one that you can set for another player?

These are all my questions at the moment, thank you!

Gandalfor.

brianhang commented 5 years ago
  1. In the PostPlayerLoadout hook, you can strip the player of the nut_hands SWEP.

  2. If you wish to create characters programmatically, see nut.char.create. For example:

    nut.char.create({
    name = "John Doe",
    desc = "A character.",
    model = "models/player/police.mdl",
    steamID = "76561198030127257",
    faction = "citizen",
    money = 500
    }, function(id)
    local character = nut.char.loaded[id]
    print("Created character ", character)
    end)
  3. You can use the FACTION:onTransfered(client) function. For your case, you should have the following function defined for your faction:

    function FACTION:onTransfered(client)
    local character = client:getChar()
    character:setModel("models/police.mdl")
    end
  4. There isn't a command for that. However, you can use the character:joinClass(class) method to put a character into a class and nut.command.add to create a new command. Check out the /beclass source code for inspiration.

Gandalfor commented 5 years ago

Wow.

Thank you so much! today I'm gonna apply everything in my code.