Get the newgen out!

danpe

New Member
Reaction score
5
Help installing a "Kick System"

How do i install this system in my map?

JASS:
library MultiKick initializer Init
//MultiKick!, created by Darthfett v1.10

//Features:
//Works with player names, colors, AND numbers!!
//
//
//It removes spaces
//Ignores capitalization
//has functionality for both spellings of grey/gray
//The map creator cannot be kicked, unless the system itself is edited.
//The host cannot be kicked, unless the system itself is edited.
//It also detects the host for you
//It also supports partial strings, which means you can type -kick Darth, and it would 
//kick the first person with "Darth" in their name.

//Only the host may kick, votekicking is not supported.

globals
    private constant string creator = "Darthfett"   
    //If you want to make this a bit harder to change, remove this here, 
    //and replace the variable in the functions below.
    private constant string command = "-kick"
    //=============================
    //Don&#039;t mess with the rest <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink    ;)" loading="lazy" data-shortname=";)" />
    //=============================
    private player host
    private string array PlayerNames         //EX: White text of the exact name of the player at map initialization
    private string array PlayerColors        //EX: &quot;Red&quot;, &quot;Blue&quot;
endglobals

private function PlayerKicked takes player p returns nothing
    //This function runs just before a player is kicked.
    //Fill this in with whatever you wish.
endfunction

private function RemoveChar takes string str, string char returns string
    //Removes all instances of one character from an entire string.
    //Thanks to AceHart for reducing amount of SubString calls.
    local integer i = 0
    local string s = &quot;&quot;
    local string c
    loop
        set c = SubString(str, i, i + 1)
        exitwhen c == null or c == &quot;&quot;
        if c != char then
            set s = s + c
        endif
        set i = i + 1
    endloop
    set str = s
    return str
endfunction

private function StringContainsString takes string str, string partial returns boolean
    //Returns true if the full string is contained inside.  Capitalization matters!
    local integer i = 0
    local integer l = StringLength(partial)
    local integer l2 = StringLength(str)
    loop
        exitwhen i &gt; l2
        if SubString(str,i,i+l) == partial then
            return true
        endif
        set i = i + 1
    endloop
    return false
endfunction

private function GetPlayerFromFormattedString takes string argstr returns player
    local string str = StringCase(RemoveChar(argstr,&quot; &quot;),false) //this is getting rid of capitalization and spaces
    local integer i = 0
    //First determine whether it is a player name, color, or number
    loop //Loop to see if it is a number, the simplest loop
        exitwhen i &gt;= 12
        if i == S2I(str) - 1 then
            return Player(i)
        endif
        set i = i + 1
    endloop
    set i = 0
    loop //Loop to see if it is a player&#039;s name.
        exitwhen i &gt;= 12
        if StringCase(PlayerNames<i>,false) == str then
            return Player(i)
        endif
        set i = i + 1
    endloop
    set i = 0
    if str == &quot;grey&quot; then 
        //Some countries have different ways of spelling gray/grey, 
        //so if it is not a name or number, it will check for this spelling.
        return Player(8) //8 is Grey/Gray&#039;s player number.
    endif
    loop //Loop to see if it is a player&#039;s color.
        exitwhen i &gt;= 12
        if StringCase(RemoveChar(PlayerColors<i>,&quot; &quot;),false) == str then
            return Player(i)
        endif
        set i = i + 1
    endloop
    set i = 0
    loop
        exitwhen i &gt;= 12
            if StringContainsString(StringCase(PlayerNames<i>,false),str) then
                return Player(i)
            endif
        set i = i + 1
    endloop
    debug call BJDebugMsg(&quot;INVALID&quot;)
    return null //If it cannot recognize either a player&#039;s name or color from the string given, it will give an invalid player number.
endfunction

private function GetHost takes nothing returns nothing
    local gamecache g = InitGameCache(&quot;Map.w3v&quot;)
    call StoreInteger ( g, &quot;Map&quot;, &quot;Host&quot;, GetPlayerId(GetLocalPlayer ())+1)
    call TriggerSyncStart ()
    call SyncStoredInteger ( g, &quot;Map&quot;, &quot;Host&quot; )
    call TriggerSyncReady ()
    set host = Player( GetStoredInteger ( g, &quot;Map&quot;, &quot;Host&quot; )-1)
    call FlushGameCache( g )
    set g = null
endfunction

function KickPlayer takes player kicker, string target returns boolean //target is the player to be kicked, lol
    local player tar = GetPlayerFromFormattedString(target)
    if tar == null then
        call DisplayTextToPlayer(kicker,0,0,&quot;Invalid Player&quot;)
        return false
    endif
    
    if GetPlayerSlotState(tar) != PLAYER_SLOT_STATE_PLAYING then
        call DisplayTextToPlayer(kicker,0,0,&quot;That player is not playing!&quot;)
        return false
    endif
    
    if tar == kicker then
        call DisplayTextToPlayer(kicker,0,0,&quot;You cannot kick yourself!&quot;)
        return false
    endif
    if GetPlayerName(tar) == creator then
        call DisplayTextToPlayer(kicker,0,0,&quot;You cannot kick the creator of the map!&quot;)
        return false
    endif
    if GetPlayerName(kicker) == creator then
        //Creator kicking someone.
        call PlayerKicked(tar)
        call RemovePlayer(tar,PLAYER_GAME_RESULT_DEFEAT)
        call DisplayTextToPlayer(GetLocalPlayer(),0,0,GetPlayerName(tar) + &quot; has been kicked!&quot;)
        call CustomDefeatDialogBJ(tar,&quot;You have been kicked by the map creator. Pay attention next time.&quot;)
        call GetHost()
        return true
    endif
    if kicker == host then
        //host kicking someone
        call PlayerKicked(tar)
        call RemovePlayer(tar,PLAYER_GAME_RESULT_DEFEAT)
        call DisplayTextToPlayer(GetLocalPlayer(),0,0,GetPlayerName(tar) + &quot; has been kicked!&quot;)
        call CustomDefeatDialogBJ(tar, &quot;You have been kicked.&quot;)
        call GetHost()
        return true
    endif
    call DisplayTextToPlayer(kicker,0,0,&quot;Only the host may kick another player.&quot;)
    return false
endfunction

private function Conditions takes nothing returns boolean
    if StringCase(SubString(GetEventPlayerChatString(),0,StringLength(command)),false) == StringCase(command,false) then
        call KickPlayer(GetTriggerPlayer(),SubString(GetEventPlayerChatString(),StringLength(command),StringLength(GetEventPlayerChatString())))
    endif
    return false
endfunction

private function Init takes nothing returns nothing
    local integer i = 0
    local trigger t = CreateTrigger()
    loop
        exitwhen i &gt;= 12
        call TriggerRegisterPlayerChatEvent(t,Player(i),&quot;&quot;,false)
        set i = i + 1
    endloop
    call TriggerAddCondition(t,Condition(function Conditions))
    set i = 0
    loop
        exitwhen i &gt;= 12
        set PlayerNames<i> = GetPlayerName(Player(i))
        set i = i + 1
    endloop
    set i = 0
    
    set PlayerColors[0] = &quot;Red&quot;
    set PlayerColors[1] = &quot;Blue&quot;
    set PlayerColors[2] = &quot;Teal&quot;
    set PlayerColors[3] = &quot;Purple&quot;
    set PlayerColors[4] = &quot;Yellow&quot;
    set PlayerColors[5] = &quot;Orange&quot;
    set PlayerColors[6] = &quot;Green&quot;
    set PlayerColors[7] = &quot;Pink&quot;
    set PlayerColors[8] = &quot;Gray&quot;
    //capitalization is ignored
    //There is functionality in the trigger for the &quot;grey&quot; spelling of the word.
    //Spaces are also ignored, so lightblue works just the same as light blue.
    set PlayerColors[9] = &quot;Light Blue&quot;
    set PlayerColors[10] = &quot;Dark Green&quot;
    set PlayerColors[11] = &quot;Brown&quot;
endfunction

endlibrary</i></i></i></i>


I copy paste it into my Map Header and it gives me 2450 errors...
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Considering it's a library you would not need to place it in the header at all. What you do need on the other hand is NewGen, without it the code will not compile, resulting in a huge amount of errors.
 

danpe

New Member
Reaction score
5
Please Help! Compile Errors!

Listen,
i had a custom trigger and i had to compile the map with NewGen editor...
now i dont want that trigger anymore.. when i delete it and saves (With normal editor)
it gives me 149 errors on that trigger that i deleted...

How can i fix it?
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EDIT:
I tried to compile another map that has nothing to do with the other one that has the erorrs
and it has the same errors...

WTF?!
 

iPeez

Hot food far all world wide!
Reaction score
165
1) Do you have more than one script?

2) And how do you get errors on a deleted trigger :O?
 

danpe

New Member
Reaction score
5
It sais the error is in

BlaBlaTemp.war3map.j [BlaBla = Name of the map]
it heppends in everymap i try to save...
it works only if i use NewGen Editor...

and i dont wanna use it...
 

danpe

New Member
Reaction score
5
Guys...

seriusly im ****ed up i cant save anymap...
i cant work with World Editor...
Please PLEASE PLEASE!!!!!!


SOMEONE HELP ME!!!!!!!!!!!!!!
 

HydraRancher

Truth begins in lies
Reaction score
197
God dont be so shouty or people wont reply.
Its common editor sense. Once you use an editor you cant change back to the original one >.> you have to keep using newgen.
 

Crusher

You can change this now in User CP.
Reaction score
121
I don't think so ..

Try to disable the trigger 1st , then save the map , then open it again and then delete it.
 

danpe

New Member
Reaction score
5
NewGen help!

How can i use Advanced actions?

im using
Code:
Advanced - Initialize advanced triggers
at map initilization and i get thie error:
Code:
[B]Line 974: Undeclared function InitAdvancedTriggers[/B]
Line 974:
JASS:
call InitAdvancedTriggers(  )
 

XeNiM666

I lurk for pizza
Reaction score
138
I see your using (used) WEU and opened you map with NewGen? Theres something in the Extensions that allows the advanced triggers in there
 

danpe

New Member
Reaction score
5
... i really dont know what im using...

i downloaded the JassNewGen pack and extracted all to the Warcraft 3 directory...
When i open my map with the NewGen editor the title is: "Warcraft ||| World Editor Unlimited 1.20 - "

and in the Extensions i got "Enable Local Files" & "Register Shell Extensions" checked.
 

XeNiM666

I lurk for pizza
Reaction score
138
I checked. I think its UMSWE - Enable UMSWE or somethign in there. Not really sure, havent use WEU even once
 

danpe

New Member
Reaction score
5
"Integrate WEU" is in "Girimoire"...
i checked it and still not working...

i think it cuz Girimoire dosent work on 1.22 patch...

Another way to make Advanced actions work?

I did what they say Here and still dosent work...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top