What am I doing wrong?
#1

Hey guys, I am trying to an automatic savedata.

The command:
Код:
CMD:savedata(playerid, params[]) {
//SetTimer("savedata", 1000, true); ( Ignore my scipter did that -_- )
SendClientMessageToAll(COLOR_RED, "(INFO) Server Data Succesfully Saved");

	if(playerVariables[playerid][pAdminLevel] >= 5) {
        foreach(Player, x) {
			savePlayerData(x);
		}
		SendClientMessage(playerid, COLOR_YELLOW, "Player data saved.");

		for(new xh = 0; xh < MAX_HOUSES; xh++) {
            saveHouse(xh);
		}
		SendClientMessage(playerid, COLOR_YELLOW, "House data saved.");

		for(new xf = 0; xf < MAX_GROUPS; xf++) {
            saveGroup(xf);
		}
		SendClientMessage(playerid, COLOR_YELLOW, "Group data saved.");

		for(new xf = 0; xf < MAX_BUSINESSES; xf++) {
            saveBusiness(xf);
		}
		SendClientMessage(playerid, COLOR_YELLOW, "Business data saved.");

		for(new xf = 0; xf < MAX_ASSETS; xf++) {
            saveAsset(xf);
		}
		SendClientMessage(playerid, COLOR_YELLOW, "Server asset data saved.");
    }

    return 1;
}
This is what I did:

Top of script, Under includes:

Код:
//save data
forward SaveData(playerid);
//savedata
After public ongamemode..

Код:
	//save data
	SetTimer("SaveData", 5000, true);
	//save data
and buttom of script:

Код:
public SaveData()
    {
SendClientMessageToAll(COLOR_RED, "(INFO) Server Data Succesfully Saved");
		}
		SendClientMessage(playerid, COLOR_YELLOW, "Player data saved.");

		for(new xh = 0; xh < MAX_HOUSES; xh++) {
            saveHouse(xh);
		}
		SendClientMessage(playerid, COLOR_YELLOW, "House data saved.");

		for(new xf = 0; xf < MAX_GROUPS; xf++) {
            saveGroup(xf);
		}
		SendClientMessage(playerid, COLOR_YELLOW, "Group data saved.");

		for(new xf = 0; xf < MAX_BUSINESSES; xf++) {
            saveBusiness(xf);
		}
		SendClientMessage(playerid, COLOR_YELLOW, "Business data saved.");

		for(new xf = 0; xf < MAX_ASSETS; xf++) {
            saveAsset(xf);
		}
		SendClientMessage(playerid, COLOR_YELLOW, "Server asset data saved.");
    }

    return 1;
}
The problem is the thing does not work, nothing saves every x5 seconds.
Reply


Messages In This Thread
What am I doing wrong? - by Mark_Weston - 11.02.2012, 15:30
AW: What am I doing wrong? - by Littl3j0hNy - 11.02.2012, 17:26
Re: AW: What am I doing wrong? - by Mark_Weston - 11.02.2012, 19:42

Forum Jump:


Users browsing this thread: 1 Guest(s)