General > Developers Corner

Admin sounds, tools and other code chat.

<< < (4/31) > >>

jay209015:
I changed my goal, I just want it to disable trails for non-admins wich it does. I also want it to display when a non-admin uses dynamite wich is currently not working. Any suggestions?


--- Code: ---function UseTool( ply, tr, toolmode )
    if toolmode == "trails" or toolmode == "ignite" then
          if ply:IsAdmin() then
          return true
                        else
          return false
                        end

        end
        if toomode ==  "dynamite" then
                        if ply:IsAdmin() then
                                return true
                        else
                                Msg( "Player " .. ply:Nick() .. " used " .. toolmode .. "\n" );
                                return true
                        end
        end
end
hook.Add( "CanTool", "UseTool", UseTool );

--- End code ---

JamminR:
Getting any errors in server console?
Also, You may already be aware, "Msg" will only print to the console of the system it is run on... since CanTool is a server side gamemode hook, I believe it will only print in server console. Make sure you're looking there.

jay209015:
No I didn't know that msg displayed in the server console, but still it didn't print the message there either, nor did it display an error.
**EDIT**
I change my script alittle, but still no different.

--- Code: ---function UseTool( ply, tr, toolmode )
    if toolmode == "trails" or toolmode == "ignite" then
          if ply:IsAdmin() then
          return true
                        else
          return false
                        end

        end
        if toomode ==  "dynamite" then
                        if ply:IsAdmin() then
                                return true
                        else
                                ConCommand( "Player " .. ply:Nick() .. " used " .. toolmode .. "\n" );
                        end
        end
end
hook.Add( "CanTool", "UseTool", UseTool );

--- End code ---

JamminR:
Sorry I didn't see this last night when I posted.
Syntax error in your code, misspelled variable - toomode in the dynamite check should be toolmode.

Also, ConCommand is for commands, not output of messages.

jay209015:
OMG thank you for seeing that lol, that's kind of sad :'(.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version