SA-MP Forums Archive
CMD:Findcar - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CMD:Findcar (/showthread.php?tid=455357)



CMD:Findcar - UnknownGamer - 01.08.2013

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?


Re: CMD:Findcar - conor565 - 01.08.2013

Use a checkpoint instead of a map icon


Re: CMD:Findcar - Pk93 - 01.08.2013

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


Re: CMD:Findcar - conor565 - 02.08.2013

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