dataviruset / sm-hosties

The ultimate jailbreak plugin for SourceMod
https://forums.alliedmods.net/forumdisplay.php?f=155
GNU General Public License v3.0
29 stars 27 forks source link

add sv_tags without removing sv_tags from .cfg #44

Closed shanapu closed 8 years ago

shanapu commented 8 years ago

old way overwrite sv_tags setted by user in .cfg and set hosties tag instead. new way will check for hosties tag, if not found it will be added to the sv_tags set by player. no lost of tags

all credits for this code to Headline22 https://github.com/Headline22/Hunger-Games-Beacon/

Bara commented 8 years ago

Hosties2 uses the old syntax.

shanapu commented 8 years ago

Im not so familar with old syntax.

how about this?

    if (GetConVarInt(gH_Cvar_Add_ServerTag) == 1)
    {
        new Handle:hTags = FindConVar("sv_tags");
        decl String:sTags[128];
        GetConVarString(hTags, sTags, sizeof(sTags));
        if (StrContains(sTags, SERVERTAG, false) == -1)
        {
            decl String:sTagsFormat[128];
            Format(sTagsFormat, sizeof(sTagsFormat), ", %s", SERVERTAG);

            StrCat(sTags, sizeof(sTags), sTagsFormat);
            SetConVarString(hTags, sTags);
        }
    }
data-bomb commented 8 years ago

This looks good now. I will add a CloseHandle for hTags to be safe.