PHP Code:
CMD:additem(playerid,params[])
{
new items[32], slotid;
for(new i =0;i<MAX_BOXS;i++)
{
if(IsPlayerInRangeOfPoint(playerid,2,BoxInfo[i][xPos],BoxInfo[i][yPos],BoxInfo[i][zPos]))
{
if(sscanf(params, "us[32]",items,slotid)) return SCM(playerid, COLOR_WHITE, " /additem [ item ] [ slot ] ");
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;
}