Nevo's Request

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Nevo's Request

Post by Aero »

That's ridiculously long and innefficient.
I'll make a JASS voting kick system and edit this post.
[Edit]

globals
Spoiler:

Code: Select all

globals
constant integer VOTES_NEEDED_TO_KICK=3
dialog array votekick_dialog
button array votekick_buttons
integer array votekick_votes
trigger votekick_buttonclick=null
trigger votekick_votekick=null
endglobals
code
Spoiler:

Code: Select all

function init_votekick takes nothing returns nothing
local integer i=0
loop
exitwhen i>11
set votekick_dialog[i]=DialogCreate()
call TriggerRegisterPlayerChatEvent(votekick_votekick,Player(i),"-votekick",true)
call TriggerRegisterDialogEvent(votekick_buttonclick,votekick_dialog[i])
set i=i+1
endloop
endfunction
function VotekickClick takes nothing returns nothing
local player p=GetTriggerPlayer()
local integer id=GetPlayerId(p)
local integer istart=id*12+100
local button b=GetClickedButton()
local integer j=0
local player q
loop
exitwhen j>11
if votekick_buttons[istart+j]==b then
set q=Player(j)
if votekick_votes[istart+j]==1 then
set votekick_votes[istart+j]=0
set votekick_votes[j]=votekick_votes[j]-1
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,8.,"A kick vote has been withdrawn for "+GetPlayerName(q))
else
set votekick_votes[j]=votekick_votes[j]+1
set votekick_votes[istart+j]=1
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,8.,"A kick vote has been issued for "+GetPlayerName(q))
if votekick_votes[j] >= VOTES_NEEDED_TO_KICK then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,8.,GetPlayerName(q)+" has been kicked by vote")
call RemovePlayer(q,PLAYER_GAME_RESULT_DEFEAT)
if q==GetLocalPlayer()then
call EndGame(false)
endif
endif
endif
endif
set j=j+1
endloop
set q=null
set b=null
set p=null
endfunction
function VotekickShow takes nothing returns nothing
local player p=GetTriggerPlayer()
local integer id=GetPlayerId(p)
local integer istart=id*12+100
local integer j=0
local player q
call DialogClear(votekick_dialog[id])
call DialogSetMessage(votekick_dialog[id],"|cffffcc00Votekick who?")
loop
exitwhen j>11
set votekick_buttons[istart+j]=null
set q=Player(j)
if GetPlayerSlotState(q)==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(q)==MAP_CONTROL_USER and q!=p then
if votekick_votes[istart+j]!=1then
set votekick_buttons[istart+j]=DialogAddButton(votekick_dialog[id],GetPlayerName(q)+" |r[|cffffcc00Vote|r]",0)
else
set votekick_buttons[istart+j]=DialogAddButton(votekick_dialog[id],GetPlayerName(q)+" |r[|cffffcc00Cancel Vote|r]",0)
endif
endif
set j=j+1
endloop
set votekick_buttons[id]=DialogAddButton(votekick_dialog[id],"Cancel |r[|cffff0000ESC|r]",512)
call DialogDisplay(p,votekick_dialog[id],true)
set p=null
set q=null
endfunction
function main
Spoiler:

Code: Select all

function InitTrig_Votekick takes nothing returns nothing
set votekick_votekick=CreateTrigger()
set votekick_buttonclick=CreateTrigger()
call TriggerAddAction(votekick_votekick,function VotekickShow)
call TriggerAddAction(votekick_buttonclick,function VotekickClick)
call ExecuteFunc("init_votekick")
endfunction
How it works...
A player types "-votekick" and it will open up a dialog for them which contains a list of players who are currently playing and beside their name will be either [Vote] or [Cancel Vote].
At the bottom will be a "Cancel [ESC]" button where pressing ESC will close the dialog.

Three votes or whatever the constant is changed to will be how many votes are required to get booted. You cannot vote or cancel a vote against yourself.
User avatar
Bartimaeus
Tyrannical Drama Queen
Posts: 4441
Joined: November 19th, 2007, 5:05 am
Been thanked: 2 times

Re: Nevo's Request

Post by Bartimaeus »

Well, yeah, of course it's terribly long and inefficient...it's GUI, for goodness sakes, :)

(edit) ...that's a mere mite compared to how long mine is.
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Nevo's Request

Post by Aero »

That's the idea.
You can do more cool things using JASS too.
User avatar
Bartimaeus
Tyrannical Drama Queen
Posts: 4441
Joined: November 19th, 2007, 5:05 am
Been thanked: 2 times

Re: Nevo's Request

Post by Bartimaeus »

Aero wrote:That's the idea.
You can do more cool things using JASS too.
Except, that I lack the intelligence or something to learn it. =/
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Nevo's Request

Post by Aero »

Nah, I reckon anyone can learn it.
Patience is needed more than anything.
User avatar
Bartimaeus
Tyrannical Drama Queen
Posts: 4441
Joined: November 19th, 2007, 5:05 am
Been thanked: 2 times

Re: Nevo's Request

Post by Bartimaeus »

Aero wrote:Nah, I reckon anyone can learn it.
Patience is needed more than anything.
I lack patience, as well as a few other traits.
User avatar
nevo
Old Wrinkly Member
Posts: 233
Joined: June 20th, 2007, 8:53 pm
Title: Nevo
Location: Canada

Re: Nevo's Request

Post by nevo »

Thanks everyone, really appreciate it. :)
My Favorite Rule:
- No excessive BBCode, (colors, flashing text, spoilers, etc.), using; don't use it for every single word you're typing, only use it make a word(s) stand out.
User avatar
nevo
Old Wrinkly Member
Posts: 233
Joined: June 20th, 2007, 8:53 pm
Title: Nevo
Location: Canada

Re: Nevo's Request

Post by nevo »

{BUMP} im not sure if bumping is allowed but...


Okay, so, i have gotten into a problem, the thing is, i made 3 triggers and put all 3 parts in 3 triggers. now, when i click save, it gives me error messages and disables all 3 triggers, whats going on?
My Favorite Rule:
- No excessive BBCode, (colors, flashing text, spoilers, etc.), using; don't use it for every single word you're typing, only use it make a word(s) stand out.
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Nevo's Request

Post by Aero »

i made 3 triggers and put all 3 parts in 3 triggers.
What?

If w.e doesn't save, it's because there is a syntax error in your code or some non-existant variables.
User avatar
nevo
Old Wrinkly Member
Posts: 233
Joined: June 20th, 2007, 8:53 pm
Title: Nevo
Location: Canada

Re: Nevo's Request

Post by nevo »

Its the one you wrote up with the 3 parts, heres a ss of what happens when i try to enable it... :(


Image


Thanks for the help aero. Appreciate it, :)
My Favorite Rule:
- No excessive BBCode, (colors, flashing text, spoilers, etc.), using; don't use it for every single word you're typing, only use it make a word(s) stand out.