23.03.2017, 19:56
Hello,
I really could use some help.
I am creating an inventory system.
Everything works fine, but if i want to trade it using /giveitem. It gives the item to ID0.
How can i make it, that INVENTORY_TRADE also receives the ID that is given at /giveitem?
Code:
I really could use some help.
I am creating an inventory system.
Everything works fine, but if i want to trade it using /giveitem. It gives the item to ID0.
How can i make it, that INVENTORY_TRADE also receives the ID that is given at /giveitem?
Code:
Код:
//============================================================================== CMD:giveitem(playerid,params[]) { new player1; if(IsMuted(playerid))return 1; { if(sscanf(params,"u",player1)) return SendClientMessage(playerid,GREY,"USAGE: /giveitem [playerid]"); if(!IsPlayerConnectedEx(player1) || player1==playerid)return SendClientMessage(playerid,GREY,"Invalid player ID"); ShowInventoryTrade(playerid); } return 1; } //============================================================================== public OnPlayerModelSelectionEx(playerid, response, extraid, modelid) { if(extraid == INVENTORY_TRADE) { if(response) { if(modelid == 18631) return SendClientMessage(playerid,-1,"There slot does not have any item. "); if(modelid == 346) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a 9mm to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 331) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a set of brass knuckles to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 347) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Silenced 9mm to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 348) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Desert Eagle to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 349) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Shotgun to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 350) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Sawed-off Shotgun to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 351) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a SPAS-12 Shotgun to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 352) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Uzi to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 353) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a MP5 to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 355) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a AK-47 to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 356) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a M4 to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 372) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a TEC-9 to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 357) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Rifle to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 358) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Sniper Rifle to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 371) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Parachute to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 335) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Knife to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 336) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Baseball bat to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 337) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Spade to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 367) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Camera to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 19921) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Toolkit to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 11738) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave a Medkit to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 11736) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave some bandages to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } if(modelid == 325) { new player1,str[128]; format(str,sizeof(str),"%s(%i) gave some flowers to %s(%i)",PlayerName(playerid),playerid,PlayerName(player1),player1); SendNearbyMessage(playerid,30.0,str,ORANGE); RemoveItem(playerid,modelid); AddItem(player1,modelid); } } else SendClientMessage(playerid, 0xFF0000FF, "Trading canceled"); } return 1; } //============================================================================== stock ShowInventoryTrade(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] = 18631; } } ShowModelSelectionMenuEx(playerid, iteminv,20, "Inventory",INVENTORY_TRADE, 0.0, 0.0,0.0); return 1; }