HELP saving/loading game! please!

So I need to know how to write a script for saving/loading, I would really appreciate it if somebody could give me an example code, all I'm trying to do is make a code that saves which scene the player leaves off in, so that when the game starts it starts from that scene. I'm not trying to save any variables in the scene. I'm only trying to save which scene the player exited the game on, so that when he/she starts again they will resume from that level.

The way I would do this would be to just have an integer variable in your PlayerPrefs and every time you finish a level you save the level number off to the PlayerPrefs. Then, when the person plays again you just get the level number from the PlayerPrefs and load that level. For Example: At the end of a level:

var levelnumber : int;

function OnEndGame () {
     PlayerPrefs.SetInt("LastLevel", levelnumber);
}

That would set the PlayerPrefs to your last level.

When the person plays again:

function LoadLevel () {
     var leveltoload = PlayerPrefs.GetInt("LastLevel");
     Application.LoadLevel(leveltoload);
}

Hope this helps.