ShowPlayerDialog /findcar[Please help]
#1

I want to Convert This /findcar into this system that popup ShowPlayerDialog

ORIGNAL:
pawn Код:
if(strcmp(cmd, "/findcar", true) == 0) // By Robin Hellman
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "Using: /findcar [Vehicle 1, 2 or 3]");
                return 1;
            }
            new number = strval(tmp);
            if(number < 1 || number > 3)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   Vehicle 1, 2 or 3.");
                    return 1;
                }
            if(number == 1)
            {
                if(PlayerInfo[playerid][pPcarkey] == 9999)
                {
                    SendClientMessage(playerid, COLOR_GREY, "Do not have a car in the first slot!");
                    return 1;
                }
                new carid = PlayerInfo[playerid][pPcarkey];
                new Float:X, Float:Y, Float:Z;
                new zone[MAX_ZONE_NAME];
                GetVehicle2DZone(carid, zone, MAX_ZONE_NAME);
                GetVehiclePos(carid, X,Y,Z);
                if(Searching[playerid] == 0)
                {
                    Searching[playerid] = 1;
                    SetPlayerCheckpoint(playerid, X,Y,Z, 5.0);
                    format(string, sizeof(string),"Your car is marked on the map (red marker), are located in the zone %s!",zone);
                    SendClientMessage(playerid, COLOR_GREY, string);
                }
                else
                {
                    SetPlayerCheckpoint(playerid, X,Y,Z, 5.0);
                    format(string, sizeof(string),"Your car is marked on the map (red marker), are located in the zone %s!",zone);
                    SendClientMessage(playerid, COLOR_GREY, string);
                }
            }
            else if(number == 2)
            {
                if(PlayerInfo[playerid][pPcarkey2] == 9999)
                {
                    SendClientMessage(playerid, COLOR_GREY, "Do not have a car in the first slot!");
                    return 1;
                }
REPLACE MY ORIGNAL INTO THIS:
pawn Код:
CMD:trackcar(playerid)
{
    new slot1[50];
    new slot2[50];
    new slot3[50];
    new slot4[50];
    new slot5[50];
    new dialog[200];
    trackcars[playerid][0] = 0;
    trackcars[playerid][1] = 0;
    trackcars[playerid][2] = 0;
    trackcars[playerid][3] = 0;
    trackcars[playerid][4] = 0;
    for(new x = 0; x < MAX_VEHICLES; x ++ )
    {
        if(!strcmp(GetPlayerNameEx(playerid), CarInfo[x][oOwner]))
        {
            if(CarInfo[x][oCmodel] == 0)
            {
                continue;
            }
            if(CarInfo[x][oSlot] == 1)
            {
                format(slot1, 50, "1.\t%s", GetVehicleNameFromModel(CarInfo[x][oCmodel]));
                trackcars[playerid][0] = x;
            }
            if(CarInfo[x][oSlot] == 2)
            {
                format(slot2, 50, "2.\t%s", GetVehicleNameFromModel(CarInfo[x][oCmodel]));
                trackcars[playerid][1] = x;
            }
            if(CarInfo[x][oSlot] == 3)
            {
                format(slot3, 50, "3.\t%s", GetVehicleNameFromModel(CarInfo[x][oCmodel]));
                trackcars[playerid][2] = x;
            }
            if(CarInfo[x][oSlot] == 4)
            {
                format(slot4, 50, "4.\t%s", GetVehicleNameFromModel(CarInfo[x][oCmodel]));
                trackcars[playerid][3] = x;
            }
            if(CarInfo[x][oSlot] == 5)
            {
                format(slot5, 50, "5.\t%s", GetVehicleNameFromModel(CarInfo[x][oCmodel]));
                trackcars[playerid][4] = x;
            }
        }
    }
    if(strlen(slot1) < 3)
    {
        slot1 = "1.\tEmpty";
        trackcars[playerid][0] = 0;
    }
    if(strlen(slot2) < 3)
    {
        slot2 = "2.\tEmpty";
        trackcars[playerid][1] = 0;
    }
    if(strlen(slot3) < 3)
    {
        slot3 = "3.\tEmpty";
        trackcars[playerid][2] = 0;
    }
    if(strlen(slot4) < 3)
    {
        slot4 = "4.\tEmpty";
        trackcars[playerid][3] = 0;
    }
    if(strlen(slot5) < 3)
    {
        slot5 = "5.\tEmpty";
        trackcars[playerid][4] = 0;
    }
    format(dialog, 200, "%s\n%s\n%s\n%s\n%s",slot1, slot2, slot3, slot4, slot5);
    ShowPlayerDialog(playerid, DIALOG_TRACK, DIALOG_STYLE_LIST, "Track car", dialog, "Track", "Exit");
    return true;
}
Reply
#2

Why are you making double threads?
https://sampforum.blast.hk/showthread.php?tid=268073
Reply
#3

Sorry sir i thought no one understand old one sir kindly give me solution?
Reply
#4

PHP код:
{
    if(
strcmp(cmd"/findcar"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
         {
              
ShowPlayerDialog(playerid,0,DIALOG_STYLE_LIST,"{FFFF00}Car Tracking Service","Slot 1\nSlot2 \nSlot3","Locate","Exit");
        }
        return 
1;
    }
    return 
0;
}
public 
OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
{
    if(
dialogid == 0)
    {
        if(
response == 1)
        {
            switch(
listitem)
            {
                case 
0:
                {
                    if(
PlayerInfo[playerid][pPcarkey] == 9999)
                    {
                        
SendClientMessage(playeridCOLOR_GREY"You dont have a car in slot 1!");
                        return 
1;
                    }
                    if(
Searching[playerid] == 0)
                    {
                        
Searching[playerid] = 1;
                         
SetPlayerCheckpoint(playeridX,Y,Z5.0);
                          
format(stringsizeof(string),"Your car is marked on the map (red marker), are located in the zone %s!",zone);
                           
SendClientMessage(playeridCOLOR_GREYstring);
                           return 
1;
                    }
                    else
                      {
                        
SetPlayerCheckpoint(playeridX,Y,Z5.0);
                          
format(stringsizeof(string),"Your car is marked on the map (red marker), are located in the zone %s!",zone);
                        
SendClientMessage(playeridCOLOR_GREYstring);
                    }
                }
                case 
1:
                {
                    if(
PlayerInfo[playerid][pPcarkey2] == 9999)
                     {
                          
SendClientMessage(playeridCOLOR_GREY"You dont have a car in slot 2!");
                        return 
1;
                    }
                {
            }
        if(
response == 0)
        {
            
SendClientMessage(playerid,COLOR_GREY,"You have exited Car Tracking Menu!");
        }
    }
    return 
1;

Reply
#5

Thanks so much......sir
Reply
#6

No problem!
Reply
#7

Sir can you fix this code in this
pawn Код:
if(strcmp(cmd, "/findcar", true) == 0) // By DraGoN
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "Example: /findcar [Card slot id 1 or 2]");
                return 1;
            }
            new number = strval(tmp);
            if(number < 1 || number > 3)
                {
                    SendClientMessage(playerid, COLOR_GREY, "Vehicle id 1 or 2.");
                    return 1;
                }
            if(number == 1)
            {
                if(PlayerInfo[playerid][pPcarkey] == 9999)
                {
                    SendClientMessage(playerid, COLOR_GREY, "No Vehicle in this car!");
                    return 1;
                }
                new carid = PlayerInfo[playerid][pPcarkey];
                new Float:X, Float:Y, Float:Z;
                new zone[MAX_ZONE_NAME];
                GetVehicle2DZone(carid, zone, MAX_ZONE_NAME);
                GetVehiclePos(carid, X,Y,Z);
                if(Searching[playerid] == 0)
                {
                    Searching[playerid] = 1;
                    SetPlayerCheckpoint(playerid, X,Y,Z, 5.0);
                    format(string, sizeof(string),"Your cars are marked on the map (red marker), located in the zone %s!",zone);
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                }
                else
                {
                    SetPlayerCheckpoint(playerid, X,Y,Z, 5.0);
                    format(string, sizeof(string),"Your cars are marked on the map (red marker), located in the zone %s!",zone);
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                }
            }

            else if(number == 2)
            {
                if(PlayerInfo[playerid][pPcarkey3] == 9999)
                {
                    SendClientMessage(playerid, COLOR_GREY, "No Vehicle in this car");
                    return 1;
                }
                new carid = PlayerInfo[playerid][pPcarkey2];
                new Float:X, Float:Y, Float:Z;
                new zone[MAX_ZONE_NAME];
                GetVehicle2DZone(carid, zone, MAX_ZONE_NAME);
                GetVehiclePos(carid, X,Y,Z);
                if(Searching[playerid] == 0)
                {
                    Searching[playerid] = 1;
                    SetPlayerCheckpoint(playerid, X,Y,Z, 5.0);
                    format(string, sizeof(string),"Your cars are marked on the map (red marker), located in the zone %s!",zone);
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                }
                else
                {
                    SetPlayerCheckpoint(playerid, X,Y,Z, 5.0);
                    format(string, sizeof(string),"Your cars are marked on the map (red marker), located in the zone %s!",zone);
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                }
            }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)