Question
#1

Hey guys i wanted to know if you can make a car tracking device like you install it on the car. And be able to be anywhere and know where it is. If possible please tell me how i can make or if you know and you can make that will be cool.
Reply
#2

It's pretty easy actually but it really depends on your vehicle system are cars ownable they load/destroy when you login? Are they static just server sided vehicles that are always there? You need to determine this first the rest is relatively straight forward for example.

pawn Код:
#include <a_samp>
#include <sscanf2>

new TrackingIDS[MAX_VEHICLES];

CMD:findcar(playerid, arg[])
{
    new id;
    if(!sscanf(arg, "i", id))
    {
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            if(id == TrackingIDS[i])
            {
                new Float:x, Float:y, Float:z;
                GetVehiclePos(i, x, y, z);
                SetPlayerRaceCheckpoint(playerid, 1, x, y, z, 0.0, 0.0, 0.0, 5.0);
                break;
            }
        }
    }
    else SendClientMessage(playerid, 0xFF00FFFF, "Usage: /findcar trackingid");
    return 1;
}

CMD:placetracker(playerid, arg[])
{
    new vid = GetPlayerVehicleID(playerid);
    if(vid)
    {
        new line[128];
        new tracknum = random(2000000);
        TrackingIDS[vid] = tracknum;
        format(line, sizeof(line), "Tracking id for this car is (%i) use /findcar <tracking id> to find it", tracknum);
        SendClientMessage(playerid, 0xFF00FFFF, line);
    }
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    SendClientMessage(playerid, 0xFF00FFFF, "You found your car");
    DisablePlayerRaceCheckpoint(playerid);
    return 1;
}
Note: This is very very basic way of doing it just to give you an idea actually I have not even tested this in game but I'm pretty sure it should work fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)