adding random delay to name update
This commit is contained in:
parent
7b0e7e5ef1
commit
39c4606b3e
@ -7,6 +7,8 @@ int server_ports[2] = {27015, 27075}; //server ports: ze server, simulated serve
|
|||||||
int g_iServerPort;
|
int g_iServerPort;
|
||||||
int g_iClientIndexUserIDMapping[MAXPLAYERS + 1];
|
int g_iClientIndexUserIDMapping[MAXPLAYERS + 1];
|
||||||
|
|
||||||
|
char g_cClientNewName[MAXPLAYERS + 1][128];
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -42,6 +44,20 @@ public void OnPluginStart()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action update_client_name(Handle hTimer, int Serial)
|
||||||
|
{
|
||||||
|
int client;
|
||||||
|
if ((client = GetClientFromSerial(Serial)) == 0)
|
||||||
|
{
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
if (IsValidClient(client))
|
||||||
|
{
|
||||||
|
SetClientName(client, g_cClientNewName[client]);
|
||||||
|
}
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
public Action read_info_over_txt(Handle timer, any data)
|
public Action read_info_over_txt(Handle timer, any data)
|
||||||
{
|
{
|
||||||
new Handle:fileHandle = OpenFile("/addons/sourcemod/logs/simulate.txt", "r");
|
new Handle:fileHandle = OpenFile("/addons/sourcemod/logs/simulate.txt", "r");
|
||||||
@ -117,7 +133,12 @@ public Action read_info_over_txt(Handle timer, any data)
|
|||||||
{
|
{
|
||||||
int clientFrag = StringToInt(sPart[1]);
|
int clientFrag = StringToInt(sPart[1]);
|
||||||
SetEntProp(i, Prop_Data, "m_iFrags", clientFrag);
|
SetEntProp(i, Prop_Data, "m_iFrags", clientFrag);
|
||||||
SetClientName(i, sPart[2]);
|
|
||||||
|
if (!StrEqual(g_cClientNewName[i], sPart[2]))
|
||||||
|
{
|
||||||
|
CreateTimer(GetRandomFloat(1.0, 55.0), update_client_name, GetClientSerial(i));
|
||||||
|
}
|
||||||
|
Format(g_cClientNewName[i], sizeof(g_cClientNewName[]), sPart[2]);
|
||||||
//indicating that the client still exists right now.
|
//indicating that the client still exists right now.
|
||||||
current_ClientUserID_iteration[i] = ClientUserID;
|
current_ClientUserID_iteration[i] = ClientUserID;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user