Bonjour,
J'ai un problème avec un plugin jour et nuit que j'ai trouvé dans un RolePlay. Je voudrais afficher l'heure en continue en PrintHintText mais ça ne fonctionne pas, comment faire ?
Merci :)
J'ai un problème avec un plugin jour et nuit que j'ai trouvé dans un RolePlay. Je voudrais afficher l'heure en continue en PrintHintText mais ça ne fonctionne pas, comment faire ?
Code:
public OnPluginStart(){
HookEvent("round_start", OnRoundStart);
}
public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
CreateTimer(0.7, horloge, client, TIMER_REPEAT);
}
public OnMapStart()
{
startheure();
}
public startheure()
{
Timers = CreateTimer(1.0, Timer_Horloge, _, TIMER_REPEAT);
}
public OnMapEnd()
{
KillTimer(Timers);
}
public Action:Timer_Horloge(Handle:timer, any:client)
{
g_countminute2 += 1;
if (g_countminute2 >= 10)
{
g_countminute2 = 0;
g_countminute1 = g_countminute1 + 1;
if ((g_countminute1 >= 6) && (g_countminute2 >= 0))
{
g_countminute1 = 0;
g_countheure2 = g_countheure2 + 1;
if (g_countheure2 >= 10)
{
g_countheure2 = 0;
g_countheure1 = g_countheure1 + 1;
}
}
}
if ((g_countheure1 >= 2) && (g_countheure2 >= 4))
{
g_countheure1 = 0;
g_countheure2 = 0;
for (new i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) > 1)
{
//.....
}
}
}
if (g_countheure1 == 0 && g_countheure2 == 8 && g_countminute1 == 0 && g_countminute2 == 0)
{
SetLightStyle(0, "l");
PrintToChatAll("%s Le jour vient de se lever.", LOGO);
new maxent = GetMaxEntities(), String:szClass[65];
for (new i = MaxClients; i <= maxent; i++)
{
if(IsValidEdict(i) && IsValidEntity(i))
{
GetEdictClassname(i, szClass, sizeof(szClass));
if(StrEqual("light_dynamic", szClass))
{
RemoveEdict(i);
}
}
}
}
if (g_countheure1 == 1 && g_countheure2 == 9 && g_countminute1 == 0 && g_countminute2 == 0)
{
SetLightStyle(0, "b");
PrintToChatAll("%s La nuit vient de tomber.", LOGO);
}
}
public Action:horloge(Handle:timer, any:client)
{
for(new i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i))
{
PrintHintText(client, "Horloge: %i%ih%i%i", g_countheure1, g_countheure2, g_countminute1, g_countminute2);
}
}
return Plugin_Handled;
}