Recently I have been working on a module for DarkRP that adds a chat command to change player model and weapon color.
But whenever I type in the command nothing happens.
(DarkRP/gamemode/modules/color.lua):
[CODE]
local function setColor(ply, args)
if #args = 4 then
if args[1] = "weapon" then
if args[2] > -1 and args[2] < 256 and args[3] > -1 and args[3] < 256 and args[4] > -1 and args[4] < 256 then
local weaponRed = tostring(args[2])
local weaponGreen = tostring(args[3])
local weaponBlue = tostring(args[4])
ply:ConCommand("cl_weaponcolor", weaponRed, weaponGreen, weaponBlue)
ply:PrintMessage( HUD_PRINTTALK, "When you next spawn, your weapon color will be different." )
else
ply:PrintMessage( HUD_PRINTTALK, "/color <weapon/player> <r 0 - 255> <g 0 - 255> <b 0 - 255>" )
end
elseif args[1] = "player" then
if args[2] > -1 and args[2] < 256 and args[3] > -1 and args[3] < 256 and args[4] > -1 and args[4] < 256 then
local playerRed = tostring(args[2])
local playerGreen = tostring(args[3])
local playerBlue = tostring(args[4])
ply:ConCommand("cl_weaponcolor", playerRed, playerGreen, playerBlue)
ply:PrintMessage( HUD_PRINTTALK, "When you next spawn, your player color will be different." )
else
ply:PrintMessage( HUD_PRINTTALK, "/color <weapon/player> <r 0 - 255> <g 0 - 255> <b 0 - 255>" )
end
else
ply:PrintMessage( HUD_PRINTTALK, "/color <weapon/player> <r 0 - 255> <g 0 - 255> <b 0 - 255>" )
end
else
ply:PrintMessage( HUD_PRINTTALK, "/color <weapon/player> <r 0 - 255> <g 0 - 255> <b 0 - 255>" )
end
return ""
end
AddChatCommand("/color", setColor)
[/CODE]
Anyone know what i'm doing wrong?
[highlight](User was banned for this post ("missed the darkrp thread" - postal))[/highlight]
Sorry, you need to Log In to post a reply to this thread.