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
#2

Hi, Try:

pawn Код:
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;
}
regards,
LJ
Reply
#3

Quote:
Originally Posted by Littl3j0hNy
Посмотреть сообщение
Hi, Try:

pawn Код:
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;
}
regards,
LJ
Thanks I will try it, right now

edit:
Weird didn't work ;o
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)