PDA

View Full Version : [CS:GO] do sth every X seconds


daxiuuu
07-09-2016, 08:18
hi, im looking for plugin which will do sth every X seconds. i mean i want to have r_cleardecals plugin on my aim+dm server. atm i have that


#include <sourcemod>

public OnPluginStart()
{
HookEvent("player_death", Event_Death);
}

public Event_Death(Handle:event, const String:name[], bool:dontBroadcast)
{
for (new i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i)) continue;

FakeClientCommand(i, "r_cleardecals");
}
} can someone help me and tell me what is the event for time instead of player_death ?

and will it be working?

xines
07-09-2016, 08:31
Guess this is what you want?

public void OnPluginStart()
{
CreateTimer(5.0, UpdateFrame, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}

public Action UpdateFrame(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i))
{
FakeClientCommand(i, "r_cleardecals");
}
}
}

daxiuuu
07-09-2016, 08:39
i dont know :D i think this is it, i will test it

daxiuuu
07-09-2016, 08:58
not working :<

CamerDisco
07-09-2016, 09:00
He gave you good solution, we don't know what do you mean.

xines
07-09-2016, 09:29
not working :<

Notice this: https://sm.alliedmods.net/new-api/console/ClientCommand

#include <sourcemod>

public void OnPluginStart()
{
CreateTimer(5.0, UpdateFrame, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}

public Action UpdateFrame(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i))
{
ClientCommand(i, "r_cleardecals");
}
}
}

daxiuuu
07-11-2016, 06:07
i want to have plugin which in every 5 seconds will make map clear off the blood, bullets.

Mitchell
07-11-2016, 10:10
I'm pretty sure there is a server side way of clearing decals.
running r_cleardecals on clients is bad practice and I'm not even sure you can.