0 Members and 1 Guest are viewing this topic.
Not sure if it was requested, but don't forget physics props... I personally don't see the point in having gravity shut off for players but having all props still effected by it..
It isn't done, but is this something like what you guys had in mind?Code: [Select]------------------------------ Grav ------------------------------function ulx.grav( calling_ply, gravity, seconds ) for k,v in pairs( player.GetAll() ) do v:SetGravity( gravity ) end timer.Simple( seconds, function() for k,v in pairs( player.GetAll() ) do v:SetGravity( 1 ) end end ) ulx.fancyLogAdmin( calling_ply, "#A set gravity to #i for #i seconds", gravity, seconds )endlocal grav = ulx.command( CATEGORY_NAME, "ulx grav", ulx.grav, "!grav" )grav:addParam{ type=ULib.cmds.NumArg }grav:addParam{ type=ULib.cmds.NumArg }grav:defaultAccess( ULib.ACCESS_ADMIN )grav:help( "Randomizes gravity for everyone." )
------------------------------ Grav ------------------------------function ulx.grav( calling_ply, gravity, seconds ) for k,v in pairs( player.GetAll() ) do v:SetGravity( gravity ) end timer.Simple( seconds, function() for k,v in pairs( player.GetAll() ) do v:SetGravity( 1 ) end end ) ulx.fancyLogAdmin( calling_ply, "#A set gravity to #i for #i seconds", gravity, seconds )endlocal grav = ulx.command( CATEGORY_NAME, "ulx grav", ulx.grav, "!grav" )grav:addParam{ type=ULib.cmds.NumArg }grav:addParam{ type=ULib.cmds.NumArg }grav:defaultAccess( ULib.ACCESS_ADMIN )grav:help( "Randomizes gravity for everyone." )
Ehh, I do not know of any way to set prop's gravity other then applying force to it or something in that area. So if I finish this, it'll most likely just include player's gravity.
function ENT:Toogle_Prop_Gravity( prop , yes_no ) if ( !prop:IsValid() ) then return end if ( self.ignore[ prop:EntIndex() ] == prop ) then return false; end if ( !self:is_true(self.workonplayers) && prop:GetClass() == "player" ) then return false; end if prop:GetMoveType() == MOVETYPE_NONE then return false; end if prop:GetMoveType() == MOVETYPE_NOCLIP then return false; end //do this to prevent -uncliping- if prop:GetClass() != "player" && !gamemode.Call("PhysgunPickup",self.pl,prop) then return false; end if prop:GetMoveType() != MOVETYPE_VPHYSICS then if yes_no == false then if prop:IsNPC() || prop:IsPlayer() then prop:SetMoveType(MOVETYPE_FLY); prop:SetMoveCollide(MOVECOLLIDE_FLY_BOUNCE); else prop:SetGravity(0); end else if prop:IsPlayer() then prop:SetMoveType(MOVETYPE_WALK); prop:SetMoveCollide(MOVECOLLIDE_DEFAULT); elseif prop:IsNPC() then prop:SetMoveType(MOVETYPE_STEP); prop:SetMoveCollide(MOVECOLLIDE_DEFAULT); else prop:SetGravity(1); end end end