20.04.2013, 03:48
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.
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.
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;
}