[Ajuda] Dialog range loot
#1

Ola, tou com esse problema aqui faz um que o certo do sistema era para ser que quando o player clicar em um item no dialog, o item vб para o inventario dele, so que ao inves de apenas o item selecionado ir para o inventario. todos os items que estao no dialog(ou seja, que estao por perto do range) estao indo par a o inventario do player!

sistema:

Eu acho que o erro esta aqui:
PHP код:
public OnPlayerPickupItemFromDrop(playerid)
{
    for(new 
iMAX_DROPSi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid1.5DropInfo[i][dPosX], DropInfo[i][dPosY], DropInfo[i][dPosZ]))
        {
            new 
str[80],
                
itemid DropInfo[i][DropItemID];
            
format(strsizeof(str), "~w~(~y~%s~w~)~n~ added to your inventory."ItemInfo[itemid][Item_Name]);
            
GameTextForPlayer(playerid,str,2500,4);
            
ClearAnimations(playerid);
               
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.000004000);
            
AddItem(playeridItemInfo[itemid][Item_Name], 1);
            
DestroyDrop(i);
            return 
1;
  }
    }
    return 
1;

DialogResponse:
PHP код:
public Item_OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
D_PegarItem:
        {
            for(new 
iMAX_DROPSi++)
             {
                
// Se os slots usados for igual aos slots totais manda a msg
                
if(Player[playerid][pSlots] == Player[playerid][pBackpack]) return GameTextForPlayer(playerid,"~r~Seu Inventario esta Cheio!",1000,4);
                
OnPlayerPickupItemFromDrop(playerid);
            }
        }
    }
    return 
1;

OnPlayerKeyStateChange:
PHP код:
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
     if (
GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK)
        if(
PRESSED(KEY_NO))
        {
            new 
str[80], itemid;
            for(new 
iMAX_DROPSi++)
            {
                if(
IsPlayerInRangeOfPoint(playerid1.5DropInfo[i][dPosX], DropInfo[i][dPosY], DropInfo[i][dPosZ]))
                {
                    
itemid DropInfo[i][DropItemID];
                    
format(strsizeof(str), "%s%s\n"strItemInfo[itemid][Item_Name]);
                }
            }
            if(
Player[playerid][pIdioma] == 1ShowPlayerDialog(playeridD_PegarItemDIALOG_STYLE_TABLIST"{FFFFFF}Voce deseja adicionar este item ao seu inventario ?"str"Pegar""Fechar");
            else 
ShowPlayerDialog(playeridD_PegarItemDIALOG_STYLE_TABLIST"{FFFFFF}You want to add this item to your inventory ?"str"Take""Close");
        }
        if(
PRESSED(KEY_YES)) ShowInventory(playerid);
    } 
PHP код:
enum Item_Data
{
    
Item_ID,
    
Item_Obj,
    
Item_Name[MAX_ITEM_NAME],
    
Float:Item_RotX,
    
Float:Item_RotY,
    
Float:Item_RotZ,
};
enum Drop_Data
{
    
DropItemID,
    
DropObj,
    
Text3D:DropLabel,
    
Float:dPosX,
    
Float:dPosY,
    
Float:dPosZ,
};
new 
DropInfo[MAX_DROPS][Drop_Data];
// # Arrays #
/* Agradecimento ao Marttins por procurar os objetos */
new ItemInfo[][Item_Data] =
{
    
/* id, objeto, nome, rotacao x, rotacao y, rotacao z */
    /* ============ [ Mochilas ] ============ */
    
{0,   3026,       "Taloon Backpack",    -88.3990.00.0 },
    {
1,   1310,       "Hunting Backpack",   -90.2990.00.0 },
    {
2,   19559,      "Hiker Backpack",     -91.7990.00.0 },
    {
3,   1550,       "Drybag Backpack",    0.0, -94.8990.0 },
    
/* ========== [ Items Medicos ] ========== */
    
{4,   11738,      "Medical Kit",        0.00.00.0     },
    {
5,   11748,      "Bandage",            0.00.00.0     },
    {
6,   2752,       "Morphine",           0.00.00.0     },
    {
7,   2709,       "Painkiller",         0.00.00.0     },
    {
8,   1580,       "Blood Bag",          0.00.00.0     },
    
/* ============= [ Bebidas ] ============= */
    
{9,    19570,     "Fresh Milk",         0.00.00.0     },
    {
10,   2683,      "Water Canteen",      0.00.00.0     },
    {
11,   1546,      "Sprunk Can",         0.00.00.0     },
    {
12,   19823,     "Whisky Bottle",      0.00.00.0     },
    {
13,   19563,     "Orange Juice",       0.00.00.0     },
    {
14,   19564,     "Apple Juice",        0.00.00.0     },
    {
15,   19835,     "Coffee Cup",         0.00.00.0     },
    
/* ============= [ Comidas ] ============= */
    
{16,   19847,     "Leg Ham",            0.00.00.0     },
    {
17,   19883,     "Bread Slice",        0.00.00.0     },
    {
18,   2768,      "Burger",             0.00.00.0     },
    {
19,   19561,     "Cereal Box",         0.00.00.0     },
    {
20,   19580,     "Pizza",              0.00.00.0     },
    {
21,   2769,      "Taco",               0.00.00.0     },
    {
22,   19567,     "Ice Cream",          0.00.00.0     },
    {
23,   2858,      "Chinese Food",       0.00.00.0     },
    {
24,   19574,     "Orange",             0.00.00.0     },
    {
25,   19575,     "Apple",              0.00.00.0     },
    {
26,   19576,     "Green Apple",        0.00.00.0     },
    {
27,   19577,     "Tomato",             0.00.00.0     },
    {
28,   19578,     "Banana",             0.00.00.0     },
    
/* ============= [ Armas ] ============= */
    
{29,   346,       "Pitol 9mm",          90.00.00.0    },
    {
30,   347,       "Silenced Pistol",    90.00.00.0    },
    {
31,   357,       "Country Rifle",      90.00.00.0    },
    {
32,   358,       "Sniper Rifle",       90.00.00.0    },
    {
33,   356,       "M4A1",               90.00.00.0    },
    {
34,   355,       "AK-47",              90.00.00.0    },
    {
35,   349,       "MP-133 Shotgun",     90.00.00.0    },
    {
36,   350,       "Sawed-off IZH-43",   90.00.00.0    },
    {
37,   351,       "Combat Shotgun",     90.00.00.0    },
    {
38,   372,       "CZ61 Skorpion",      90.00.00.0    },
    {
39,   353,       "MP5-K",              90.00.00.0    },
    
/* ============= [ Armas Brancas ] ============= */
    
{40,   336,       "Baseball Bat",       90.00.00.0    },
    {
41,   339,       "Katana",             90.00.00.0    },
    {
42,   335,       "Knife",              90.00.00.0    },
    {
43,   337,       "Shovel",             90.00.00.0    },
    
/* ============= [ Granadas ] ============= */
    
{44,   342,       "Frag Grenade",       0.00.00.0     },
    
/* ============= [ Munições ] ============= */
    
{45,   3013,      "Assault Ammo",       0.00.00.0     },
    {
46,   2043,      "Shotgun Ammo",       0.00.00.0     },
    {
47,   2042,      "SMG Ammo",           0.00.00.0     },
    {
48,   2037,      "Pistol Ammo",        0.00.00.0     },
    {
49,   2038,      "Sniper Ammo",        0.00.00.0     },
    
/* ============= [ Variados ] ============= */
    
{50,   18875,     "GPS",                0.00.00.0     },
    {
51,   2386,      "Clothing",           0.00.00.0     },
    {
52,   1010,      "Engine",             0.00.00.0     },
    {
53,   19921,     "Toolbox",            0.00.00.0     },
    {
54,   2967,      "Radio Device",       0.00.00.0     },
    {
55,   19515,     "Armour Vest",        90.00.00.0    },
    {
56,   19472,     "Gas Mask",           0.00.00.0     },
    {
57,   19514,     "Helmet",             0.00.00.0     },
    {
58,   1650,      "Fuel Canister",      90.00.00.0    },
    
/* ============= [ Vazios ] ============= */
    
{59,   2683,  "Empty Water Canteen",    0.00.00.0     },
    {
60,   1650,  "Empty Fuel Canister",    90.00.00.0    },
    {
61,   1025,       "Tire",                 0.00.00.0    },
    {
62,   1025,       "Batery",             0.00.00.0    },
    {
63,   19036,       "Mask",             0.00.00.0    }
}; 
Reply
#2

Quote:
Originally Posted by PedroH
Посмотреть сообщение
Ola, tou com esse problema aqui faz um que o certo do sistema era para ser que quando o player clicar em um item no dialog, o item vб para o inventario dele, so que ao inves de apenas o item selecionado ir para o inventario. todos os items que estao no dialog(ou seja, que estao por perto do range) estao indo par a o inventario do player!

sistema:

Eu acho que o erro esta aqui:
PHP код:
public OnPlayerPickupItemFromDrop(playerid)
{
    for(new 
iMAX_DROPSi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid1.5DropInfo[i][dPosX], DropInfo[i][dPosY], DropInfo[i][dPosZ]))
        {
            new 
str[80],
                
itemid DropInfo[i][DropItemID];
            
format(strsizeof(str), "~w~(~y~%s~w~)~n~ added to your inventory."ItemInfo[itemid][Item_Name]);
            
GameTextForPlayer(playerid,str,2500,4);
            
ClearAnimations(playerid);
               
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.000004000);
            
AddItem(playeridItemInfo[itemid][Item_Name], 1);
            
DestroyDrop(i);
            return 
1;
  }
    }
    return 
1;

DialogResponse:
PHP код:
public Item_OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
D_PegarItem:
        {
            for(new 
iMAX_DROPSi++)
             {
                
// Se os slots usados for igual aos slots totais manda a msg
                
if(Player[playerid][pSlots] == Player[playerid][pBackpack]) return GameTextForPlayer(playerid,"~r~Seu Inventario esta Cheio!",1000,4);
                
OnPlayerPickupItemFromDrop(playerid);
            }
        }
    }
    return 
1;

OnPlayerKeyStateChange:
PHP код:
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
     if (
GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK)
        if(
PRESSED(KEY_NO))
        {
            new 
str[80], itemid;
            for(new 
iMAX_DROPSi++)
            {
                if(
IsPlayerInRangeOfPoint(playerid1.5DropInfo[i][dPosX], DropInfo[i][dPosY], DropInfo[i][dPosZ]))
                {
                    
itemid DropInfo[i][DropItemID];
                    
format(strsizeof(str), "%s%s\n"strItemInfo[itemid][Item_Name]);
                }
            }
            if(
Player[playerid][pIdioma] == 1ShowPlayerDialog(playeridD_PegarItemDIALOG_STYLE_TABLIST"{FFFFFF}Voce deseja adicionar este item ao seu inventario ?"str"Pegar""Fechar");
            else 
ShowPlayerDialog(playeridD_PegarItemDIALOG_STYLE_TABLIST"{FFFFFF}You want to add this item to your inventory ?"str"Take""Close");
        }
        if(
PRESSED(KEY_YES)) ShowInventory(playerid);
    } 
PHP код:
enum Item_Data
{
    
Item_ID,
    
Item_Obj,
    
Item_Name[MAX_ITEM_NAME],
    
Float:Item_RotX,
    
Float:Item_RotY,
    
Float:Item_RotZ,
};
enum Drop_Data
{
    
DropItemID,
    
DropObj,
    
Text3D:DropLabel,
    
Float:dPosX,
    
Float:dPosY,
    
Float:dPosZ,
};
new 
DropInfo[MAX_DROPS][Drop_Data];
// # Arrays #
/* Agradecimento ao Marttins por procurar os objetos */
new ItemInfo[][Item_Data] =
{
    
/* id, objeto, nome, rotacao x, rotacao y, rotacao z */
    /* ============ [ Mochilas ] ============ */
    
{0,   3026,       "Taloon Backpack",    -88.3990.00.0 },
    {
1,   1310,       "Hunting Backpack",   -90.2990.00.0 },
    {
2,   19559,      "Hiker Backpack",     -91.7990.00.0 },
    {
3,   1550,       "Drybag Backpack",    0.0, -94.8990.0 },
    
/* ========== [ Items Medicos ] ========== */
    
{4,   11738,      "Medical Kit",        0.00.00.0     },
    {
5,   11748,      "Bandage",            0.00.00.0     },
    {
6,   2752,       "Morphine",           0.00.00.0     },
    {
7,   2709,       "Painkiller",         0.00.00.0     },
    {
8,   1580,       "Blood Bag",          0.00.00.0     },
    
/* ============= [ Bebidas ] ============= */
    
{9,    19570,     "Fresh Milk",         0.00.00.0     },
    {
10,   2683,      "Water Canteen",      0.00.00.0     },
    {
11,   1546,      "Sprunk Can",         0.00.00.0     },
    {
12,   19823,     "Whisky Bottle",      0.00.00.0     },
    {
13,   19563,     "Orange Juice",       0.00.00.0     },
    {
14,   19564,     "Apple Juice",        0.00.00.0     },
    {
15,   19835,     "Coffee Cup",         0.00.00.0     },
    
/* ============= [ Comidas ] ============= */
    
{16,   19847,     "Leg Ham",            0.00.00.0     },
    {
17,   19883,     "Bread Slice",        0.00.00.0     },
    {
18,   2768,      "Burger",             0.00.00.0     },
    {
19,   19561,     "Cereal Box",         0.00.00.0     },
    {
20,   19580,     "Pizza",              0.00.00.0     },
    {
21,   2769,      "Taco",               0.00.00.0     },
    {
22,   19567,     "Ice Cream",          0.00.00.0     },
    {
23,   2858,      "Chinese Food",       0.00.00.0     },
    {
24,   19574,     "Orange",             0.00.00.0     },
    {
25,   19575,     "Apple",              0.00.00.0     },
    {
26,   19576,     "Green Apple",        0.00.00.0     },
    {
27,   19577,     "Tomato",             0.00.00.0     },
    {
28,   19578,     "Banana",             0.00.00.0     },
    
/* ============= [ Armas ] ============= */
    
{29,   346,       "Pitol 9mm",          90.00.00.0    },
    {
30,   347,       "Silenced Pistol",    90.00.00.0    },
    {
31,   357,       "Country Rifle",      90.00.00.0    },
    {
32,   358,       "Sniper Rifle",       90.00.00.0    },
    {
33,   356,       "M4A1",               90.00.00.0    },
    {
34,   355,       "AK-47",              90.00.00.0    },
    {
35,   349,       "MP-133 Shotgun",     90.00.00.0    },
    {
36,   350,       "Sawed-off IZH-43",   90.00.00.0    },
    {
37,   351,       "Combat Shotgun",     90.00.00.0    },
    {
38,   372,       "CZ61 Skorpion",      90.00.00.0    },
    {
39,   353,       "MP5-K",              90.00.00.0    },
    
/* ============= [ Armas Brancas ] ============= */
    
{40,   336,       "Baseball Bat",       90.00.00.0    },
    {
41,   339,       "Katana",             90.00.00.0    },
    {
42,   335,       "Knife",              90.00.00.0    },
    {
43,   337,       "Shovel",             90.00.00.0    },
    
/* ============= [ Granadas ] ============= */
    
{44,   342,       "Frag Grenade",       0.00.00.0     },
    
/* ============= [ Munições ] ============= */
    
{45,   3013,      "Assault Ammo",       0.00.00.0     },
    {
46,   2043,      "Shotgun Ammo",       0.00.00.0     },
    {
47,   2042,      "SMG Ammo",           0.00.00.0     },
    {
48,   2037,      "Pistol Ammo",        0.00.00.0     },
    {
49,   2038,      "Sniper Ammo",        0.00.00.0     },
    
/* ============= [ Variados ] ============= */
    
{50,   18875,     "GPS",                0.00.00.0     },
    {
51,   2386,      "Clothing",           0.00.00.0     },
    {
52,   1010,      "Engine",             0.00.00.0     },
    {
53,   19921,     "Toolbox",            0.00.00.0     },
    {
54,   2967,      "Radio Device",       0.00.00.0     },
    {
55,   19515,     "Armour Vest",        90.00.00.0    },
    {
56,   19472,     "Gas Mask",           0.00.00.0     },
    {
57,   19514,     "Helmet",             0.00.00.0     },
    {
58,   1650,      "Fuel Canister",      90.00.00.0    },
    
/* ============= [ Vazios ] ============= */
    
{59,   2683,  "Empty Water Canteen",    0.00.00.0     },
    {
60,   1650,  "Empty Fuel Canister",    90.00.00.0    },
    {
61,   1025,       "Tire",                 0.00.00.0    },
    {
62,   1025,       "Batery",             0.00.00.0    },
    {
63,   19036,       "Mask",             0.00.00.0    }
}; 
UP galera vamo ajuda o mano
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)