Command problem
#1

Hello guys so when a player registers his Inv1 == IDCard but when i do /i use 1 it eats a sandwich and shows the IDCard

i don't know why this is happening but here is the code i use correctly for it

pawn Код:
CMD:i(playerid,params[])
{
    new option[4], itemslot, string[128];
    if (sscanf(params, "s[4]i", option, itemslot)) return SendClientMessage(playerid, -1, "USAGE: /i use (itemslot).");
    if (!strcmp(option, "use", true))
    {
        if (itemslot == 1)
        {
            new firetext[20], drivetext[20];
            if(pInfo[playerid][pFireArms] == 0)
            {
                firetext = "None";
            }
            if(pInfo[playerid][pFireArms] == 1)
            {
               firetext = "Yes";
            }
            if(pInfo[playerid][pDrive] == 0)
            {
               drivetext = "None";
            }
            if(pInfo[playerid][pDrive] == 1)
            {
               drivetext = "Yes";
            }
            itemslot = pInfo[playerid][pInv1];
            if(pInfo[playerid][pInv1] == IDCard[playerid] && IDCard[playerid] == 1)//ID Card
            {
               format(string,sizeof(string),"Name: %s\nDriving License: %s\nFirearms License: %s",GetName(playerid),drivetext,firetext);
               ShowPlayerDialog(playerid,IDCARD,DIALOG_STYLE_MSGBOX,"ID CARD",string,"Ok","");
            }
            if(pInfo[playerid][pInv1] == BusTicket[playerid] && BusTicket[playerid] == 1)//Bus Ticket
            {

            }
            if(pInfo[playerid][pInv1] == Sandwich[playerid] && Sandwich[playerid] >= 1)//Sandwich
            {
               Sandwich[playerid] -= 1;
               RestoreHealth[playerid] = 10;
               ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1, 1, 1, 1, 0, 5000, 1);
               for(new i = 0; i < MAX_PLAYERS; i++){
               if(PlayerToPlayer(playerid,i,13)){
               format(string,sizeof(string),"{F700FF}*%s starts eating a sandwich.",GetName(playerid));
               SendClientMessage(i,-1,string);}}
            }
        }
    }
    else SendClientMessage(playerid, -1, "Available options: use");
    return 1;
}
Saving system
pawn Код:
INI_WriteInt(file,"Inventory_Slot_1", IDCard[playerid] = 1);//ID Card
            INI_WriteInt(file,"Inventory_Slot_2", BusTicket[playerid] = 1);//Bus Ticket
            INI_WriteInt(file,"Inventory_Slot_3", 0);
            INI_WriteInt(file,"Inventory_Slot_4", Sandwich[playerid] = 1);//Sandwich
            INI_WriteInt(file,"Inventory_Slot_5", Water[playerid] = 1);//Water
            INI_WriteInt(file,"Inventory_Slot_6", 0);
            INI_WriteInt(file,"Inventory_Slot_7", Sprunk[playerid] = 1);//Sprunk
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)