code:
var x_img = 0; //set x_img as a global variable
function OnEvent_Timer(sTimerId) //sTimerId is a variable not what timer is being initiated
{
    if (sTimerId == "slider" && Messenger.MyStatus == 3)//make sure it is the right timer being initiated AND the status you wanted
    {
        x_img++;//add 1 to x_img
        
        if(x_img == 1)
        { 
            Messenger.MyDisplayPicture = MsgPlus.ScriptFilesPath + "\\images\\online2.jpg";
        }
        else if(x_img == 2)//used "else if" as this links if statements and only oe can be true
        { 
            Messenger.MyDisplayPicture = MsgPlus.ScriptFilesPath + "\\images\\online3.jpg";
        }
        else if(x_img == 3)
        { 
            Messenger.MyDisplayPicture = MsgPlus.ScriptFilesPath + "\\images\\online4.jpg";
        }
        else if(x_img == 4)
        { 
            Messenger.MyDisplayPicture = MsgPlus.ScriptFilesPath + "\\images\\online.jpg";
            x_img = 0;
        }
        MsgPlus.AddTimer("slider", 20000);
    }
}
I added some note so you can understand the changes that have been made by mickael9.  I hope this gives you more understanding of what is happening.