23.11.2017, 14:32
Hello,
I have created a command to create items but when it's typed ingame, it executes the command twice.
It will send twice the message and give you 2 items.
What is the problem? what did i do wrong?
I have created a command to create items but when it's typed ingame, it executes the command twice.
It will send twice the message and give you 2 items.
What is the problem? what did i do wrong?
Код:
CMD:createitem(playerid,params[]) { new modelid, str[128]; if(AdminLevel[playerid] >=5) { if(PlayerInfo[playerid][aDuty] == 0) return SendClientMessage(playerid,GREY,"You are not on admin duty."); if(sscanf(params,"i",modelid)) return SendClientMessage(playerid,GREY,"USAGE: /createitem [itemid]"); SaveInventory(playerid); if(modelid == 19942) { AddItem(playerid, modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvRadio] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19141) { AddItem(playerid, modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvPoliceHelmet] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19110) { AddItem(playerid, modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvArmyHelmet] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19567) { AddItem(playerid, modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvGunpowder] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19568) { AddItem(playerid, modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvLead] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 341) { AddItem(playerid, modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvChainsaw] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 3026) { AddItem(playerid, modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvBag] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 346) { AddItem(playerid, modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][Inv9mm] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 336) { AddItem(playerid, modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvBat] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 849) { AddItem(playerid ,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvInduScraps] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 2902) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvPlasticScraps] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 18016) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvMetalScraps] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 1463) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvLogs] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 331) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvBrass] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 347) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvS9mm] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 348) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvDeagle] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 349) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvShotgun] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 350) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvSawedoff] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 351) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvSpas12] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 352) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvUzi] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 353) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvMP5] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 355) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvAK47] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 356) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvM4] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 372) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvTEC9] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 357) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvRifle] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 358) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvSniper] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19110) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvArmyHelmet] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19141) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvArmyHelmet] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 371) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvParachute] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 335) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvKnife] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 337) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvShovel] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 367) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvCamera] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 325) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvFlowers] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19515) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvKevlar] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19036) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvMask] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19577) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvApple] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19578) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvBanana] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19574) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvOrange] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19570) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvWater] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 19921) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvToolkit] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 11738) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvMedkit] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 11736) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvBandages] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } if(modelid == 3044) { AddItem(playerid,modelid); Inventory[playerid][InvSlots] += 1; Inventory[playerid][InvCigar] += 1; format(str,sizeof(str),"Item created: %s",GetItemName(modelid)); SendClientMessage(playerid, GREEN , str); } }else return SendClientMessage(playerid,GREY,"You are not an admin"); return 1; }