//Start of jobs
public OnPlayerEnterCheckpoint(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 531)
{
if(ExJob[playerid] == 1){
ExJob[playerid] = 2;
SetPlayerCheckpoint(playerid,50.2074,-86.3620,0.6094,10);
SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
return 1;
}
if(ExJob[playerid] == 2){
ExJob[playerid] = 3;
SetPlayerCheckpoint(playerid,42.8746,-114.5679,0.6169,10);
return 1;
}
if(ExJob[playerid] == 3){
ExJob[playerid] = 4;
SetPlayerCheckpoint(playerid,42.8746,-114.5679,0.6169,10);
return 1;
}
if(ExJob[playerid] == 4){
ExJob[playerid] = 5;
SetPlayerCheckpoint(playerid,33.0193,-118.6128,0.6169,10);
return 1;
}
if(ExJob[playerid] == 5){
ExJob[playerid] = 6;
SetPlayerCheckpoint(playerid,42.6236,-71.0327,0.6094,10);
return 1;
}
if(ExJob[playerid] == 6){
ExJob[playerid] = 7;
SetPlayerCheckpoint(playerid,37.0597,-61.5438,1.5049,10);
return 1;
}
if(ExJob[playerid] == 7){
ExJob[playerid] = 8;
SetPlayerCheckpoint(playerid,17.9072,-119.0836,0.6094,10);
return 1;
}
if(ExJob[playerid] == 8){
ExJob[playerid] = 9;
SetPlayerCheckpoint(playerid,31.6652,-50.3610,2.5574,10);
return 1;
}
if(ExJob[playerid] == 8){
ExJob[playerid] = 9;
SetPlayerCheckpoint(playerid,9.0930,-116.7551,0.6390,10);
return 1;
}
if(ExJob[playerid] == 9){
ExJob[playerid] = 0;
DisablePlayerCheckpoint(playerid);
SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $300 for your work!");
GivePlayerMoney(playerid,150);
}
}
return 1;
}
// Get Job command
CMD:getjob(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 4.0,-46.5548,-108.5900,3.1172)) // Replace RANGE = Distance when he can use, and X,Y,Z with your pick-up coordinates
wJob[playerid] = 1; // 1 = YourJobName from defines !
SendClientMessage(playerid, -1, "{FF0000}[INFO]: {15FF00}You have chose your job."); // He will get a job !
return 1;
}
// For making a command only for that job :
CMD:CommandName(playerid, params[])
{
if(wJob[playerid] != 1) //Number "1" is your job name.
return SendClientMessage(playerid, 0xAFAFAFAA, "You don't have this job"); // Get a message he haven't that job !
SendClientMessage(playerid,-1,"Your job command Text or code"); // If he have that job
return 1;
}
// For Quit Job (You don't have any job)
CMD:quitjob(playerid, params[])
{
wJob[playerid] = 0; //Now you don't have any job !
SendClientMessage(playerid,0xAFAFAFAA,"Now you're unemployed"); // Text
return 1;
}
new s[120], xip[24], aname[24]; GetPlayerIp(playerid, xip, 24); GetPlayerName(playerid, aname, 24); format(s, 120, "{E4BD22}%s {FFFFFF}has joined the server [IP: (%s)]", aname, xip); SendClientMessage(playerid, -1, s); //Here you replace it for your function.
CMD:getjob(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 4.0,-46.5548,-108.5900,3.1172))
{
wJob[playerid] = 1; // 1 = YourJobName from defines !
SendClientMessage(playerid, -1, "{FF0000}[INFO]: {15FF00}You have chose your job."); // place the message inside with the brackets, then everything will depend on if the statement above is true.
//if it is not true, none of that above will show.
}
else
{
//send a message or something here saying that the player is not close to the checkpoint if you want to
}
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 531)
{
if(ExJob[playerid] == 1){
ExJob[playerid] = 2;
SetPlayerCheckpoint(playerid,50.2074,-86.3620,0.6094,10);
SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
return 1;
}
if(ExJob[playerid] == 2){
ExJob[playerid] = 3;
SetPlayerCheckpoint(playerid,42.8746,-114.5679,0.6169,10);
return 1;
}
if(ExJob[playerid] == 3){
ExJob[playerid] = 4;
SetPlayerCheckpoint(playerid,42.8746,-114.5679,0.6169,10);
return 1;
}
if(ExJob[playerid] == 4){
ExJob[playerid] = 5;
SetPlayerCheckpoint(playerid,33.0193,-118.6128,0.6169,10);
return 1;
}
if(ExJob[playerid] == 5){
ExJob[playerid] = 6;
SetPlayerCheckpoint(playerid,42.6236,-71.0327,0.6094,10);
return 1;
}
if(ExJob[playerid] == 6){
ExJob[playerid] = 7;
SetPlayerCheckpoint(playerid,37.0597,-61.5438,1.5049,10);
return 1;
}
if(ExJob[playerid] == 7){
ExJob[playerid] = 8;
SetPlayerCheckpoint(playerid,17.9072,-119.0836,0.6094,10);
return 1;
}
if(ExJob[playerid] == 8){
ExJob[playerid] = 9;
SetPlayerCheckpoint(playerid,31.6652,-50.3610,2.5574,10);
return 1;
}
if(ExJob[playerid] == 8){
ExJob[playerid] = 9;
SetPlayerCheckpoint(playerid,9.0930,-116.7551,0.6390,10);
return 1;
}
if(ExJob[playerid] == 9){
ExJob[playerid] = 0;
DisablePlayerCheckpoint(playerid);
SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $300 for your work!");
GivePlayerMoney(playerid,150);
}
}
return 1;
}
CMD:getjob(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 4.0,-46.5548,-108.5900,3.1172))
{
wJob[playerid] = 1;
SendClientMessage(playerid, -1, "{FF0000}[INFO]: {15FF00}You have chose your job.");
SetPlayerCheckpoint(/*THE POS FOR THE FIRST CHECKPOINT IN HERE*/); //Modify this to be correct with your code.
}
else
{
//send a message or something here saying that the player is not close to the checkpoint if you want to
}
return 1;
}
public OnPlayerConnect(playerid)
{
new s[70], xip[24], aname[24];
GetPlayerIp(playerid, xip, 24); //Get the ip and save it into "xip"
GetPlayerName(playerid, aname, 24); //Get the name of the player and save it into "aname"
format(s, sizeof(s), "{FF9E00}%s {FFFFFF}has joined the server [IP: (%s)]", aname, xip); //add this message into the "s" string and add the variables we found above
SendClientMessage(playerid, -1, s); //then send the string we made
return 1;
}
That code you provided is only showing when a player is entering a checkpoint, and what to do next. You need to create the very first checkpoint in your job command:
pawn Код:
And in order to make join messages like you want; you can do something like this, which he posted above me. Just add it under "OnPlayerConnect" pawn Код:
|