Timers,timers and more timers
#1

Ok i have been looking into strange things on a modified version of SATDM~RP.:V9,anyways to the point i have 29 timers running in this gamemode(please note this is less than the orignal).

My question's are could these timers,cause overcpu usage on the server(i added another timer and bingo i got e-mails )
Make other things like player files or vehicle files,being corrupted ?

Anyways to a fix,i was wondering if i could cut all these timers down to say 3 or 4 timers and would this help,but still keeping everything running that is needed,say 29 things that need timers,confused so am i .

or a simple way say 4 timers 1 at 5 mins,1 at 10mins and so on and so on.then just use timer 1 for saving files,timer 2 for jail,unjail,wanted and so on.....

you get the drift,hope you do because now im lost

Or any other idea's would be appreciated
Reply
#2

ok try put for example all that run at 10 min into one section like say jail, random messages,weather and try make it all one function and try that
also make sure you forward the functions for example on my lookinsengine i did forward Starting(playerid); then did public Starting(playerid)

i hope i helped =D
Reply
#3

Ok lookin cheers and as i said it looks like no one else will help so i will just go it alone
Reply
#4

ok but let me know if my ideas on it works
Reply
#5

Depends what the timers do and how often they do it. Make sure to use things like foreach if you are doing large loops.
Reply
#6

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
Depends what the timers do and how often they do it. Make sure to use things like foreach if you are doing large loops.
on to it bro didn't think about that xD

trust the kiwis to try fix problems eh =D
Reply
#7

Yea, Im a Kiwi, Im From Wellington, i also Do suggest The Normal Amount Of times, Cause I did it And it Litterally Damaged my C: Drive..




__________________________________________________ ________________________________
Kiwis Rule
Reply
#8

yeah ive always stayed with the default amount of timers as everyone i know who has played with timers has had problems so i chose not to go there

_______________________________________________
Kiwis Rule! xD im from auckland
Reply
#9

I suggest you post all timers here, the delay, and what they do.

Best idea is to stick with one 1000ms timer for everything - far better to put all the code in one loop rather than 20 or so. If you need things to count down (jail, etc), just use a variable - the 4 bytes per player is worth the advantage over having a million timers running - which WILL cause huge lag problems.
Reply
#10

Sorry people i have been at work so i dont get much time to come back and answer,same goes for my scripting,by the time i get back to it i have forgotten more than i learnt

Anyways before i forget what i was doing in the first place here goes

Код:
Line 662:     pickups[ p ][ ptimer ] = SetTimerEx("DestroyPickupEx", MAX_DROP_LIFETIME * 1000, 0, "i", p);}}}
    Line 1951:     sExplode[vehicleid] = SetTimerEx("ExplodeShamal", random(1300)+100, 1, "d", vehicleid);}}
    Line 3061:     SetTimer("JunkBuster",1000,true);
    Line 3062:     SetTimer("GlobalUpdate",60*1000*4,true);// Every 4 minutes
    Line 3063:     SetTimer("SpamUpdate",3500,true);
    Line 3064:     SetTimer("TempBanUpdate",1000*60*60,true);// Every hour
    Line 3078:     SetTimer("PayDay",3600000,1);
    Line 3079:     SetTimer("ReqBkRecentTime",50000,1);
    Line 3080:     SetTimer("fixedcarrecenttimer",1003,1);
    Line 3081:     SetTimer("SandEngine",1010,1);
    Line 3082:     SetTimer("BeenReported",60000,1);
    Line 3083:     SetTimer("VehicleRepairedRecent",120000,1);
    Line 3084:     SetTimer("RobbedPlayerRecent",60040,1);
    Line 3085:     SetTimer("StoleCopCarRecentTimer",60070,1);
    Line 3087:     SetTimer("JailFood",120000,1);
    Line 3088:     SetTimer("HandCuffed",5000,1);
    Line 3089:     SetTimer("JailCuffs",5005,1);
    Line 3090:     SetTimer("TriedToEscapePrison",40000,1);
    Line 3091:     SetTimer("copshavevctimer",1050,1);
    Line 3092:     SetTimer("VisitReqTimer",1045,1);
    Line 3093:     SetTimer("EscapeCuffsTime",1040,1);
    Line 3094:     SetTimer("commitedcrimerecent",1035,1);
    Line 3095:     SetTimer("twofoursevenmoveplayer",1030,1);
    Line 3096:     SetTimer("Tazing",1025,1);
    Line 3097:     SetTimer("AutoUnjail",1020,1);
    Line 3098:     SetTimer("AutoUnjailAlcatraz",1015,1);
    Line 3099:     SetTimer("TheEffectsOfWeed",3010,1);
    Line 3100:     SetTimer("PhoneCut",1010,1);
    Line 3101:     SetTimer("VHPBarUpdate",1005,1);
    Line 3102:     SetTimer("BackupInfo",120003,1);
    Line 3103:     SetTimer("WantedLevelReduce",1200000,1);
    Line 3104:     SetTimer("VehicleCleanup",600000,1);
    Line 3105:     SetTimer("inactiveplayercheck",86400000,1);
    Line 3106:     GGateTimer = SetTimer("GateTimer", TIMERSPEED, true);
    Line 3140:     SetTimerEx("PrintWarning",2500,0,"s","ladmin");
    Line 3144:     SetTimerEx("PrintWarning",2500,0,"s","ladmin/logs");
    Line 3148:     SetTimerEx("PrintWarning",2500,0,"s","ladmin/config");
    Line 3152:     SetTimerEx("PrintWarning",2500,0,"s","ladmin/users");
    Line 3165:     PingTimer = SetTimer("PingKick",10000,1);
    Line 3166:     GodTimer = SetTimer("GodUpdate",2000,1);
    Line 3210:     SetTimer("caidadeficha",30000,1);
    Line 3214:     SetTimer("MoveUfo",1,1);
    Line 3217:     SetTimer("rentfee", 1*60*60*1000, 1);//1 hour
    Line 3274:     SetTimer( "ZoneLoop", ZONE_LOOP_FREQUENCY, 1 );
    Line 3356:     SetTimer("LuX_SpeedoMeterUp", UpdateSpeed, 1);
    Line 3757:     if(InDM[playerid]==1) tseconds[playerid]=0, SetTimerEx("resetTcount",20000, 0, "i", playerid), KillTimer(TeleTimer), SendClientMessage(playerid, COLOR_RED, "You must leave the DM with /exitdm first!");
    Line 3770:     SetTimerEx("resetTcount",20000, 0, "i", playerid);}}}
    Line 3773:     TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 3799:                 if (IsPlayerConnected(i)) SetTimer("resetcount",2000,0);}}}}
    Line 5356:         LockKickTimer[playerid] = SetTimerEx("AutoKick", 20000, 0, "i", playerid);}
    Line 5397:             SetTimerEx("KickTimer",60000,0,"i",playerid);}}
    Line 5563:     if(VehicleInfo[vehicleid][Temp] == 1) SetTimerEx("EraseVehicle", 5000,0,"i",vehicleid);
    Line 5564:     if(onsys[vehicleid] == 1) SetTimerEx("EraseVehicle",10000,0,"i",vehicleid);
    Line 5807:                             caidadefichaTimer=SetTimer("caidadeficha",30000,1);}
    Line 5826:                             caidadefichaTimer=SetTimer("caidadeficha",30000,1);}
    Line 5922:     if(VehicleInfo[vehicleid][Temp] == 1) SetTimerEx("EraseVehicle", 5000,0,"i",vehicleid);
    Line 5935:         SetTimerEx("EraseVehicle", 5000,0,"i",tramid[playerid]);
    Line 5941:             avisado[playerid]=SetTimerEx("terminarMission",10000,0,"%d",playerid);}
    Line 5961:             avisado[playerid]=SetTimerEx("terminarMission",10000,0,"%d",playerid);}
    Line 6014:         SetTimerEx("DelayKillPlayer", 2500,0,"d",playerid);
    Line 6020:         SetTimerEx("DelayKillPlayer", 2500,0,"d",playerid);
    Line 6026:         SetTimerEx("JailPlayer",3000,0,"d",playerid); return SendClientMessage(playerid,red,"You cant escape your punishment. You Are Still In Jail");}
    Line 6033:                 SetTimerEx("DelayKillPlayer", 2500,0,"d",playerid);
    Line 7062:                         SetTimer("BankRobbedRecentlyTimer",45000,0);
    Line 7069:                         SetTimer("BankRobbedRecentlyTimer",45000,0);
    Line 7076:                         SetTimer("BankRobbedRecentlyTimer",45000,0);
    Line 7094:                 SetTimer("BankRobbedRecentlyTimer",45000,0);
    Line 7356:                 if(VehicleInfo[GetPlayerVehicleID(player1)][Temp] == 1) SetTimerEx("EraseVehicle", 5000,0,"i",GetPlayerVehicleID(player1));
    Line 7826:             SetTimer("countdown",1000,0);
    Line 7858:                 SetTimerEx("Duel",1000,0,"dd", player1, player2);
    Line 8161:                 BlipTimer[player1] = SetTimerEx("HighLight", 1000, 1, "i", player1);
    Line 8273:     if(PlayerInfo[playerid][Level] >= 3) return SetTimerEx("EraseVehicle", 5000,0,"i",GetPlayerVehicleID(playerid));
    Line 8456:             if(IsPlayerInAnyVehicle(player1)) SetTimerEx("EraseVehicle", 5000,0,"i",GetPlayerVehicleID(player1));
    Line 8634:                     SetTimerEx("JailPlayer",5000,0,"d",player1);
    Line 8635:                     SetTimerEx("Jail1",1000,0,"d",player1);
    Line 8699:                     FreezeTimer[player1] = SetTimerEx("UnFreezeMe",PlayerInfo[player1][FreezeTime],0,"d",player1);
    Line 9279:             SetTimerEx("PosAfterSpec",3000,0,"d",playerid);
    Line 10035:     SetTimer("countdown",1000,0);
    Line 10053:     SetTimerEx("Duel",1000,0,"dd", player1, player2);
    Line 10061:     SetTimerEx("Jail2",1000,0,"d",player1);}
    Line 10069:     SetTimerEx("Jail3",1000,0,"d",player1);}
    Line 10082:     JailTimer[player1] = SetTimerEx("JailRelease",PlayerInfo[player1][LJailTime],0,"d",player1);
    Line 12198:         SetTimerEx("EraseVehicle",5000,0,"i",vehicleID);
    Line 12256:         SetTimerEx("EraseVehicle",5000,0,"i",vehicleID);
    Line 12401:     SetTimerEx("EraseVehicle",5000,0,"i",vehicleID1);
    Line 12404:     SetTimerEx("EraseVehicle",5000,0,"i",vehicleID2);
    Line 12407:     SetTimerEx("EraseVehicle",5000,0,"i",vehicleID3);
    Line 12410:     SetTimerEx("EraseVehicle",5000,0,"i",vehicleID4);
    Line 12413:     SetTimerEx("EraseVehicle",5000,0,"i",vehicleID5);
    Line 13050:     SetTimerEx("CallVehicleToPlayer",5000,0,"i",playerid);
    Line 13083:     SetTimerEx("CallVehicle2ToPlayer",5000,0,"i",playerid);
    Line 13116:     SetTimerEx("CallVehicle3ToPlayer",5000,0,"i",playerid);
    Line 13149:     SetTimerEx("CallVehicle4ToPlayer",5000,0,"i",playerid);
    Line 13182:     SetTimerEx("CallVehicle5ToPlayer",5000,0,"i",playerid);
    Line 13963:             TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 14367:                 CountingTimer = SetTimerEx("ctimer", 1000, true, "i",playerid);
    Line 15193:                 TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 15328:                     TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 15475:                                     SetTimer("BankRobbedRecentlyTimer",45000,0);
    Line 15482:                                     SetTimer("BankRobbedRecentlyTimer",45000,0);
    Line 15489:                                     SetTimer("BankRobbedRecentlyTimer",45000,0);
    Line 15507:                             SetTimer("BankRobbedRecentlyTimer",45000,0);
    Line 15669:                 TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 17555:     CountingTimer = SetTimer("ctimer", 1000, true);
    Line 17682:         SetTimer("Tazingtime",3000,0);}
    Line 17812:     SetTimer("CopBackUpColour", 10000, 0);
    Line 20001:     TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 20024:             if(VehicleInfo[GetPlayerVehicleID(playerid)][Temp] == 1) SetTimerEx("EraseVehicle", 5000,0,"i",GetPlayerVehicleID(playerid));}
    Line 20097:     TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 20746:             SetTimerEx("TuneLCar",4000,0,"d",VehicleID);
    Line 21265:     TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 21287:     TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 21304:     TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 21325:     TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 21345:     TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 21367:     TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 21388:     TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
    Line 21410:     TeleTimer = SetTimerEx("ttimer", 1000, true, "i",playerid);
lol only a few then i never looked before how many there are,but still my first question was could these timers cause cpu overload and corrupt "say user files "

cheers in advance as i will be back at work
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)