Here is the gamemode on which im working: https://sampforum.blast.hk/showthread.php?tid=423627
if(dialogid == 558) { if(response) { new str[250], str2[250]; for(new i = 0; i < MAX_RP_VEHICLES; i++) { if(VehicleInfo[i][KeyHolder] == CharacterInfo[playerid][active_character[playerid]][cID]) { format(str2, sizeof(str2), "%s (%d)\n", VehicleInfo[i][vModel], VehicleInfo[i][vID]); strcat(str, str2); } } ShowPlayerDialog(playerid, 559, DIALOG_STYLE_LIST, ""COL_GREEN"JRP - Vehicle Keys", str, "Select", ""); } }
if(dialogid == 559)
{
if(response)
{
new count;
for(new i;i<MAX_RP_VEHICLES;i++)
{
if(listitem == count)
{
//count = listitem <=> listitem = count
//You can work either with count or listitem.
return 1;
}
count ++;
}
}
}
Hi!
I hope it's this what you want. PHP код:
|
if(dialogid == 559)
{
if(response)
{
new count;
for(new i;i<MAX_RP_VEHICLES;i++)
{
if(listitem == count)
{
printf("playerid %d clicked on the vehicle id %i",playerid,VehicleInfo[listitem][vID]);
//count = listitem <=> listitem = count
//You can work either with count or listitem.
return 1;
}
count ++;
}
}
}
You would like to get the vehicle id, wouldn't you? Then you have to do it like this:
PHP код:
|
VehicleInfo[0][vID]
if(dialogid == 559)
{
if(response)
{
new count;
for(new i;i<MAX_RP_VEHICLES;i++)
{
if(listitem == count)
{
printf("playerid %d clicked on the vehicle id %i",playerid,i);
//count = listitem <=> listitem = count
//You can work either with count or listitem.
return 1;
}
count ++;
}
}
}
mysql_fetch_field_row(b,"id"); VehicleInfo[i][vID] = strval(b);
if(dialogid == 559)
{
if(response)
{
new count;
for(new i = 0; i < MAX_RP_VEHICLES; i++)
{
if(VehicleInfo[i][KeyHolder] == CharacterInfo[playerid][active_character[playerid]][cID])
{
if(listitem == count)
{
//VehicleInfo[i][vID] is your vehicleid...
printf("Player %d clicked on the vehicle id %i",playerid, VehicleInfo[i][vID]);
return 1;
}
count++;
}
}
}
}
if(dialogid == 558)
{
if(response)
{
new str[250], str2[250], count;
for(new i = 0; i < MAX_RP_VEHICLES; i++)
{
count++;
if(VehicleInfo[i][KeyHolder] == CharacterInfo[playerid][active_character[playerid]][cID])
{
format(str2, sizeof(str2), "%s (%d)\n", VehicleInfo[i][vModel], VehicleInfo[i][vID]);
strcat(str, str2);
}
}
ShowPlayerDialog(playerid, 559, DIALOG_STYLE_LIST, ""COL_GREEN"JRP - Vehicle Keys", str, "Select", "");
}
}
if(dialogid == 559)
{
if(response)
{
}
}