17.08.2017, 16:48
I think this should work: (poor identation because of COPY-PASTE)
Код:
CMD:additem(playerid,params[]) { new items[32], slotid; if(sscanf(params, "s[32]d",items,slotid)) return SCM(playerid, COLOR_WHITE, " /additem [ item ] [ slot ] "); //You placed the parameters in format wrong... Also don't put sscanf in a loop (it would generate you, hmm, like MAX_BOXS SCMs) for(new i =0;i<MAX_BOXS;i++) { if(IsPlayerInRangeOfPoint(playerid,2,BoxInfo[i][xPos],BoxInfo[i][yPos],BoxInfo[i][zPos])) { if(strcmp(items, "burger", true)) { if(PlayerHasItem(playerid,"Burger")) { BoxInfo[i][Item][slotid] = BurgerItem; RemoveItem(playerid,"Burger",1); PlayerInfo[playerid][pSlotu] --; } else{SCM(playerid,COLOR_RED,"You don't have Burger");} return 1; } else if(strcmp(items, "pizza", true)) { if(PlayerHasItem(playerid,"Pizza")) { BoxInfo[i][Item][slotid] = PizzaItem; RemoveItem(playerid,"Pizza",1); PlayerInfo[playerid][pSlotu] --; } else{SCM(playerid,COLOR_RED,"You don't have Pizza");} return 1; } SaveThisBox(i); } } return 1; }