Gamemode.PlayerSpawnRagdoll

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NamePlayerSpawnRagdoll
SyntaxGM:PlayerSpawnRagdoll( Player ply, String mdl, Entity ent )
DescriptionCalled when a player tries to spawn a ragdoll
ReturnsBoolean
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerSpawnRagdoll]Gamemode.PlayerSpawnRagdoll [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionPrevents players from spawning the ragdolls in the models table.
Used onNewerServer.png
Code
local models = {"combine_strider.mdl"} --All or part of model name.
local function blockRagdolls(ply, mdl, ent)
	for _, v in pairs(models) do
		if string.find(string.lower(mdl), v) != nil then
			ply:ChatPrint("Sorry, " .. ply:Nick() .. ". This ragdoll is not allowed on this server.")
			return false
		end
	end
end
hook.Add("PlayerSpawnRagdoll", "blockRagdolls", blockRagdolls)
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox