Closest station
#1

Hi

I am busy making a RP server, and kinda stuck with a CDL job... I am wanting there to be quite a few CDL depots, and when a player types /loadtrailer, it will set a checkpoint at the closest depot for players to get the job. I also want it so that when they enter the checkpoint, it will check what depot they are at, and depending on the depot, depends on the location they can choose...

Anyone that can help me with this?
Thanks

Let me know if you need more info
Reply
#2

Well have you started coding one? if yes please hand us some code because making such a system takes times it's not easy if you already have one just give us the code and we will simply edit it and hand it to you
Reply
#3

pawn Код:
CMD:loadtrailer(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, range,x, y, z)) // add in the range, x pos, y pos and z pos of the depot for the player to get the job, and if they aren't in range of it... It will set their checkpoint here.
    {
            PlayerStat[playerid][Removalist] = 1;
            SetPlayerCheckpoint(playerid, x,y, z, size of checkpoint); // Same here.  X pos, Y pos, Z pos, size of checkpoint.  I usually use 3.0
            SendClientMessage(playerid, ORANGE, "Head towards the depot, a location has been marked on your map");
    }
    else
    {
        SendClientMessage(playerid, GREY, "You are already at the depot area!");
    }
    return 1;
}
This should work, you'll just have to edit it if you want to change it around or add code
Reply
#4

Quote:

IsPlayerInRangeOfPoint

That would work, but the problem is I need it to see were the closest station is, not if it is in range of one... I need to get the player position, and then almost "scan" the map to see what station will be the closest... If that makes sense...
Reply
#5

Good way you can start making dynamic areas (depot) and find nearest depot with timer or ifplyerchangedepot stock or custom function. I can figure out this but I need time.
Reply
#6

Ok I jsut figured it out... can use GetPlayerDistanceFromPoint and just loop through all the depot's positions
Thanks all for your help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)