27.02.2013, 18:43
hey all,
so i made this small thing, that when a player wants to put something in the trunk of his car, it gets the weapons the player has, and shows them in a dialog, but now my problem is:
how can i check at the dialog response, WHICH weapon is at the case 0, case 1, etc?
because i want to make it that it attaches the object into the trunk, now i already got the weapons that attach at the right place, i just need to know how i can make it that it checks which weapon the player has selected.
my code:
that checks which weapons the player has and puts it in a dialog.
i want to know which listitem is which weapon that the player has selected in the dialog, anybody knows how i do this?
greets Apenmeeuw
so i made this small thing, that when a player wants to put something in the trunk of his car, it gets the weapons the player has, and shows them in a dialog, but now my problem is:
how can i check at the dialog response, WHICH weapon is at the case 0, case 1, etc?
because i want to make it that it attaches the object into the trunk, now i already got the weapons that attach at the right place, i just need to know how i can make it that it checks which weapon the player has selected.
my code:
pawn Код:
else if(current == GameMenus[trunkmenu])
{
switch(row)
{
case STORE_WEAPONS:
{
new Count, x;
new string[128];
new WeapName[24], slot, weap, ammo;
for(slot = 0; slot < 14; slot++)
{
GetPlayerWeaponData(playerid, slot, weap, ammo);
if( ammo != 0 && weap != 0)
Count++;
}
if(Count < 1)
{
ShowMenuForPlayer(GameMenus[trunkmenu], playerid);
return SendClientMessage(playerid,COLOR_BLUE,"You have no weapons");
}
if(Count >= 1)
{
for (slot = 0; slot < 14; slot++)
{
GetPlayerWeaponData(playerid, slot, weap, ammo);
if( ammo != 0 && weap != 0)
{
GetWeaponName(weap, WeapName, sizeof(WeapName));
if(ammo == 65535 || ammo == 1)
format(string,sizeof(string),"%s%s (1)",string, WeapName);
else format(string,sizeof(string),"%s%s (%d)",string, WeapName, ammo);
x++;
if(x >= 5)
{
ShowPlayerDialog(playerid, DIALOG_TRUNKWEAPS, DIALOG_STYLE_LIST, "Deposit your Weapons", string, "Deposit", "Cancel");
x = 0;
format(string, sizeof(string), "");
}
else format(string, sizeof(string), "%s, ", string);
}
if(x <= 4 && x > 0)
{
string[strlen(string)-3] = '.';
ShowPlayerDialog(playerid, DIALOG_TRUNKWEAPS, DIALOG_STYLE_LIST, "Deposit your Weapons", string, "Deposit", "Cancel");
}
}
}
}
}
}
pawn Код:
switch(dialogid)
{
case DIALOG_TRUNKWEAPS:
{
if(response)
{
switch(listitem)
{
case 0:
{
}
}
}
}
greets Apenmeeuw