Garry's Mod

Garry's Mod

Derp's Hazmat Suit | Recoded
 This topic has been pinned, so it's probably important
Frontflip  [developer] 9 Oct, 2023 @ 10:02am
Derp's Hazmat Suit - Functions Documentation
Functions

Player:ForceEquipHazmat()
Force equips a hazmat suit on the player.

This function sets the player's model, hands, walk speed, run speed, and network boolean.

Parameters:
  • self: Player entity to equip the hazmat suit on.

Returns:
Boolean indicating whether the hazmat suit was successfully equipped.

Usage Example:
if player.GetByID(1):ForceEquipHazmat() then -- Hazmat suit successfully equipped else -- Failed to equip hazmat suit end



Player:EquipHazmat()
Equips a hazmat suit on the player.

This function sets the player's model, hands, walk speed, run speed, and network boolean. If the "DHS.PreEquipHazmat" hook returns true or a truthy value, the equipment is canceled.

Parameters:
  • self: Player entity to equip the hazmat suit on.

Returns:
Boolean indicating whether the hazmat suit was successfully equipped.

Usage Example:
if player.GetByID(1):EquipHazmat() then -- Hazmat suit successfully equipped else -- Failed to equip hazmat suit end



Player:ForceRemoveHazmat([pos])
Removes the hazmat suit from the player and optionally spawns an "ent_dhs" entity.

This function restores the player's original model, hands, walk speed, run speed, and network boolean.

Parameters:
  • self: Player entity from whom to remove the hazmat suit.
  • pos: Optional position vector where the "ent_dhs" entity should be spawned.

Returns:
Boolean indicating whether the hazmat suit was successfully removed.

Usage Example:
local pos = Vector(0, 0, 0) -- Replace with the desired position if player.GetByID(1):ForceRemoveHazmat(pos) then -- Hazmat suit successfully removed else -- Failed to remove hazmat suit end



Player:RemoveHazmat([pos])
Removes the hazmat suit from the player and optionally spawns an "ent_dhs" entity.

This function restores the player's original model, hands, walk speed, run speed, and network boolean. If the "DHS.PreRemoveHazmat" hook returns true or a truthy value, the removal is canceled. If it returns a vector, the "pos" parameter will be updated with the new position.

Parameters:
  • self: Player entity from whom to remove the hazmat suit.
  • pos: Optional position vector where the "ent_dhs" entity should be spawned.

Returns:
Boolean indicating whether the hazmat suit was successfully removed.

Usage Example:
local pos = Vector(0, 0, 0) -- Replace with the desired position if player.GetByID(1):RemoveHazmat(pos) then -- Hazmat suit successfully removed else -- Failed to remove hazmat suit end



Player:HasHazmat()
Checks if the player has a hazmat suit equipped.

This function checks the "DHSequiped" network boolean on the player.

Parameters:
  • self: Player entity to check for a hazmat suit.

Returns:
Boolean indicating whether the player has a hazmat suit equipped.

Usage Example:
if player.GetByID(1):HasHazmat() then -- Player has a hazmat suit equipped else -- Player does not have a hazmat suit equipped end


Last edited by Frontflip; 9 Oct, 2023 @ 10:04am