SA-MP Forums Archive
[HELP] Saving to a player's file - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Saving to a player's file (/showthread.php?tid=83442)



[HELP] Saving to a player's file - Haegon - 25.06.2009

Okay, so what I want to do, is check a players file for their job variable (to see what job they have, if any), and if they have the job, they can't get it twice. If they have a different job, they have to drop the job to get this job, and if they don't have a job, it saves this jobs variable number to their file. What I don't know how to do, is get the player's file open.

Basically, my code is:

Код:
if(strcmp("/apply", cmdtext, true, 6) == 0)
{
    if(IsPlayerConnected(playerid))
    {
      if(PlayerToPoint(1, playerid, 2227.7698,-1718.5902,13.5216)) // Location that the player has to be at to get the job.
      {
        if (GetPlayerTeam(playerid) == 1)
        {
				SendClientMessage(playerid, COLOR_WHITE, "LSPD cannot get Mercenary!");
				}
				if (GetPlayerTeam(playerid) == 2)
				{
				SendClientMessage(playerid, COLOR_WHITE, "FBI cannot get Mercenary!");
				}
				if (GetPlayerTeam(playerid) == 3)
				{
				SendClientMessage(playerid, COLOR_WHITE, "You already have a job!");
				}
				if (GetPlayerTeam(playerid) == 4)
				{
				SendClientMessage(playerid, COLOR_WHITE, "You already have a job!");
				}
				if (GetPlayerTeam(playerid) == 5)
				{
				SendClientMessage(playerid, COLOR_WHITE, "You already have a job!");
				}
				if (GetPlayerTeam(playerid) == 6)
				{
				SendClientMessage(playerid, COLOR_WHITE, "You are already a Mercenary!");
				}
				if (GetPlayerTeam(playerid) == 7)
				{
				SendClientMessage(playerid, COLOR_WHITE, "You already have a job!");
				}
				else
				{
				SetPlayerTeam(playerid, 3);
        }
        {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've taken up the hour contract of being a Mercenary.");
        }
        {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /help for more information on this job.");
        }
        {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "To quit this job when your contract is over, type /quitjob.");
        }
        
      }
		}
		return 1;
}
I am using XtremeAdmin for the player files. What I want to do is be able to open the files, read the job variable, and if it doesn't exist, write it there.

I am just completely lost on how to do this.


Re: [HELP] Saving to a player's file - Haegon - 25.06.2009

Does anyone have the slightest clue? After looking further into it, I cant really use Dini to save it, can I?