13.12.2016, 21:32
Hello guys. Today i started working on Item Sell system. I dont know how to Add Something In Shop.
Heres my codes.
Heres Sell Code
And Heres Dialog
Thanks For Help.
Heres my codes.
PHP код:
/* ENUMATORS */
enum invgayidva
{
invisid,
iyideba = 0,
vincyidisid[MAX_PLAYERS],
fasi
}
new InvSInfo[40][invgayidva];
new ItemebisID = 0;
PHP код:
stock ItemSellBuy(playerid)
{
for(new itemii;itemii<MAX_SELLITEMS;itemii++)
{
new formati[1024], suturu[1024], suturun2[1024], listiii[1024];
new adminiiiii=0;
if(InvSInfo[itemii][iyideba] > 0 && itemii != 0)
{
PlayerAdminMassage[playerid][adminiiiii] = itemii;
adminiiiii++;
format(suturu, sizeof(suturu), "%s - %s - %d\n", GetName(InvSInfo[itemii][vincyidisid]),InvNames[InvSInfo[itemii][invisid]],InvSInfo[itemii][fasi]);
strins(listiii, suturu, strlen(formati), strlen(suturu));
}
else { SendClientMessage(playerid, COLOR_RED, ""#servn"Motamasheebi Ar Yidian Arafers.");}
format(suturun2,sizeof(suturun2), "COIN SHOP - IYIDEBA %d ITEMI", InvSInfo[itemii][iyideba]);
ShowPlayerDialog(playerid,dialog_coinbuysell,DIALOG_STYLE_LIST,suturun2,listiii,"Yidva","Gatishva");
}
return 1;
}
stock ShowInvForSell(playerid)
{
new str[1024], slotstr[1024];
new listitems[1024], adm=0;
for(new slot;slot<INVNUMBERS;slot++)
{
if(PlayerInv[playerid][slot] > 0 && slot != 0)
{
PlayerAdminMassage[playerid][adm] = slot;
adm ++;
format(str, sizeof(str), "[%d] - %s\n", PlayerInv[playerid][slot],InvNames[slot]);
strins(listitems, str, strlen(listitems), strlen(str));
}
}
if(Player[playerid][pPack] == 1) format(slotstr,sizeof(slotstr),"Dzalian Patara Zurgchanta [%d/%d]",Player[playerid][pSlots],Player[playerid][pPack]*10);
else if(Player[playerid][pPack] == 2) format(slotstr,sizeof(slotstr),"Patara Zurgchanta [%d/%d]",Player[playerid][pSlots],Player[playerid][pPack]*10);
else if(Player[playerid][pPack] == 3) format(slotstr,sizeof(slotstr),"Sashualo Zurgcahnta [%d/%d]",Player[playerid][pSlots],Player[playerid][pPack]*10);
else if(Player[playerid][pPack] == 4) format(slotstr,sizeof(slotstr),"Didi Zurgchanta [%d/%d]",Player[playerid][pSlots],Player[playerid][pPack]*10);
else if(Player[playerid][pPack] == 5) format(slotstr,sizeof(slotstr),"Dzalian Didi Zurgchanta [%d/%d]",Player[playerid][pSlots],Player[playerid][pPack]*10);
ShowPlayerDialog(playerid,dialog_sellitemi,DIALOG_STYLE_LIST,slotstr,listitems,"Gayidva","Gatishva");
return 1;
}
PHP код:
if(dialogid == dialog_sellitemi)
{
if(response)
{
playermassagetoadmin[playerid] = PlayerAdminMassage[playerid][listitem];
PlayerInv[playerid][playermassagetoadmin[playerid]]--;
Player[playerid][pSlots] --;
new buffer[128], buffer2[128];
format(buffer, sizeof(buffer), ""#servn" {ffffff}Tqven Dadet Gasayidad Nivti: {00FFFF}%s.", InvNames[playermassagetoadmin[playerid]]);
SendClientMessage(playerid, COLOR_GRAD, buffer);
format(buffer2, sizeof(buffer2), ""#servn" {ffffff}%s Yidis Nivts: {00FFFF}%s. {ffffff} Fasi: {00FFFF}%d", Name(playerid), InvNames[playermassagetoadmin[playerid]]);
SendClientMessageToAll(COLOR_GRAD, buffer2);
if(playermassagetoadmin[playerid] == 10) RemovePlayerWeapon(playerid,25);
else if(playermassagetoadmin[playerid] == 11) RemovePlayerWeapon(playerid,24);
else if(playermassagetoadmin[playerid] == 12) RemovePlayerWeapon(playerid,30);
else if(playermassagetoadmin[playerid] == 13) RemovePlayerWeapon(playerid,31);
else if(playermassagetoadmin[playerid] == 14) RemovePlayerWeapon(playerid,34);
else if(playermassagetoadmin[playerid] == 15) RemovePlayerWeapon(playerid,28);
else if(playermassagetoadmin[playerid] == 16) RemovePlayerWeapon(playerid,29);
else if(playermassagetoadmin[playerid] == 17) RemovePlayerWeapon(playerid,32);
else if(playermassagetoadmin[playerid] == 26) RemovePlayerWeapon(playerid,5);
else if(playermassagetoadmin[playerid] == 27) RemovePlayerWeapon(playerid,8);
else if(playermassagetoadmin[playerid] == 28) RemovePlayerWeapon(playerid,6);
else if(playermassagetoadmin[playerid] == 29) RemovePlayerWeapon(playerid,4);
else if(playermassagetoadmin[playerid] == 30) RemovePlayerWeapon(playerid,3);
else if(playermassagetoadmin[playerid] == 59) RemovePlayerWeapon(playerid,22);
else if(playermassagetoadmin[playerid] == 60) RemovePlayerWeapon(playerid,23);
else if(playermassagetoadmin[playerid] == 61) RemovePlayerWeapon(playerid,26);
else if(playermassagetoadmin[playerid] == 62) RemovePlayerWeapon(playerid,35);
else if(playermassagetoadmin[playerid] == 71) RemovePlayerWeapon(playerid,33);
else if(playermassagetoadmin[playerid] == 72) RemovePlayerWeapon(playerid,27);
else if(playermassagetoadmin[playerid] == 73) RemovePlayerWeapon(playerid,16);
else if(playermassagetoadmin[playerid] == 74) RemovePlayerWeapon(playerid,18);
return 1;
}else{}
}