System Multi Kick

Status
Not open for further replies.

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Multi Kick!
Created By: Darthfett

Update 8/29/09 v1.21
-The system now requires the use of the Advanced Strings System. The RemoveChar and String2Player (or S2P) function have both been outsourced to this system.
-Renamed String2Player to S2P, for compatibility with Advanced Strings.
-Removed non-vJass version

Update 6/25/09 v1.20:
-The system's player detection has been recoded. (function String2Player)
-It now supports maps with name-changing systems, and maps that allow players to change their color.
-Renamed the abominably long String to player conversion function to "String2Player"

Update 9/29/08 v1.10:
-The system is now a copy and paste system. No more creating the separate starting trigger yourself. :p
-You can no longer kick a player that is not playing.
-Inlined some code a little more, for readability.
-Improved the RemoveChar function very slightly

Update 9/07/08 v1.00:
Since Acehart so gladly helped me with the efficiency of many of my string parsing functions, the speed has been improved, and a lot of useless junk has been removed. A function to do custom actions just before a player is kicked has also been added, since I found it useful in my own map. :)

System created in: vJASS
MUI
MPI
Leakless


This is a Kick function I created because I needed a better one :p

It also ignores capitalization, removes spacing, also allows for host detection, and even supports partial string recognition, which means you can type part of a person's name and it will try to kick them. :)

The host cannot kick the map creator which you can put in your name as the string. The map creator can kick whomever he/she wishes, including the host, and the host may kick whomever he/she wishes except for the map creator.

And now, for the system itself:

Version 1.21:
JASS:
library MultiKick initializer Init uses AdvStrings
//MultiKick!, created by Darthfett v1.21

//Requirements:
//Advanced Strings system

//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, except by the map creator.
//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.
//Supports color changing players as well as maps with name changing systems in place.

//Only the host/map_creator 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 integer temp
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 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
    local player tar = S2P(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.&quot;)
        return true
    endif
    call GetHost()
    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;)
        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 trigger t = CreateTrigger()
    
    set temp = 0
    loop
        exitwhen temp &gt;= 12
        call TriggerRegisterPlayerChatEvent(t,Player(temp),&quot;&quot;,false)
        set temp = temp + 1
    endloop
    call TriggerAddCondition(t,Condition(function Conditions))
endfunction

endlibrary

Feedback is more than welcome! :D
 

Romek

Super Moderator
Reaction score
964
Nice! Useful, although we have a few of these already.

One thing I'd suggest is if you could make "-kick" work with only parts of a players name

So if a players name is "Doom_15£&£%£$%_2488" then "-kick Doom" would work.
You'd need to check if its in more than one players name too however :p
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Nice! Useful, although we have a few of these already.

One thing I'd suggest is if you could make "-kick" work with only parts of a players name

So if a players name is "Doom_15£&£%£$%_2488" then "-kick Doom" would work.
You'd need to check if its in more than one players name too however :p

I don't think it's possible to put strange characters in your name, but I'll add some functionality for it, thanks for the idea! :)
 

Romek

Super Moderator
Reaction score
964

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Name spoofer.

I didn't know the game triggers worked with game spoofers' names. I thought the game held their actual name, and everything that was displayed to other players was the spoofed name. Does anyone know how spoofers actually work?

Kicking a players' number would work with spoofers fine, though.

I'll see what I can do for partial name strings. :)

EDIT:

Well that was easier than I thought. It now supports partial strings. That means even if it's in the middle of the name, it will work. That also means I wouldn't recommend trying -kick a. It would kick the first person with the letter a in their name, lol. :)
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Good system, very good indeed. If it gets approved, I may use it in my map. +rep :thup:
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
590
Make it detect and kick anyone using |r in their name.
Anti-Spoofer! :)
 

UndeadDragon

Super Moderator
Reaction score
447

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Make it detect and kick anyone using |r in their name.
Anti-Spoofer! :)

I'm not quite sure how the game registers spoofed names. I don't exactly have a test subject, either. :p

Not everyone hates spoofers though, so I'll probably put in a boolean that map creators can select to kick spoofers, if this actually works.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
UPDATE to the system:

Since Acehart so gladly helped me with the efficiency of many of my string parsing functions, the speed has been improved, and a lot of useless junk has been removed. A function to do custom actions just before a player is kicked has also been added, since I found it useful in my own map. :)
 

Romek

Super Moderator
Reaction score
964
No, I'm pretty sure spoofed colors use |r.

I'm sure they do too.
It explains why you can't use |r in any chats or anything.

---
Also, instead of doing that tiny little trigger:
Code:
Kick
    Events
        Player - Player 1 (Red) types a chat message containing -kick  as A substring
    Conditions
    Actions
        Custom script:   call KickPlayer(GetTriggerPlayer(),SubString(GetEventPlayerChatString(),6,StringLength(GetEventPlayerChatString()))
Why don't you implement that into the system?
So you just paste the system into a new trigger, and bam! It works. :D
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
I'm sure they do too.
It explains why you can't use |r in any chats or anything.

---
Also, instead of doing that tiny little trigger:
Code:
Kick
    Events
        Player - Player 1 (Red) types a chat message containing -kick  as A substring
    Conditions
    Actions
        Custom script:   call KickPlayer(GetTriggerPlayer(),SubString(GetEventPlayerChatString(),6,StringLength(GetEventPlayerChatString()))
Why don't you implement that into the system?
So you just paste the system into a new trigger, and bam! It works. :D

*shrugs* I was trying to make it so that someone who implements the system can use -ban, -kick, -drop, -remove, etc (whichever they chose).

I'll put that in the system when I can, I've at college right now, so I don't have an editor in front of me. ;)
 

Romek

Super Moderator
Reaction score
964
*shrugs* I was trying to make it so that someone who implements the system can use -ban, -kick, -drop, -remove, etc (whichever they chose).

I'll put that in the system when I can, I've at college right now, so I don't have an editor in front of me. ;)
You could always use constants..
Or even arrays, for multiple choices.

Up to 5.
JASS:
if s<i> == null then
  return
endif</i>

...use 'null' for nothing with the chat messages.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Updated to v1.10.

It will now display an error when trying to kick a player that is not playing.

It also is a copy and paste library now, so you no longer need to create anything that calls the kick function.

You can easily change the command (I'm only going to support one for now, as I don't see much point :p

Read the OP post for all the changes.

To a moderator:
Anything else need changing before this can be approved and moved into the Systems section? Thanks. :)

Anyone have any questions, comments, suggestions?
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
This is going into my map. :)
I would suggest that you stick to the 'naming convention' and make all your global names in block capitals.
 
Status
Not open for further replies.
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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