SA-MP Forums Archive
how i make job - 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)
+--- Thread: how i make job (/showthread.php?tid=344279)



how i make job - TheDiscussionCafe - 20.05.2012

how do i make job for people to do? like delivery job or somethingg?


Re: how i make job - IRio97 - 20.05.2012

you can get player job with a variable like this

pawn Код:
new job1[MAX_PLAYERS];
pawn Код:
CMD:takejob1(playerid, params[])
{
job1[playerid] = 1;
SendClientMessage(playerid, -1, "You have now job1!");
return 1;
}
and for make cmd for player with job1 use:

pawn Код:
CMD:job(playerid, params[])
{
if(job1[playerid] == 1)
{
functions
}
else
{
SendClientMessage(playerid, -1, "You aren't a ...");
}
return 1;
}



Re: how i make job - iGetty - 20.05.2012

Here it is with fixed indentation:

pawn Код:
new job1[MAX_PLAYERS];
pawn Код:
CMD:takejob1(playerid, params[])
{
    job1[playerid] = 1;
    SendClientMessage(playerid, -1, "You have now job1!");
    return 1;
}
pawn Код:
CMD:job(playerid, params[])
{
    if(job1[playerid] == 1)
    {
        //functions
    }
    else
    {
        SendClientMessage(playerid, -1, "You aren't a ...");
    }
    return 1;
}



Re: how i make job - TheDiscussionCafe - 20.05.2012

thank you, how can i add in "inrangeofpoint" and how i can make delivery end and delivery vehicle? thankx you!


Re: how i make job - iGetty - 20.05.2012

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
Also, to create a vehicle use this:

pawn Код:
CreateVehicle(vehiclemodel, x, y, z, a, colour1, colour2, respawn_time);
The delivery end, how do you mean?


Re: how i make job - [ABK]Antonio - 20.05.2012

I would use a template like this


pawn Код:
enum { None, Delivery, SomeOtherJob, Another};
enum pInfo {Job}; //can add other things in here like kills, deaths, level, etc

new Info[MAX_PLAYERS][pInfo];


public OnPlayerConnect(playerid)
{
    Info[playerid][Job] = None; //reset the playerid's job to 0 (needs to be done when working with arrays)
    return 1;
}

CMD:join(playerid, params[])
{
    if(Info[playerid][Job] != None) return SendClientMessage(playerid, 0xCC0000AA, "You already have a job!");
   
    if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:X, Float:Y, Float:Z)) //these would be for delivery job join location
    {
        Info[playerid][Job] = Delivery; //set their job to delivery
        SendClientMessage(playerid, 0x00CCCCAA, "You're now a delivery man!");
        //If you had a saving system you would save this either when they join or when they log out
    }
    else if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:X, Float:Y, Float:Z)) //some other job
    {
        Info[playerid][Job] = SomeOtherJob;
        SendClientMessage(playerid, 0x00CCCCAA, "You're now something!");
    }
    //and the same as above for the rest
    return 1;
}

CMD:quitjob(playerid, params[])
{
    if(Info[playerid][Job] == None) return SendClientMessage(playerid, 0xCC0000AA, "You don't have a job!");

    Info[playerid][Job] = None;
    SendClientMessage(playerid, 0x00CCCCAA, "You've quit your job!");
    //like above if you have a saving system you would save this either when they join or when they log out
}
It depends on how you want to actually start the job. Entering a truck? With checkpoints for destinations? If so, I would go to the tutorial section and look for tutorials on things like exclusive vehicles, checkpoints and what not. You could also go to the wiki and look around there.


Re: how i make job - TheDiscussionCafe - 20.05.2012

@[ABK]Antonio how i can checkpoint like delivery checkpoint for the job? Also like when player type in /job vehicle will spawn andd "if player is in vehicle" enter checkpoint giveplayercash... is the that possible?