Resource icon

[Open Assets] bitten's sendcolor hang fix bv8

What permissions do you give others to modify and/or maintain your submission?
Modify: YES - Maintain: YES - I give permission for my entire submission to be modified by others or used in their own work. I give permission for my entire submission to be maintained by others as well.
I made sure my file(s) follow the Submissions Guidelines
  1. Yes
I named my file(s) correctly (see Filename Conventions)
  1. Yes
This addon is a modification of sendcolor v7 which fixes the currently known issues that allow you to make the the client, and the server you are playing on to hang. Most of the rest of this description has been is copied from the original post as well, except for a few parts (namely the changelogs have only v8 and tells you to check the original addon for older changelogs and the part mentioning the bugs this fixes has been removed)
This script lets any player send a custom skincolor to the server by using the SENDCOLOR command in the console. You can also download the skincolors uploaded by other players! You can define this color in a text file: sendcolor.txt, placed in the luafiles/client folder in your SRB2 folder. At the bare minimum, the file could be just five lines like this:
Code:
City
48,218,51,221,33,203,203,185,185,185,186,186,186,186,187,187
SKINCOLOR_AZURE
6
V_ORANGEMAP
In order, that's equivalent to name, ramp, invcolor, invshade, and chatcolor, but without the additional syntax you'd use for a Lua or SOC definition. However, you can use those definitions as well, and even pack multiple colors into one file! Check under the spoiler for more detailed formatting information:
The sendcolor format boils down to nine lines in your text file:

-autosend
-metadata name
-metadata author
-metadata uploader
-color name
-color ramp
-color invcolor
-color invshade
-color chatcolor

These lines must be in this order, without extra lines in between, or any missing lines - aside from the autosend and metadata, which are optional. Anything after these nine lines (for example, ACCESSIBLE) is not read. You can include multiple colors in one file.

Including #AUTOSEND at the beginning of your definition serves two purposes. When you first join a game, the script will check to see if you have an autosend color in sendcolor.txt. If you do, it will be automatically sent. In addition, when you use the SENDCOLOR command without any arguments, or with the argument -auto, it will search for an autosend color.

Metadata is optional and consists of three lines. If metadata is used, all three lines must be present. All three lines are prepended with the #, used to indicate a SOC comment. The first line simply identifies the color:
Code:
#METADATA = City
You can use a different name than the actual color name, in which case you would use the metadata name rather than the actual name when you SENDCOLOR.

The second line is the author of the color. This will be broadcast when this color is uploaded and saved if another player SAVECOLORs that color. Spaces are allowed, but quotes should be used:
Code:
#AUTHOR = "Big Chungus"
Remember that this line must be accounted for when using metadata, even if there's no author - simply use an empty string:
Code:
#AUTHOR = ""
The third line is the uploader of the color - this is saved automatically when you use SAVECOLOR to save a color someone else uploaded. If you're writing your own metadata, you should leave this blank:
Code:
#UPLOADER = ""
The next five lines are the actual color data. You can generally just copy/paste a SOC or Lua definition in, but there are a few key differences. Most importantly, these five lines must be in the exact order shown in the examples below. For the invcolor and chatcolor fields, you can use either their respective constants, or actual numbers.

Full example, "SOC" style:
Code:
#AUTOSEND
#METADATA = City
#AUTHOR = "kays"
#UPLOADER = ""
NAME = City
RAMP = 48,218,51,221,33,203,203,185,185,185,186,186,186,186,187,187
INVCOLOR = SKINCOLOR_AZURE
INVSHADE = 6
CHATCOLOR = V_ORANGEMAP
ACCESSIBLE = TRUE
Bare bones definition:
Code:
City
48,218,51,221,33,203,203,185,185,185,186,186,186,186,187,187
SKINCOLOR_AZURE
6
V_ORANGEMAP
Using #AUTOSEND without metadata, "Lua" style:
Code:
#AUTOSEND
name = "City",
ramp = {48,218,51,221,33,203,203,185,185,185,186,186,186,186,187,187},
invcolor = SKINCOLOR_AZURE,
invshade = 6,
chatcolor = V_ORANGEMAP,
accessible = true
Check the info under the commands spoiler tag below for details on how to read from different files, choose specific colors, automatically send a color on join, etc.

Commands:
Code:
********************************
SENDCOLOR [<colorname> [<file>]]
********************************
 Sends a color to the server for use. If used without arguments,
it will look in sendcolor.txt for a color marked with the line #AUTOSEND
above it. Failing that, it will attempt to read a color from the first line
of the file. Otherwise, it will look for the colorname you specify.

 You can specify a file to look in other than sendcolor.txt, but
it must still be in the luafiles/client folder. You can use
"SENDCOLOR -auto <file>" to use the #AUTOSEND behavior
with a specific filename.

 If the color is successfully sent, the script will attempt to
change your color - but only if you're allowed (e.g., not while
moving or in a team game).

******************************
SAVECOLOR <colorname> [<file>]
******************************
 Appends a SOC definition for color <colorname> into your
sendcolor.txt or other specified file. You can use this on any color,
even standard colors or custom colors not loaded through this script.

****************************
SETAUTO <colorname> [<file>]
****************************
 Modifies sendcolor.txt or other specified file to set color <colorname>
as your AUTOSEND. This color should already exist in this file.
Admin commands/variables:
Code:
*****************************
ALLOWRESEND <-1, 0, or 1-300>
*****************************
 -1: Each player can only send a color once, until ALLOWRESENDPLAYER
or CLEARCOLORS is used. Set by default.

 0: Each player can send a color once per map, unless ALLOWRESENDPLAYER
or CLEARCOLORS is used.

 1-300: Cooldown in seconds between a player sending a color and being
able to send another.

 Note that the server and admins are unaffected by this setting, and
can always send a new color.

******************************
ALLOWRESENDPLAYER <playername>
******************************
 Removes any ban or cooldown on this player, allowing them to send
another color (unless COLORLOCK is enabled).

******************
COLORLOCK <on/off>
******************
 When on, players cannot send colors. The server and admins are
unaffected.

**********************
COLORBAN <player name>
**********************
 Removes the color sent by this player, and prevents them from
sending colors until access is regranted through ALLOWRESENDPLAYER

*******************************
REMOVEPLAYERCOLOR <player name>
*******************************
 Removes the color sent by this player, without explicitly
banning them from sending. Note that depending on your ALLOWRESEND
setting they may still be unable to send another color.

***********
CLEARCOLORS
***********
Removes all sent colors from the server, and resets all
players' cooldowns, except for those who have been COLORBAN'd.
You are welcome to modify this, pack into other addons, etc
v8
  • fixed the bug where if the name starts with a number srb2 will hang
  • fixed some metadata stuff
for older versions check sendcolor v7
Author
bitten2up
Downloads
200
Views
851
Extension type
lua
File size
15.5 KB
MD5 Hash
37ea8bdf341df587a8cd5901a9c36844
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from bitten2up

Share this resource

Latest updates

  1. change filename

    changed filename to prevent confusion
Back
Top