pawn Код:
CMD:findcar(playerid, params[])
{
new vid;
if(sscanf(params, "d", vid)) return SCM(playerid, COLOR_LIGHTRED, "USAGE: /findcar [1/2]");
if(vid == 1)
{
if(PlayerInfo[playerid][pPcarkey] == 9999) return SCM(playerid, COLOR_GREY, "You don't have a car");
new carid = PlayerInfo[playerid][pPcarkey];
new Float:X, Float:Y, Float:Z;
new zone[MAX_ZONE_NAME];
new string[256];
GetVehicle2DZone(carid, zone, MAX_ZONE_NAME);
GetVehiclePos(carid, X,Y,Z);
if(Searching[playerid] == 0)
{
Searching[playerid] = 1;
SetPlayerMapIcon(playerid, 500 + playerid, X,Y,Z, 41, COLOR_YELLOW);
format(string, sizeof(string),"Your car is at %s, red marker has been set at the map. Type /foundit when you have found it.",zone);
SCM(playerid, TEAM_GROVE_COLOR, string);
}
else
{
RemovePlayerMapIcon(playerid, carid+1);
SetPlayerMapIcon(playerid, 500 + playerid, X,Y,Z, 41, COLOR_YELLOW);
format(string, sizeof(string),"Your car is at %s, red marker has been set at the map. Type /foundit when you have found it.",zone);
SCM(playerid, TEAM_GROVE_COLOR, string);
}
}
else if(vid == 2)
{
if(PlayerInfo[playerid][pPcarkey2] == 9999) return SCM(playerid, COLOR_GREY, "You don't have a 2nd car");
new carid = PlayerInfo[playerid][pPcarkey2];
new Float:X, Float:Y, Float:Z;
new zone[MAX_ZONE_NAME];
new string[256];
GetVehicle2DZone(carid, zone, MAX_ZONE_NAME);
GetVehiclePos(carid, X,Y,Z);
if(Searching[playerid] == 0)
{
Searching[playerid] = 1;
SetPlayerMapIcon(playerid, 500 + playerid, X,Y,Z, 41, COLOR_YELLOW);
format(string, sizeof(string),"Your car is at %s, red marker has been set at the map. Type /foundit when you have found it.",zone);
SCM(playerid, TEAM_GROVE_COLOR, string);
}
else
{
RemovePlayerMapIcon(playerid, carid+1);
SetPlayerMapIcon(playerid, 500 + playerid, X,Y,Z, 41, COLOR_YELLOW);
format(string, sizeof(string),"Your car is at %s, red marker has been set at the map. Type /foundit when you have found it.",zone);
SCM(playerid, TEAM_GROVE_COLOR, string);
}
}
else
{
SCM(playerid, COLOR_LIGHTRED, "You do not have a car.");
}
return 1;
}
Aswell as on your original code you didn't put coordinates in you only used "X Y Z" you need to use the vehicle enums you have so like SetPlayerCheckpoint(playerid, carPos[0], carPos[1], carPos[2]); but edit it of course. This is just an example it won't work