25.06.2009, 06:34
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:
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.
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 just completely lost on how to do this.

