Evo kako sam ja to sad zamislio,i sada funkconira, jel ovako uredu?
u timer sam stavio kad se timer pozove da pozove opciju public HostNameChangerStarted,a taj isti public opet poziva timer hostnaamechanger.
ako ima tko bolju ideju, slobodno neka napise 🙂
task koristim za druge stvari i ne bih ubacio hostname changer, jer zelim da se pali kasnije,ali imam ideju da ubacim u task, i da definiram kad je server ucitan, i da taj task provjerava jel server ucitan, i ako je ucitan ( definiram tipa ServerLoaded = 1 nakon sta produ sva ucitavanja ) i onda kad je na 1, ovaj sistem bi radio da mjenja ime svakih 7 sekundi
//TIMER ZA HOSTNAMECHANGER
timer HostNameChanger()
{
static
index,
str;
if (index == sizeof(g_aServerNames) - 1)
index = 0;
format(str, sizeof(str), "hostname %s", g_aServerNames[index++]);
SendRconCommand(str);
print("TEST: PROMJENIO IME I ZA 7 SEKUNDI OPET MJENJAM");
HostNameChangerStarted();
return 0;
}
public HostNameChangerStarted()
{
defer HostNameChanger();
return 1;
}
V01D wrote on May 11, 2024, 4:06 pm:
https://gtablkn.gg/forum/tutorijali-u-vezi-sa-mpa/y-timers#post-728590
vidio sam englensku verziju i uhvatio se je citat, mislim da sam skuzio sada kako tocno funkconira y timers, cak sam i pronasao kako cu gasiti player timere
evo ovdje cu ubaciti pa ako netko novi u y timers da i on zna kako sta
/* Set all cells to -1 */
new Timer:myTimer = {Timer:-1, ...};
/* Start the timer */
CMD:mycommand(playerid, params[])
{
myTimer = repeat MyOwnFunction(playerid);
/* MyOwnFunction will be called 1 second after we type the
command, due the delay parameter from timer, that's how it works. */
return 1;
}
/* Declare MyOwnFunction as a timer */
timer MyOwnFunction(playerid)
{
printf("The player who started timer %d has the ID %d.", _:myTimer, playerid);
// This function will print the same message every second.
}
/* Stop the timer */
COMMAND:stoptimer(playerid, params[])
{
if(myTimer != Timer:-1)
{
stop myTimer;
myTimer = Timer:-1;
}
else
{
// The timer isn't running.
}
return 1;
}