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 »

Ok...I know your problem...

By function main I meant the function main in the j script.

To solve your problem, do this:

Create a trigger called: Votekick

Put ALL the code into this trigger (globals, code and function main code).
Dont rename anything from what you have now.
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 »

Okay, so i put them all in one trigger "votekick" and just added a blank line to seperate them, so, i go and click save and it gives me this error. :(

Image
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 »

function init_votekick needs to be at the top of all the code, right below globals.
Also, make sure you do not have 2 of the same function (or functions that are named the same thing.)
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 »

Okay, i know this might be quite a bother, but, lets just start from scratch, can you tell me exactly what i have to do step by step so i get it right? Thanks, :D
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 »

Create ONE trigger called "Votekick".
Convert it to custom text and delete any code that is there.
In it, paste the following:

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

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 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
That's it. For real.
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 »

Aero, i love you, it worked like a charm! :D
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.