03.01.2013, 21:13
Hey Guys,
Im having a problem with my /joinjob and /quitjob command.
When I join a Job it should set their job accordingly to the job(in this case, Trucker Job is 1 and Sweeper Job is 2). However when I try to do one of the Jobs it says I am not in that Job. Also when I try to /quitjob, It says I dont have a Job.
The Job also doesnt save to the .ini file :/
Heres the Command and Other Information
/joinjob and /quitjob Command:
The Trucker and Sweeper Job Commands;
OnPlayerDisconnect;
OnPlayerConnet;
Please can someone try and help me
Thanks
Im having a problem with my /joinjob and /quitjob command.
When I join a Job it should set their job accordingly to the job(in this case, Trucker Job is 1 and Sweeper Job is 2). However when I try to do one of the Jobs it says I am not in that Job. Also when I try to /quitjob, It says I dont have a Job.
The Job also doesnt save to the .ini file :/
Heres the Command and Other Information
/joinjob and /quitjob Command:
pawn Код:
CMD:joinjob(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 5, 43.6374,-224.5082,1.6927))// Trucker Job
{
if(PlayerInfo[playerid][pJob] == 0)
{
PlayerInfo[playerid][pJob] = 1;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SERVER]: You have joined the Trucker Job");
}
else
{
SendClientMessage(playerid, COLOR_RED, "[SERVER]: {FFFFFF} You already have a job");
}
}
else if(IsPlayerInRangeOfPoint(playerid, 5, 782.2495,-594.6606,16.3359))// Sweeper Job
{
if(PlayerInfo[playerid][pJob] == 0)
{
PlayerInfo[playerid][pJob] = 2;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SERVER]: You have joined the Sweeper Job");
}
else
{
SendClientMessage(playerid, COLOR_RED, "[SERVER]: {FFFFFF} You already have a job");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "[SERVER]: {FFFFFF} You are not in a Job Join Location");
}
return 1;
}
CMD:quitjob(playerid, params[])
{
if(PlayerInfo[playerid][pJob] == 0)
{
PlayerInfo[playerid][pJob] = 0;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SERVER]: You have quit your job");
}
else
{
SendClientMessage(playerid, COLOR_RED, "[SERVER]: {FFFFFF}You dont have a job");
}
return 1;
}
pawn Код:
CMD:trucker(playerid, params[]) // Trucker Job Start
{
if(PlayerInfo[playerid][pJob] == 1)
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, truckstartcp))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 455 || 456 || 609)
{
if(atcp[playerid] == 0)
{
atcp[playerid] = 1;
SetPlayerCheckpoint(playerid, truckcp1, 4.0);
SendClientMessage(playerid, 0x00FFCCFF, "[SERVER]: {FFFFFF} You have started the Trucking Job, Proceed to the Checkpoints.");
SendClientMessage(playerid, COLOR_ORANGE, "Deliver Drinks to the Dillimore Bar");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "[SERVER]: {FFFFFF}You are not in a Trucking Vehicle");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "[SERVER]: {FFFFFF}You are not a Trucker");
}
return 1;
}
CMD:sweeper(playerid, params[]) // Sweeper Job Command
{
if(PlayerInfo[playerid][pJob] == 2)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 574)
{
SweepingJob[playerid] = 1;
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "* %s is now a StreetSweeper.", name );
SendClientMessageToAll(COLOR_YELLOW, string);
SendClientMessage(playerid,COLOR_YELLOW,"* Clean the street for 5 minutes and recieve $200");
SetTimerEx("SweeperJobFinish", 300000, false, "i", playerid);
return 1;
}
SendClientMessage(playerid, COLOR_RED, "[SERVER]: {FFFFFF}You must be in a Street Sweeper to start this job");
}
else
{
SendClientMessage(playerid, COLOR_RED, "[SERVER]: {FFFFFF}You are not a Street Sweeper");
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new file[255];
new pname[255];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "Users/%s.ini", pname);
if(dini_Exists(file))
{
dini_Set(file, "Job", PlayerInfo[playerid][pJob]);
}
return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
new file[255];
new pname[255];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "Users/%s.ini", pname);
// Load files on Login
if(dini_Exists(file))
{
PlayerInfo[playerid][pJob] = dini_Int(file, "Job");
}
return 1;
}
Thanks