ShowPlayerDialog /findcar[Please help] -
kingchandio - 12.07.2011
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;
}
Re: ShowPlayerDialog /findcar[Please help] -
[MG]Dimi - 12.07.2011
Why are you making double threads?
https://sampforum.blast.hk/showthread.php?tid=268073
Re: ShowPlayerDialog /findcar[Please help] -
kingchandio - 12.07.2011
Sorry sir i thought no one understand old one sir kindly give me solution?
Re: ShowPlayerDialog /findcar[Please help] -
[MG]Dimi - 12.07.2011
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(playerid, COLOR_GREY, "You dont have a car in slot 1!");
return 1;
}
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);
return 1;
}
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);
}
}
case 1:
{
if(PlayerInfo[playerid][pPcarkey2] == 9999)
{
SendClientMessage(playerid, COLOR_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;
}
Re: ShowPlayerDialog /findcar[Please help] -
kingchandio - 12.07.2011
Thanks so much......sir
Re: ShowPlayerDialog /findcar[Please help] -
[MG]Dimi - 12.07.2011
No problem!
Re: ShowPlayerDialog /findcar[Please help] -
kingchandio - 23.07.2011
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;
}