Timer Bug!?
#1

Hey guy i have made the drop system here the code i'll not show all i'll show you the nessssary of bug

PHP код:
CMD:drop(playeridparams[])
{
    new 
animlib[32];
    new 
animname[32];
    
//new msg[128];
    
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
    if(
GetPlayerAnimationIndex(playerid))
    {
        if(!
strcmp(animname"IDLE_STANCE"true) || !strcmp(animname"FatIdle"true) || !strcmp(animname"leanIDLE"true) || !strcmp(animname"MuscleIdle"true) || !strcmp(animname"Idlestance_fat"true) || !strcmp(animname"idlestance_old"true) || !strcmp(animname"Idle_Gang1"true) || !strcmp(animname"woman_idlestance"true) || !strcmp(animname"POOL_Idle_Stance"true) || !strcmp(animname"POOL_Idle_Stance"true))
        {
            
ApplyAnimation(playerid"BOMBER""BOM_PLANT_IN"4.000000);
            
KillTimer(timerdrop[playerid]); <<< this line is the problem
            timerdrop
[playerid] = SetTimerEx("Droptime"400false"i"playerid);
        }
    }
    return 
1;

The line that i said is the problem cuz it not kill the timerdrop[playerid] timer but it killed my previous/early timer

i mean at the onplayerconnect i just create the timer to update the player textdraw /bar

Barupdatetimer[playerid] = SetTimerEx("Barupdate", 100, true, "i", playerid); << onplayerconnect

and it work fine cuz i just coding it if the player proceed this timer it will be send the client message but when i use /drop command it kill the barupdatetimer[playerid] i very get confused can someone help me?
Reply
#2

bumping
Reply
#3

https://sampwiki.blast.hk/wiki/SetTimerEx
Read the Return Values notes, its says it. There are no checks if the timer is valid, so here the case maybe the same. You timer id Barupdatetimer[playerid] might possess id 0. And further your second timer timerdrop[playerid] also have initial value as 0. So when you kill the timer, it actually destroys timer id 0 i.e. Barupdatetimer[playerid].

Use a timer fix Plugin or Include Or maybe set the vars initial value to -1.
pawn Код:
OnPlayerConnect(playerid)
{
     Barupdatetimer[playerid] = -1;
     timerdrop[playerid] = -1;
     return 1;
}

OnPlayerDisconnect(playerid, reason)
{
     Barupdatetimer[playerid] = -1;
     timerdrop[playerid] = -1;
     return 1;
}
Reply
#4

but i can use it on my own gamemode

but when i move\rewrote the command in the new clean gamemode base on sql it not work noww

ok i will tryna use timerfix/set valve to -1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)