Money problem
#1

Hello i have problem. I made a /gmx cmd, and it works. but when i use it let's say i had "123$" after /gmx
it resets to 0. but if i relog (without gmx) it saves fine. if any code needed! tell me! i will post! +1 rep for helpers!!
Reply
#2

Are you using a custom /gmx command or directly from /rcon gmx? beacuse i don't think /rcon gmx calls OnGameModeExit callback.
Reply
#3

Show us your code.
Reply
#4

Код:
//===============GMX====================
CMD:gmx(playerid,params[])
{
	if(Logged[playerid] == 0)
 	{
 		SendClientMessage(playerid, COLOR_GREY, "You are not logged in.");
 		return 1;
 	}
 	if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_GREY,"You are not allowed to use this command");
    SendRconCommand("gmx");
 	return 1;
}
This is the command
Reply
#5

What function do you use to save data?
Reply
#6

Quote:
Originally Posted by blank.
Посмотреть сообщение
What function do you use to save data?
He doesn`t save it,you need to save data on this command and then to make a timer to restart the server.
Reply
#7

Код:
function SaveAccountStats(playerid)
{
	if(Logged[playerid] == 1)
	{
	new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
	//---------------------------------------------------//
   	PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
    PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
    PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid);
	//---------------------------------------------------//
    INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
    INI_WriteInt(File,"Radio",PlayerInfo[playerid][pRadio]);
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
    INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
    INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
    INI_WriteInt(File,"banned",PlayerInfo[playerid][pBanned]);
    INI_WriteInt(File,"Taxi",PlayerInfo[playerid][pTaxi]);
    INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
    INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
    INI_WriteInt(File,"Accent",PlayerInfo[playerid][pAccent]);



    INI_Close(File);
    }
    return 1;
}
Reply
#8

Quote:
Originally Posted by TzAkS.
Посмотреть сообщение
He doesn`t save it,you need to save data on this command and then to make a timer to restart the server.
ehm.. it loads every thing after GMX, but only the money gets reset
Reply
#9

Код:
CMD:gmx(playerid,params[])
{
	if(Logged[playerid] == 0)
 	{
 		SendClientMessage(playerid, COLOR_GREY, "You are not logged in.");
 		return 1;
 	}
 	if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_GREY,"You are not allowed to use this command");
    SaveAccountStats(playerid);
    SendRconCommand("gmx");
 	return 1;
}
But u need and a timer,becouse he doesn`t have time to call SaveAccountStats
Reply
#10

Quote:
Originally Posted by TzAkS.
Посмотреть сообщение
Код:
CMD:gmx(playerid,params[])
{
	if(Logged[playerid] == 0)
 	{
 		SendClientMessage(playerid, COLOR_GREY, "You are not logged in.");
 		return 1;
 	}
 	if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_GREY,"You are not allowed to use this command");
    SaveAccountStats(playerid);
    SendRconCommand("gmx");
 	return 1;
}
But u need and a timer,becouse he doesn`t have time to call SaveAccountStats
Ok i setted the timer.. even though i have a timer that savesaccounts every 10 sec, it still doesn't works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)