Arizard / deathrun

Arizard's Deathrun gamemode for Garry's Mod
63 stars 38 forks source link

Map vote support from other scripts #68

Closed MrROFLMAN closed 8 years ago

MrROFLMAN commented 8 years ago

Maybe i'm misreading something here, but I cannot get any map vote system to work on this gamemode other then the one provided with the gamemode, any ideas why this is happening?

I'm using kmapvote if that helps.

SunRed commented 8 years ago

@Hainaa Please don't do this. What do you think are Hooks even used for? They exist so you don't have to edit the gamemode itself but rather can append your own code with a hook in a custom addon or something like this.

I created #27 just for this reason a while ago. In hooks_and_convars.txt the hooks used are described further. You can simply replace the builtin mapvote system with your own by doing something like this:

hook.Add("DeathrunStartMapvote", "Start map voting", function(rounds)
    DR:ChatBroadcast("Starting mapvote after playing "..rounds.." rounds!")
    MAPVOTE:BeginVote() -- KMapVote starting method
    return true
end )

Note that you have to return true in order to prevent the builtin one from starting.

Cheers

MrROFLMAN commented 8 years ago

Thanks SunRed, you're method worked! Trying to work out that issue for days now, thanks for the support guys!