Jump to content

[DELETED][NEREZOLVAT]Problema Seifuri GM Burned


MariusTC
 Share

Recommended Posts

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;
}

 

Link to comment
Share on other sites

3 hours ago, MariusTC said:

Nu sunt erori, pur si simplu nu functioneaza. Cand folosesc comenzile, nu stiu cum, dar insereaza in baza de date cu o factiune in minus, daca sunt in factiunea nr2, imi baga in seif la nr1 (exemplu)

Verifica la incarcarea seifelor, baza tot si o sa gasesti problema, ceva nu este facut bine sau ai sters ceva factiune?

                                                 07nhsQq.png     waGyJXS.jpg

mgg8BJB.gif

Link to comment
Share on other sites

Factiunile sunt default, cum era cand am luat gm-ul burned. La seifuri tot asa, default.

Iar functia arata cam asa:

function LoadSafes() {
	new Cache: db = mysql_query(SQL, "SELECT * FROM `seif`");
	new x, seifs = 0, string[500], result[180];
 	for (new i, j = cache_get_row_count (); i != j; ++i) {
	    seifs ++;
       	cache_get_field_content(i, "sID", result); 				x = strval(result);
       	cache_get_field_content(i, "sFactionID", result); 		SafeInfo[x][sFactionID] = strval(result);
     	cache_get_field_content(i, "sPosX", result); 			SafeInfo[x][sPosX] = floatstr(result);
      	cache_get_field_content(i, "sPosY", result); 			SafeInfo[x][sPosY] = floatstr(result);
       	cache_get_field_content(i, "sPosZ", result); 			SafeInfo[x][sPosZ] = floatstr(result);
       	cache_get_field_content(i, "sMoney", result); 			SafeInfo[x][sMoney] = strval(result);
       	cache_get_field_content(i, "sDrugs", result); 			SafeInfo[x][sDrugs] = strval(result);
      	cache_get_field_content(i, "sMaterials", result); 		SafeInfo[x][sMaterials] = strval(result);
     	cache_get_field_content(i, "sVirtualID", result); 		SafeInfo[x][sVirtualID] = strval(result);

		AddStaticPickup(1274, 23, SafeInfo[x][sPosX], SafeInfo[x][sPosY], SafeInfo[x][sPosZ], SafeInfo[x][sVirtualID]);
		format(string, sizeof(string), "Seiful factiunii\n%s", FactionName(x));
	    CreateDynamic3DTextLabel(string,0xFFEA0099,SafeInfo[x][sPosX], SafeInfo[x][sPosY], SafeInfo[x][sPosZ], 100, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, SafeInfo[x][sVirtualID], -1, -1, 5.0);
	}
	printf("Safes: %d", seifs);
	cache_delete(db);
	GetFMembers();
	return 1;
}

 

Link to comment
Share on other sites

2 hours ago, MariusTC said:

Factiunile sunt default, cum era cand am luat gm-ul burned. La seifuri tot asa, default.

Iar functia arata cam asa:

function LoadSafes() { new Cache: db = mysql_query(SQL, "SELECT * FROM `seif`"); new x, seifs = 0, string[500], result[180]; for (new i, j = cache_get_row_count (); i != j; ++i) { seifs ++; cache_get_field_content(i, "sID", result); x = strval(result); cache_get_field_content(i, "sFactionID", result); SafeInfo[x][sFactionID] = strval(result); cache_get_field_content(i, "sPosX", result); SafeInfo[x][sPosX] = floatstr(result); cache_get_field_content(i, "sPosY", result); SafeInfo[x][sPosY] = floatstr(result); cache_get_field_content(i, "sPosZ", result); SafeInfo[x][sPosZ] = floatstr(result); cache_get_field_content(i, "sMoney", result); SafeInfo[x][sMoney] = strval(result); cache_get_field_content(i, "sDrugs", result); SafeInfo[x][sDrugs] = strval(result); cache_get_field_content(i, "sMaterials", result); SafeInfo[x][sMaterials] = strval(result); cache_get_field_content(i, "sVirtualID", result); SafeInfo[x][sVirtualID] = strval(result); AddStaticPickup(1274, 23, SafeInfo[x][sPosX], SafeInfo[x][sPosY], SafeInfo[x][sPosZ], SafeInfo[x][sVirtualID]); format(string, sizeof(string), "Seiful factiunii\n%s", FactionName(x)); CreateDynamic3DTextLabel(string,0xFFEA0099,SafeInfo[x][sPosX], SafeInfo[x][sPosY], SafeInfo[x][sPosZ], 100, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, SafeInfo[x][sVirtualID], -1, -1, 5.0); } printf("Safes: %d", seifs); cache_delete(db); GetFMembers(); return 1; }


function LoadSafes() {
	new Cache: db = mysql_query(SQL, "SELECT * FROM `seif`");
	new x, seifs = 0, string[500], result[180];
 	for (new i, j = cache_get_row_count (); i != j; ++i) {
	    seifs ++;
       	cache_get_field_content(i, "sID", result); 				x = strval(result);
       	cache_get_field_content(i, "sFactionID", result); 		SafeInfo[x][sFactionID] = strval(result);
     	cache_get_field_content(i, "sPosX", result); 			SafeInfo[x][sPosX] = floatstr(result);
      	cache_get_field_content(i, "sPosY", result); 			SafeInfo[x][sPosY] = floatstr(result);
       	cache_get_field_content(i, "sPosZ", result); 			SafeInfo[x][sPosZ] = floatstr(result);
       	cache_get_field_content(i, "sMoney", result); 			SafeInfo[x][sMoney] = strval(result);
       	cache_get_field_content(i, "sDrugs", result); 			SafeInfo[x][sDrugs] = strval(result);
      	cache_get_field_content(i, "sMaterials", result); 		SafeInfo[x][sMaterials] = strval(result);
     	cache_get_field_content(i, "sVirtualID", result); 		SafeInfo[x][sVirtualID] = strval(result);

		AddStaticPickup(1274, 23, SafeInfo[x][sPosX], SafeInfo[x][sPosY], SafeInfo[x][sPosZ], SafeInfo[x][sVirtualID]);
		format(string, sizeof(string), "Seiful factiunii\n%s", FactionName(x));
	    CreateDynamic3DTextLabel(string,0xFFEA0099,SafeInfo[x][sPosX], SafeInfo[x][sPosY], SafeInfo[x][sPosZ], 100, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, SafeInfo[x][sVirtualID], -1, -1, 5.0);
	}
	printf("Safes: %d", seifs);
	cache_delete(db);
	GetFMembers();
	return 1;
}

 

verifica si functia, ai de facut multe verificari, ceva nu citeste corect sau chiar lipseste din baza

                                                 07nhsQq.png     waGyJXS.jpg

mgg8BJB.gif

Link to comment
Share on other sites

Din baza de date le ia bine, cand se incarca le arata in server.cfg si le arata bine.

[17:21:00] Safes: 13

Asa ar merge sa fac la comenzi sa le bage mereu SaveSeif(i-1); si am rezolvat treaba dar nu vreau, vreau sa stiu exact care e problema.

Alte pareri?

 

Link to comment
Share on other sites

On 6/11/2021 at 6:51 PM, iTECH said:

Salut, ai rezolvat problema? 

Cod-ul este ok, problema este din database, curata tabel-ul sau sterge-l si fa altul.

Noroc,nu am rezolvat.

Am pus chiar si baza de date default de la burned, fara niciun fel de modificare si tot asa.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...