• Making a certain percent of players 1 class
    4 replies, posted
Im new to scripting, and am currently wondering how do i make a certain amount of players spawn as a certain class (Think i got this, Using math.random) . Also how to make players who die turn to another class. Yet another qeustion, has any1 got a weapon tut? I needa add the css knife as a knife that does 20dmg per hit, and then 20 DOT. Link appreciated. Oh yes, and how do i make the classes reset to the default after rounds (think i could have this) ? Is there a random percent i can use to see if another random percent is above it so it gets placed in a certain class ( think i got this using math.random )? Im currently using teams to see that players get items and health, should i use classes instead? One last thing, how do i see my own steam id num?
I can answer the SteamID thing, if you want to print someones SteamID using lua it would be [lua]concommand.Add( "PrintID", "printid", function() for k, v in pairs{ player.GetAll() } do Msg( v:Nick().. " = " ..v:SteamID ) end end )[/lua] But if you just want to find your SteamID in general, just enter a game (multiplayer preferably) and type in console "status" and it should print everyones names and SteamID's ( including your own ) [editline]04:29PM[/editline] I would also like to know how to make it so a certain percent of players are on a certain team. It would be useful
[QUOTE=HeavyMtl123;22302865]type in console "status" and it should print everyones names and SteamID's ( including your own ) [/QUOTE] This is the lua fourm so [lua] local ply = LocalPlayer() print(SteamID()) [/lua] [editline]06:18PM[/editline] [QUOTE=StartedBullet;22296606]Also how to make players who die turn to another class. [/QUOTE] [b][url=wiki.garrysmod.com/?title=Gamemode.DoPlayerDeath]Gamemode.DoPlayerDeath [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] [editline]06:19PM[/editline] Also OP to answer the other questions you have I think it would be easyer for you just to use fretta
[QUOTE=|King Flawless|;22304747]This is the lua fourm so [lua] local ply = LocalPlayer() print(SteamID()) [/lua] [editline]06:18PM[/editline] [b][url=wiki.garrysmod.com/?title=Gamemode.DoPlayerDeath]Gamemode.DoPlayerDeath [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] [editline]06:19PM[/editline] Also OP to answer the other questions you have I think it would be easyer for you just to use fretta[/QUOTE] ty, also i found a possible way of making some players a class when they spawn but not a certain percent ------------------------------------------------------ function set_infection( ply ) if math.random(1,10) >= 7 then player.Concommand( "team_2" ) elseif math.random(1,10) <= 6 then player.ConCommand( "team_1" ) end end concommand.Add( "GetRandInf", set_infection ) ------------------------------------------------------ ok just got this small piece left i think xD function GM:PlayerSpawn(ply) //What happens when the player spawns-------------------> //// says a ) is expected to close a ( self.BaseClass:PlayerSpawn( ply ) ply:SetGravity( 0.75 ) ply:SetMaxHealth( 100, true ) ply:SetWalkSpeed( 325 ) ply:SetRunSpeed( 325 ) end
Use lua tags, really.
Sorry, you need to Log In to post a reply to this thread.