• Getting kills and Score Font
    15 replies, posted
Yup, some other questions <.> Is there a way to get a player's kills to make something happen? Like, if I kill 40 people, I get new weapons. I also had some problems killing NPCs in my gamemode, when I kill an NPC, it doesn't give me any kills. One last thing, how to change the scoreboard font :v: ?
[url]http://wiki.garrysmod.com/?title=Gamemode.OnNPCKilled[/url] and [url]http://wiki.garrysmod.com/?title=Player.Give[/url]
[url]http://wiki.garrysmod.com/?title=Player.Frags[/url] Returns the number of kills a player has accumulated. Combine: [url]http://wiki.garrysmod.com/?title=Player.AddFrags[/url] [url]http://wiki.garrysmod.com/?title=Gamemode.OnNPCKilled[/url] To give you NPC kills. To change your scoreboard font, take a look at the cl_scoreboard.lua (or whatever garry calls it) in the base gamemode.
Ok, useful stuff. I'm checking this out, I'll return in a second to tell you if it works. The kill 'n' get weapons stuff doesn't work.
Post the code.
[QUOTE=Nerdeboy;18375957]Post the code.[/QUOTE] The code is the same on the Wiki, I wanted to test it. The error is just a black screen.
About the Scoreboard, what is the IN_ key? I mean, is it [lua]"IN_SHOWSCOREBOARD"[/lua]?
[QUOTE=lonewolf2;18402127]About the Scoreboard, what is the IN_ key? I mean, is it [lua]"IN_SHOWSCOREBOARD"[/lua]?[/QUOTE] There is no IN_ key for that. Maybe if you went to the [b]wiki[/b] instead of relying on us to answer everything you would already know. Now go to the wiki and search scoreboard, I dare to do it and not find what you're looking for!
God, I really didn't mind searching for "scoreboard", I killed myself searching the IN_ key... Anyway, now I have another question: [lua]function GM:ScoreboardShow() 'command' end[/lua] Automatically replaces the use of the Scoreboard or just adds a command?
Anything you place in there will happen when the scoreboard keybind is pressed, not much else. To disable the current scoreboard return true at the end. And for IN_ keys and other enumerations next time on the wiki you can go to Lua > Useful Information > List of enumeration Most commands that use IN_ keys will also have a link to the list or the list itself.
Now, if I can ask something else, I'd like to remove the key "F2" so to make people not able to change team.
[url=http://wiki.garrysmod.com/?search=gamemode.ShowTeam][I]gamemode.ShowTeam[/I] [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] :eng101:
[QUOTE=Crazy Quebec;18402878][url=http://wiki.garrysmod.com/?search=gamemode.ShowTeam][I]gamemode.ShowTeam[/I] [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] :eng101:[/QUOTE] I have tried it already [lua] function DeleteKey() return; end hook.Add("ShowTeam", "Delete", DeleteKey) [/lua] Does not work.
[QUOTE=lonewolf2;18402922]I have tried it already [lua] function DeleteKey() return; end hook.Add("ShowTeam", "Delete", DeleteKey) [/lua] Does not work.[/QUOTE] Of course, because you're returning nothing at all. :D Nothing (or in lua [i]nil[/i]) is not the fame as [b]false[/b]. Try returning either true or false. Also note that the semi-colon you stuck in there does nothing at all.
[QUOTE=Crazy Quebec;18404114]Of course, because you're returning nothing at all. :D Nothing (or in lua [i]nil[/i]) is not the fame as [b]false[/b]. Try returning either true or false. Also note that the semi-colon you stuck in there does nothing at all.[/QUOTE] I tried that too... I'll try again. It works... but I needed to remove the use of the Key... now the TeamMenu doesn't open at the first spawn :/ I tried making the player join the 'Blue' team at the Initial spawn but it doesn't work...
/bump... Is there another way to get a player's kills and build a function on it? I mean other than "best score".
Sorry, you need to Log In to post a reply to this thread.