So i've did a simple plugin which you can choose what hitmarker you want.
But if you use it too many times it crashes the sv ( only sometimes (with more than 1 player))
Any ideas?
Code:
Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <clientprefs>
public Plugin myinfo =
{
name = "Hitmarker menu",
author = "roby & zauni",
description = "",
version = "",
url = ""
};
#define TAG "\x01[\x10ERA\x01]"
int hm = 1; // hitmarker, default (1) = erawings, 2 = evil
int sv_clients[MAXPLAYERS + 1]; // client array (each client will have X hitmarker, default = 1)
Handle hitmarkerCookie;
public OnPluginStart()
{
RegConsoleCmd("sm_hitmarker", MenuHM);
RegConsoleCmd("sm_hitmarkers", MenuHM);
RegConsoleCmd("sm_hitmark", MenuHM);
HookEvent("player_death", EnDamage);
hitmarkerCookie = RegClientCookie("hitmarker", "Hitmarker Choice", CookieAccess_Protected);
}
public void OnClientCookiesCached(int client)
{
if (IsFakeClient(client))
return;
if(IsClientConnected(client))
{
char buffer[32];
GetClientCookie(client, hitmarkerCookie, buffer, sizeof(buffer));
if (StrEqual(buffer, "0")) sv_clients[client] = 0;
if (StrEqual(buffer, "1")) sv_clients[client] = 1;
if (StrEqual(buffer, "2")) sv_clients[client] = 2;
if (StrEqual(buffer, "3")) sv_clients[client] = 3;
if (StrEqual(buffer, "4")) sv_clients[client] = 4;
if (StrEqual(buffer, "5")) sv_clients[client] = 5;
if (StrEqual(buffer, "6")) sv_clients[client] = 6;
}
}
public Action MenuHM(int client, int args)
{
Menu menu = new Menu(MenuHM_CB);
menu.SetTitle("Choose your hitmarker!");
menu.AddItem("1", "E");
menu.AddItem("2", "E");
menu.AddItem("3", "C");
menu.AddItem("4", "C");
menu.AddItem("5", "K");
menu.AddItem("6", "K");
menu.Display(client, MENU_TIME_FOREVER);
return Plugin_Handled;
}
public int MenuHM_CB(Menu menu, MenuAction action, int param1, int param2)
{
switch (action)
{
case MenuAction_Select:
{
char item[32], hm_name[16];
menu.GetItem(param2, item, sizeof(item), _, hm_name, sizeof(hm_name));
hm = StringToInt(item);
sv_clients[param1] = hm;
PrintToChat(param1, "%s \x04You chose \x0F%s\x04 hitmarker.", TAG, hm_name);
SetClientCookie(param1, hitmarkerCookie, item);
}
case MenuAction_End: { sv_clients[param1] = 1; delete menu; }
case MenuAction_Cancel: { sv_clients[param1] = 1; delete menu; }
}
}
__________________