CMD:Findcar
#1

Hey Guys, did I do something wrong?

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;
}
The map icons don't show?
Reply
#2

Use a checkpoint instead of a map icon
Reply
#3

Here is the one that you set at XXX Positons else use the other
Код:
 SetPlayerCheckpoint(playerid, X, Y, Z, 3.0); /// change the X Y Z Positions
OR use this
Код:
SetCheckPoint(playerid, TEXT, x, y, z, 6.0); //change the "TEXT" to ours
Add this in the top of your Gm
Код:
#define TEXT // CHANGE IT TO WHATEVER YOU WANT MUST BE SAME AS ON THE SetCheckPoint
if that wouldnt work Change #define TEXT to #define TEXT 25
Reply
#4

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)