Author Topic: Some Questions that seem to be unanswered elsewhere  (Read 7545 times)

0 Members and 1 Guest are viewing this topic.

Offline sparky2002b

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
  • CloudNine Clan Administrator
Re: Some Questions that seem to be unanswered elsewhere
« Reply #15 on: August 21, 2008, 07:28:47 PM »
This is the function that limits STools to certain groups.
Code: [Select]
function MPUseTool( ply, tr, toolmode )
local denies = {"stargate_iris", "drones", "staff_weapon", "stargate_cloaking", "stargate_shield", "zpm", "wraith_harvester"}
for _, v in pairs(denies) do
if v == toolmode then
if !ply:IsAdmin() and !ply:IsUserGroup("platinum") and !ply:IsUserGroup("goldmoderator") and !ply:query("stargate") then
ply:PrintMessage( HUD_PRINTTALK, "This tool is restricted to Admins and Platinum Members" )
return false
end
end
end
end
hook.Add( "CanTool", "MPUseTool", MPUseTool );

This is the code to limit SEnts to groups.
Code: [Select]
function MPSentSpawn( ply, cls )
local denies = {"transporter", "dhd_atlantis", "dhd_sg1", "ring_panel", "ring_base", "stargate_atlantis", "stargate_sg1"}
for _, v in pairs(denies) do
if v == cls then
if !ply:IsAdmin() and !ply:IsUserGroup("platinum") and !ply:IsUserGroup("goldmoderator") and !ply:query("stargate") then
ply:PrintMessage( HUD_PRINTTALK, "This entity is restricted to Admins and Platinum Members" )
return false
end
end
end
end
hook.Add( "PlayerSpawnSENT", "MPSentSpawn", MPSentSpawn );


I don't have a LOT of time to explain these 2 bits of code.. but basically on the first one, put the names of the tools you wish to limit in quotes in teh table define at the top. The groups you wish to be able to use them are in the IF statement below. Do the same with the second example except.. it is for entities instead of tools.

Anyone here will be able to help you with this code if you require assistance, or you can contact ME directly. You are more likely to get a response if you contact me with a PM.. either here or on my website(listed in my sig)

Where is this intended to be used? In its own /autorun/ .lua file or?
CloudNine Clan Server - 68.64.33.152:27019 - http://c9gc.com