• DERMA automatically starts everytime player joins... ?
    6 replies, posted
The title says it all.. [lua] if ( CLIENT ) then function PLUGIN:ShowVoteKickMenu( players ) if !self.votesyes or self.votesyes == nil then self.votesyes = 0 end if !self.votesno or self.votesno == nil then self.votesno = 0 end self.VoteWindow = vgui.Create( "DFrame" ) self.VoteWindow:SetSize( 200, 95 ) self.VoteWindow:SetPos( ScrW() / 2 - self.VoteWindow:GetWide() / 2, ScrH() / 2 - self.VoteWindow:GetTall() / 2 ) if players then self.VoteWindow:SetTitle( "Votekick " .. players ) else self.VoteWindow:SetTitle( "Votekick " ) end self.VoteWindow:SetDraggable( false ) self.VoteWindow:ShowCloseButton( true ) self.VoteWindow:SetBackgroundBlur( true ) self.VoteWindow:MakePopup() local optionlist = vgui.Create( "DPanelList", self.VoteWindow ) optionlist:SetPos( 5, 25 ) optionlist:SetSize( 190, 65 ) optionlist:SetPadding( 5 ) optionlist:SetSpacing( 5 ) local voteyes = vgui.Create( "DButton" ) voteyes:SetText( "Yes" ) voteyes:SetTall( 25 ) voteyes.DoClick = function() self.votesyes = self.votesyes + 1 self.VoteWindow:Close() end local voteno = vgui.Create( "DButton" ) voteno:SetText( "No" ) voteno:SetTall( 25 ) voteno.DoClick = function() self.votesno = self.votesno + 1 self.VoteWindow:Close() end optionlist:AddItem( voteyes ) optionlist:AddItem( voteno ) end concommand.Add( "test_votekick", PLUGIN:ShowVoteKickMenu() ) usermessage.Hook( "EV_VoteKickMenu", function( um ) local players = um:ReadString() PLUGIN:ShowVoteKickMenu( players ) end ) end [/lua]
Bump... D:
hook it into playerinitialspawn.
Post the function that calls your usermessage hook, I suspect it has something to with that.
Deadman, I mean I DON'T want it to do everytime the player spawns the first time. Anyways, I'll do that, wizards: [lua] function PLUGIN:Call( ply, args ) if ( ply:EV_HasPrivilege( "Vote Kick" ) ) then if ( self.Voting ) then evolve:Notify( ply, evolve.colors.red, "You can't start a new vote kick until the current one has finished!" ) return elseif ( #player.GetAll() < 3 ) then evolve:Notify( ply, evolve.colors.red, "There aren't enough players to start a vote kick!" ) return end local args local pl = evolve:FindPlayer( args[1] ) if ( #pl == 0 ) then evolve:Notify( ply, evolve.colors.red, "You haven't specified a player!" ) elseif ( #pl > 1 ) then evolve:Notify( ply, evolve.colors.white, "Did you mean ", evolve.colors.red, evolve:CreatePlayerList( pl, true ), evolve.colors.white, "?" ) return elseif ( #pl == 1 ) then pl = pl[1] uid = pl:UniqueID() self.Voting = true self.votesyes = 0 self.votesno = 0 self.Votes = {} self.VotingPlayers = 0 self.VotingPlayers = table.Count( player.GetAll() ) umsg.Start( "EV_VoteKickMenu" ) umsg.String( pl ) umsg.End() timer.Create( "EV_VoteKickEnd", 10, 1, function() PLUGIN:VoteKickEnd() end ) evolve:Notify( evolve.colors.blue, ply:Nick(), evolve.colors.white, " has started the vote kick for ", evolve.colors.red, players, evolve.colors.white, "." ) end else evolve:Notify( ply, evolve.colors.red, evolve.constants.notallowed ) end end [/lua]
Line 50: [lua]concommand.Add( "test_votekick", PLUGIN:ShowVoteKickMenu() )[/lua] You only use brackets when calling a function, the plugin function would run at the start of the script all the time. Remove () from the function or remove the concommand.Add line completely since you're supposed to call it through usermessages?. [editline]27th January 2012[/editline] Like this if you're not removing the line completely: [lua]concommand.Add("test_votekick", PLUGIN.ShowVoteKickMenu)[/lua]
Thank you leiftiger, it's just I added the "()" because I kept getting errors for not having them. Let me try this now! [editline]27th January 2012[/editline] That worked! Thanks alot!
Sorry, you need to Log In to post a reply to this thread.