The online racing simulator
Code Fail
(6 posts, started )
Code Fail
Hello, my friend are making a "siren" for his cruise server when someone starts a chase it comes up in the screen.
It just doesn´t work,
PLEASE! Help us!
P.S. It doesn´t give any errors, it just won´t show up.

void Siren_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
foreach (clsConnection C in Connections)
{
if (C.Siren != 0)
{
if (C.Siren == 1)
{
InSim.Send_BTN_CreateButton("^4(((((^7SIREN^4)))))", Flags.ButtonStyles.ISB_C1, 15, 74, 60, 63, 151, C.UniqueID, 2, fal
C.Siren = 10;
}
else if (C.Siren > 9)
{
if (C.Siren > 14)
C.Siren = 10;
InSim.Send_BTN_CreateButton("^4" + "((((".Insert((C.Siren % 10), "^1(^4") + "^7" + "SIREN" + "^4" + "))))".Insert(4 - (C.Siren % 10), "^1)^4"), Flags.ButtonStyles.ISB_C1, 15, 74, 60, 63, 151,
C.Siren++;
}
else if (C.Siren == 3)
{
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN, 151, C.UniqueID);
C.Siren = 0;
}
}
}

jesus, this community should make a Live For Cr00ze Server bcuz every thread on LFS Programmer thread is about Cr00ze InSim.

Me: ahh sorry if i post another useless posts.
Says the guy who was an developer in a cruise server
I can give you only very general programming advice, but are you sure that the conditions for siren (de)activation are actually met? Perhaps you can try dumping something like "Siren activated" to console or chat to check.
its probably the SIREN was disabled in form1_loader

EDIT: and the system timer wont recognize it
Your code could also use some cleaning up, for example like this


void Siren_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
foreach (clsConnection C in Connections)
{
if(C.Siren == 1)
{
InSim.Send_BTN_CreateButton(/*blah*/);
C.Siren = 10;
}
else if (C.Siren > 9)
{
if (C.Siren > 14)
{
C.Siren = 10;
}
InSim.Send_BTN_CreateButton(/*blah*/);
C.Siren++;
}
else if (C.Siren == 3)
{
InSim.Send_BFN_DeleteButton(/*blah*/);
C.Siren = 0;
}
}
}


Code Fail
(6 posts, started )
FGED GREDG RDFGDR GSFDG