10.05.2017, 17:57
Hi,
I am making a faction system that give salary automatically after 1 week.
I used gettime() function.
But when save player data it didn't save if PlayerSalary = gettime();
But when I do PlayerSalary = 1400; it saves
what is the problem :/ ?
Codes:
Job Code:
My SaveUser code:
where is the problem?
and requesting for solve it
I am making a faction system that give salary automatically after 1 week.
I used gettime() function.
But when save player data it didn't save if PlayerSalary = gettime();
But when I do PlayerSalary = 1400; it saves
what is the problem :/ ?
Codes:
Job Code:
Код:
CMD:givefirefighterjob(playerid, params[]) { new string[256],year,month,day; getdate(year, month, day); format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year); if(PlayerJob[playerid] == 8) { new salary[MAX_PLAYERS]; salary[playerid] = gettime() + 604800;; new targetid,pName[MAX_PLAYER_NAME]; if(sscanf(params,"u", targetid)) return SendClientMessage(playerid,COLOR_RED , "Correct Usage: /givefirefighterjob [Playerid]"); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,COLOR_RED,"Player not connected."); GetPlayerName(targetid,pName,sizeof(pName)); new msg[126],lName[MAX_PLAYERS]; GetPlayerName(playerid,lName,sizeof(lName)); format(msg,sizeof(msg),"{FFFF00}[FireFighter]{FFFFFF}You are now a firefighter. Job given by fire department leader %s.",lName); PlayerJob[targetid] = 7; SendClientMessage(targetid,COLOR_GREEN,msg); new msg2[126]; format(msg2,sizeof(msg2),"{FFFF00}[FireFighter]{FFFFFF}You given firefighter job to %s",pName); SendClientMessage(playerid,COLOR_GREEN,msg2); JobSalary[playerid] =78684883; //salary[playerid];//1495012028; new job[126]; format(job,sizeof(job),"Your Job Code Is %i | Saray at : %i",PlayerJob[targetid],JobSalary[playerid]); SendClientMessage(targetid,COLOR_GREEN,job); //PlayerInfo[targetid][JobSalary] = gettime()+604800; SaveUser(playerid); } else { SendClientMessage(playerid,COLOR_RED,"{FF0000}[Insufficient]{FFFFFF}You don't have sufficient power to use this command."); } return 1; }
Код:
forward SaveUser(playerid); public SaveUser(playerid) { new float:x,float:y,float:z; GetPlayerPos(playerid,x,y,z); new float:health,float:armour; GetPlayerHealth(playerid,health); GetPlayerArmour(playerid,armour); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)); INI_WriteInt(File,"BankCash",BankCash[playerid]); INI_WriteInt(File,"Score",GetPlayerScore(playerid)); INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]); INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]); INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]); INI_WriteInt(File,"Helmets",Helmets[playerid]); INI_WriteInt(File,"Vests",Vests[playerid]); INI_WriteInt(File,"Medikits",Medikits[playerid]); INI_WriteInt(File,"Job",PlayerJob[playerid]); INI_WriteFloat(File,"Health",health); //This is a float, you need to use INI_WriteFloat INI_WriteFloat(File,"Armour",armour); //This is a float, you need to use INI_WriteFloat INI_WriteInt(File,"Mats",PlayerInfo[playerid][pMats]); INI_WriteInt(File,"Skin",GetPlayerSkin(playerid)); INI_WriteInt(File,"JobSalaryate",JobSalary[playerid]); INI_WriteInt(File,"JobLevel",PlayerInfo[playerid][JobLevel]); INI_WriteFloat(File,"PosX",x); //This is a float, you need to use INI_WriteFloat INI_WriteFloat(File,"PosY",y); //This is a float, you need to use INI_WriteFloat INI_WriteFloat(File,"PosZ",z); //This is a float, you need to use INI_WriteFloat INI_Close(File); SendClientMessage(playerid,COLOR_LIGHTBLUE,"Data saved!"); return 1; }
and requesting for solve it