Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <clientprefs>
- #include <cstrike>
- #pragma newdecls required
- #define PREFIX "\x01\x0B \x07[TAGS]\x04"
- Handle tag_cookie;
- char players_tag[MAXPLAYERS +1][13];
- public Plugin myinfo =
- {
- name = "Custom tags for VIP's",
- author = "Super Timor",
- version = "1.0.0",
- description = "",
- url = "https://cs-placzabaw.pl"
- };
- public void OnPluginStart()
- {
- HookEvent("player_spawn", OdrodzenieGracza);
- tag_cookie = RegClientCookie("tag_name", "Player's custom tag", CookieAccess_Private);
- RegConsoleCmd("sm_tag", SetTag);
- }
- public void OnClientCookiesCached(int client)
- {
- if(!IsValidClient(client) || IsFakeClient(client))
- return;
- char sCookie[1024];
- GetClientCookie(client, tag_cookie, sCookie, sizeof(sCookie));
- if(!StrEqual(sCookie, ""))
- {
- strcopy(players_tag[client], sizeof(players_tag[]), sCookie);
- CS_SetClientClanTag(client, players_tag[client]);
- }
- }
- public Action SetTag(int client, int args)
- {
- if(GetUserFlagBits(client) & ADMFLAG_RESERVATION)
- {
- if (args < 1)
- {
- ReplyToCommand(client, "%s Użycie: sm_tag [tag]", PREFIX);
- return Plugin_Handled;
- }
- char arg[13];
- if (args == 1)
- {
- char arg2[15];
- GetCmdArg(1, arg2, sizeof(arg2));
- int taglen = strlen(arg2);
- if (taglen > 12)
- PrintToChat(client, "%s Tag musi zawierać mniej, niż 13 znaków!", PREFIX);
- else
- {
- GetCmdArg(1, arg, sizeof(arg));
- SetClientCookie(client, tag_cookie, arg);
- CS_SetClientClanTag(client, arg);
- PrintToChat(client, "%s Zmieniono tag na : %s", PREFIX, arg);
- }
- }
- return Plugin_Continue;
- }
- else
- {
- PrintToChat(client, "%s Ta funkcja jest dostępna tylko dla VIP!", PREFIX);
- }
- return Plugin_Continue;
- }
- public void OdrodzenieGracza(Event event, const char[] name, bool dontBroadcast)
- {
- int client = GetClientOfUserId(GetEventInt(event, "userid"));
- if(!IsValidClient(client))
- return;
- CS_SetClientClanTag(client, players_tag[client]);
- }
- stock bool IsValidClient(int client)
- {
- if (client > 0 && client <= MAXPLAYERS && IsClientInGame(client))
- return true;
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement