Salut (Gm-ul este burned) nu inteleg de ce este problema la seifuri, daca sunt in factiunea NR1 si folosesc /fwithdraw si /fdeposit nu mi incarca in baza de date daca pun ceva in seif, daca ma pun in factiunea NR2 si folosesc comanda, imi incarca la factiunea NR1, si tot asa. Va las aici poate gasiti voi ceva, eu nu-mi dau seama.
YCMD:fdeposit(playerid, params[], help) {
for(new s = 0; s < sizeof(SafeInfo); s++) {
if(PlayerToPoint(5.0, playerid, SafeInfo[s][sPosX], SafeInfo[s][sPosY], SafeInfo[s][sPosZ])) {
if(PlayerInfo[playerid][pMember] == SafeInfo[s][sFactionID]) {
SeifID[playerid] = PlayerInfo[playerid][pMember]-1;
ShowPlayerDialog(playerid, DIALOG_FDEPOSIT, DIALOG_STYLE_LIST, "Faction deposit", "Money\nMaterials\nDrugs", "Ok", "Exit");
}
}
}
return 1;
}
case DIALOG_FDEPOSIT: {
if(!response) return 1;
switch(listitem) {
case 0: {
ShowPlayerDialog(playerid, DIALOG_FDEPOSIT+1, DIALOG_STYLE_INPUT, "Deposit", "Scrie suma de bani pe care vrei sa o depozitezi putin mai jos!", "Select", "Inapoi");
}
case 1: {
ShowPlayerDialog(playerid, DIALOG_FDEPOSIT+1, DIALOG_STYLE_INPUT, "Deposit", "Scrie suma de materiale pe care vrei sa o depozitezi putin mai jos!", "Select", "Inapoi");
}
case 2: {
ShowPlayerDialog(playerid, DIALOG_FDEPOSIT+1, DIALOG_STYLE_INPUT, "Deposit", "Scrie suma de droguri pe care vrei sa o depozitezi putin mai jos!", "Select", "Inapoi");
}
}
SelectedItem[playerid] = listitem;
}
case DIALOG_FDEPOSIT+1: {
if(!response) {
ShowPlayerDialog(playerid, DIALOG_FDEPOSIT, DIALOG_STYLE_LIST, "Faction deposit", "Money\nMaterials\nDrugs", "Ok", "Exit");
return 1;
}
switch(SelectedItem[playerid]) {
case 0: {
if(GetPlayerCash(playerid) < strval(inputtext) || strval(inputtext) <= 0) return SendClientMessage(playerid, COLOR_WHITE, "* Suma invalida!");
SafeInfo[SeifID[playerid]][sMoney] += strval(inputtext);
GivePlayerCash(playerid, -strval(inputtext));
format(string, sizeof(string), "* %s a depozitat $%s in seiful factiunii.", GetName(playerid), FormatNumber(strval(inputtext)));
SendFactionMessage(PlayerInfo[playerid][pMember], COLOR_LIGHTBLUE, string);
}
case 1: {
if(PlayerInfo[playerid][pMats] < strval(inputtext) || strval(inputtext) <= 0) return SendClientMessage(playerid, COLOR_WHITE, "* Suma invalida!");
SafeInfo[SeifID[playerid]][sMaterials] += strval(inputtext);
PlayerInfo[playerid][pMats] -= strval(inputtext);
format(string, sizeof(string), "* %s a depozitat %s materiale in seiful factiunii.", GetName(playerid), FormatNumber(strval(inputtext)));
SendFactionMessage(PlayerInfo[playerid][pMember], COLOR_LIGHTBLUE, string);
UpdateVar(playerid, "Materials", PlayerInfo[playerid][pMats]);
}
case 2: {
if(PlayerInfo[playerid][pDrugs] < strval(inputtext) || strval(inputtext) <= 0) return SendClientMessage(playerid, COLOR_WHITE, "* Suma invalida!");
SafeInfo[SeifID[playerid]][sDrugs] += strval(inputtext);
PlayerInfo[playerid][pDrugs] -= strval(inputtext);
UpdateVar(playerid, "Drugs", PlayerInfo[playerid][pDrugs]);
format(string, sizeof(string), "* %s a depozitat %s droguri in seiful factiunii.", GetName(playerid), FormatNumber(strval(inputtext)));
SendFactionMessage(PlayerInfo[playerid][pMember], COLOR_LIGHTBLUE, string);
}
}
SaveSeif(SeifID[playerid]);
}
Functia care salveaza:
stock SaveSeif(const id) {
new szQuery[2048];
format(szQuery, sizeof(szQuery), "UPDATE seif SET `sMoney` = '%d', `sDrugs` = '%d', `sMaterials` = '%d' WHERE `sID` = '%d'",
SafeInfo[id][sMoney], SafeInfo[id][sDrugs], SafeInfo[id][sMaterials], id);
mysql_tquery(SQL, szQuery, "", "");
return 1;
}