Inventory Help [(Rep++)Promise]
#1

pawn Код:
//INVENTORY TEXTDRAW

#include <a_samp>
#include <dini>
#include <zcmd>
#include <mSelection>
#define INVENTORY_MENU 1
enum inv
{
    MSlot,
    iSlot[20]
}
new InvInfo[MAX_PLAYERS][inv];
CMD:inventory(playerid,params[])
{
    ShowInventory(playerid);
    return 1;
}
CMD:add(playerid,params[])
{
    AddItem(playerid,1240);
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    SaveInventory(playerid);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    LoadInventory(playerid);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}
public OnPlayerModelSelectionEx(playerid, response, extraid, modelid)
{
    if(extraid == INVENTORY_MENU)
    {
        if(response)
        {
        if(modelid == 1239) return SendClientMessage(playerid,-1,"This slot no have item ");
        if(modelid == 1240)
        {
        SendClientMessage(playerid,-1,"Health = 100");
        SetPlayerHealth(playerid,100);
        RemoveItem(playerid,modelid);
        }
        SendClientMessage(playerid,-1,"Inventory");
        }
        else SendClientMessage(playerid, 0xFF0000FF, "Close Inventory");
    }
    return 1;
}
//stock
stock RemoveItem(playerid,modelid)
{
    for(new i = 0;i<20;i++)
    {
    if(InvInfo[playerid][iSlot][i] == modelid)
    {
    InvInfo[playerid][iSlot][i] = 0;
    break;
    }
    }
    return 1;
}
stock AddItem(playerid,modelid)
{
    for(new i = 0;i<20;i++)
    {
    if(InvInfo[playerid][iSlot][i] == 0)
    {
    InvInfo[playerid][iSlot][i] = modelid;
    break;
    }
   
    }
    return 1;
}
stock ShowInventory(playerid)
{
    new iteminv[21];
    for(new i = 0; i < 20;i++)
    {
    iteminv[i] = InvInfo[playerid][iSlot][i];
    if(InvInfo[playerid][iSlot][i] == 0)
    {
    iteminv[i] = 1239;
    }
   
    }
    ShowModelSelectionMenuEx(playerid, iteminv,20, "Inventory",INVENTORY_MENU, 0.0, 0.0,0.0);
    return 1;
}
stock ResetInventory(playerid)
{
    for(new i = 1 ; i <21;i++) InvInfo[playerid][iSlot][i] = 0;
    return 1;
}
stock SaveInventory(playerid)
{
    new file[64];
    format(file, sizeof(file), "Inventory/%s.ini", GetName(playerid));
    if(!dini_Exists(file)) dini_Create(file);
    dini_IntSet(file, "Slot0", InvInfo[playerid][iSlot][0]);
    dini_IntSet(file, "Slot1", InvInfo[playerid][iSlot][1]);
    dini_IntSet(file, "Slot2", InvInfo[playerid][iSlot][2]);
    dini_IntSet(file, "Slot3", InvInfo[playerid][iSlot][3]);
    dini_IntSet(file, "Slot4", InvInfo[playerid][iSlot][4]);
    dini_IntSet(file, "Slot5", InvInfo[playerid][iSlot][5]);
    dini_IntSet(file, "Slot6", InvInfo[playerid][iSlot][6]);
    dini_IntSet(file, "Slot7", InvInfo[playerid][iSlot][7]);
    dini_IntSet(file, "Slot8", InvInfo[playerid][iSlot][8]);
    dini_IntSet(file, "Slot9", InvInfo[playerid][iSlot][9]);
    dini_IntSet(file, "Slot10", InvInfo[playerid][iSlot][10]);
    dini_IntSet(file, "Slot11", InvInfo[playerid][iSlot][11]);
    dini_IntSet(file, "Slot12", InvInfo[playerid][iSlot][12]);
    dini_IntSet(file, "Slot13", InvInfo[playerid][iSlot][13]);
    dini_IntSet(file, "Slot14", InvInfo[playerid][iSlot][14]);
    dini_IntSet(file, "Slot15", InvInfo[playerid][iSlot][15]);
    dini_IntSet(file, "Slot16", InvInfo[playerid][iSlot][16]);
    dini_IntSet(file, "Slot17", InvInfo[playerid][iSlot][17]);
    dini_IntSet(file, "Slot18", InvInfo[playerid][iSlot][18]);
    dini_IntSet(file, "Slot19", InvInfo[playerid][iSlot][19]);
}
stock LoadInventory(playerid)
{
    new file[64];
    format(file, sizeof(file), "Inventory/%s.ini", GetName(playerid));
    InvInfo[playerid][iSlot][0] = dini_Int(file,"Slot0");
    InvInfo[playerid][iSlot][1] = dini_Int(file,"Slot1");
    InvInfo[playerid][iSlot][2] = dini_Int(file,"Slot2");
    InvInfo[playerid][iSlot][3] = dini_Int(file,"Slot3");
    InvInfo[playerid][iSlot][4] = dini_Int(file,"Slot4");
    InvInfo[playerid][iSlot][5] = dini_Int(file,"Slot5");
    InvInfo[playerid][iSlot][6] = dini_Int(file,"Slot6");
    InvInfo[playerid][iSlot][7] = dini_Int(file,"Slot7");
    InvInfo[playerid][iSlot][8] = dini_Int(file,"Slot8");
    InvInfo[playerid][iSlot][9] = dini_Int(file,"Slot9");
    InvInfo[playerid][iSlot][10] = dini_Int(file,"Slot10");
    InvInfo[playerid][iSlot][11] = dini_Int(file,"Slot11");
    InvInfo[playerid][iSlot][12] = dini_Int(file,"Slot12");
    InvInfo[playerid][iSlot][13] = dini_Int(file,"Slot13");
    InvInfo[playerid][iSlot][14] = dini_Int(file,"Slot14");
    InvInfo[playerid][iSlot][15] = dini_Int(file,"Slot15");
    InvInfo[playerid][iSlot][16] = dini_Int(file,"Slot16");
    InvInfo[playerid][iSlot][17] = dini_Int(file,"Slot17");
    InvInfo[playerid][iSlot][18] = dini_Int(file,"Slot18");
    InvInfo[playerid][iSlot][19] = dini_Int(file,"Slot19");
}
stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
Hello everyone i got this inventory system with mselection buti have a problem
I when i /add in inventory i have a problem
The next page didnt created example to go 1/2 or 2/2 He stay just 1/1 And i Cant add more items in it
thank for understend
Help mee and i will rep you
Reply
#2

Bump!!!
Reply
#3

AnyOne Please i need help and Sorry to all For Bump But i need it i am waiting for 7 hours pleaseeee
Reply
#4

I wait 1 day for no bump Can anyone help mee now ?
Reply
#5

Bump once each 24 hours.
Anyways. The max items should be edited.
Reply
#6

Where is max items ? In mselection.inc or its here give meee where please
Reply
#7

Anyone help mee !!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)