SA-MP Forums Archive
A timer (with y_timers) is freezing the compiler... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: A timer (with y_timers) is freezing the compiler... (/showthread.php?tid=591126)



A timer (with y_timers) is freezing the compiler... - Scenario - 08.10.2015

EDIT: As it turns out, y_timers won't handle anything more than three passed variables. Not sure why this is, probably due to the the way ****** wrote SetTimerEx(). I'm using YSI 3.0, so it might of been fixed in 4.0 (don't quote me on that, though). Nevertheless, I figured it out and fixed my problem. I'll leave this here if someone else discovers this.



Yeah so not sure what the hell is wrong, never had this problem before. Have lots of timers already in the mode and haven't had a problem like this before. I've commented the contents of the whole timer out and literally just left this but it still freezes the compiler. I tried using a "task" and a "ptask" and that works, but that's not what I want for this.

They say two eyes are better than one- perhaps you see something I don't? Lemme' know!

pawn Код:
timer timerCallPhone[3000](playerid, callerPhoneID, target, targetPhoneID, step)
{
    if(target == INVALID_PLAYER_ID)
    {
        stop playerPhones[playerid][phoneCallTimer][callerPhoneID];
        resetPhoneVariables(playerid);
        resetPhoneVariables(target);
       
        return SendClientMessage(playerid, COLOR_LIGHTRED, "(( The person you are calling has disconnected. ))");
    }

    switch(step)
    {
        case 0 .. 8:
        {
            //playerPhones[playerid][phoneCallTimer][callerPhoneID] = defer timerCallPhone(playerid, callerPhoneID, target, targetPhoneID, (step+1));
            SendNearbyMessagef(target, COLOR_ME, "* %s's phone rings.", CheckPlayerName(target));
            SendClientMessage(playerid, COLOR_YELLOW, "* "#COL_WHITE"Ringing...");
        }
        default:
        {
            SetPVarInt(playerid, "USED_PHONE_ID", callerPhoneID);
            SetPVarInt(playerid, "CALLED_PHONE_ID", targetPhoneID);
            playerPhones[playerid][phoneStatus][phoneID] = CALL_STATUS_VOICEMAIL;
       
            SendClientMessagef(playerid, COLOR_YELLOW, "* "#COL_WHITE"You have reached the voicemail box of "#COL_LBLUE"%s"#COL_WHITE"."), playerPhones[target][phoneCallerID][targetPhoneID]);
            SendClientMessage(playerid, COLOR_YELLOW, "* "#COL_WHITE"If you would like to leave a voicemail, please speak now. If not, please hang up!");
           
            resetPhoneVariables(target);
        }
    }
    return 1;
}
This doesn't even work:

pawn Код:
timer timerCallPhone[3000](playerid, callerPhoneID, target, targetPhoneID, step)
{
   
}



Re: A timer (with y_timers) is freezing the compiler... - Scenario - 08.10.2015

(not meaning to double post here)

Solved. Read EDIT on main thread.


Re: A timer (with y_timers) is freezing the compiler... - Patchwerk - 08.10.2015

It's because lines cannot be longer than 512 characters. You should use pawn compiler patch by Zeex https://github.com/Zeex/pawn

In the fact you can use short variable names like
Код:
timerCallPhone[3000](p, cpid, t, tpid, s)



Re: A timer (with y_timers) is freezing the compiler... - Ahmad45123 - 08.10.2015

The reason is because the timer keyword is in fact a define that gets replaced with something a bit long.