Jump to content
  • 0

Mysql Cargo System LS:RP


valelele

Question

Salut, am dezvoltat un sistem de la 0 pe Mysql ca pe LS:RP, gen te duci undeva la un tip(food, fruits, meat, etc) dai /cargo buy iti pune o lada in mana cu un SetPlayerSpecialAction de carry si acest cargo il poti pune in masina si sa il transporti spre alt factory unde il vinzi mai scump dar la acelasi tip.

Faza este ca eu am o problema, am incat din db 2 id-uri, fruits si meat, pe care le vei vedea in poza de mai jos, daca cumpar fruits si le bag in masina la check imi apare ID-ul 2 din database nu 1 ce am cumparat eu si tot odata apare numele 'meat' nu 'fruits' ce am comandat eu. La meat, daca arunc cutia pe jos, la createdynamic3dtextlabel apare 'fruits' acum invers adica? Iar la o comanda gen, dau pe al doilea case 2 si imi returneaza primu iar daca dau pe primu nu merge. ITi las cateva poze, mersi mult.

 

SERVERLOG:

[18:33:50] Cargo 1 a fost incarcat! (Name: fruits cu tipul 1)
[18:33:50] Cargo 2 a fost incarcat! (Name: meat cu tipul 2)

 

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
Acum 18 ore, valelele a spus:

Salut, am dezvoltat un sistem de la 0 pe Mysql ca pe LS:RP, gen te duci undeva la un tip(food, fruits, meat, etc) dai /cargo buy iti pune o lada in mana cu un SetPlayerSpecialAction de carry si acest cargo il poti pune in masina si sa il transporti spre alt factory unde il vinzi mai scump dar la acelasi tip.

Faza este ca eu am o problema, am incat din db 2 id-uri, fruits si meat, pe care le vei vedea in poza de mai jos, daca cumpar fruits si le bag in masina la check imi apare ID-ul 2 din database nu 1 ce am cumparat eu si tot odata apare numele 'meat' nu 'fruits' ce am comandat eu. La meat, daca arunc cutia pe jos, la createdynamic3dtextlabel apare 'fruits' acum invers adica? Iar la o comanda gen, dau pe al doilea case 2 si imi returneaza primu iar daca dau pe primu nu merge. ITi las cateva poze, mersi mult.

 

SERVERLOG:


[18:33:50] Cargo 1 a fost incarcat! (Name: fruits cu tipul 1)
[18:33:50] Cargo 2 a fost incarcat! (Name: meat cu tipul 2)

 

 

Poate pui codu sursa daca vrei sa fii ajutat.

Link to comment
Share on other sites

  • 0
stock LoadCargos()
{
	new query[256];
	for(new i = 1; i < MAX_CARGO; i++)
	{
		format(query, sizeof(query), "SELECT * FROM cargos WHERE ID=%d", i);
		mysql_function_query(handlesql, query, true, "LoadCargo", "d", i);
	}

	printf("LOADING CARGO...");
	return 1;
}
forward LoadCargo(id);
public LoadCargo(id)
{
    new fields, rows;
    cache_get_data(rows, fields);
    if(rows)
    {
		new fetch[512];
    	cache_get_field_content(0, "ID", fetch);
		CargoInfo[id][ID]= strval(fetch);
		
		cache_get_field_content(0, "Xo", fetch);
		CargoInfo[id][Xo] = floatstr(fetch);
		
		cache_get_field_content(0, "Yo", fetch);
		CargoInfo[id][Yo] = floatstr(fetch);
		
		cache_get_field_content(0, "Zo", fetch);
		CargoInfo[id][Zo] = floatstr(fetch);
		
		cache_get_field_content(0, "Products", fetch);
		CargoInfo[id][Products] = strval(fetch);
		
		cache_get_field_content(0, "MaxProducts", fetch);
		CargoInfo[id][MaxProducts] = strval(fetch);
		
		cache_get_field_content(0, "Name", fetch);
		format(CargoInfo[id][Name], 128, fetch);
		
		cache_get_field_content(0, "Type", fetch);
		CargoInfo[id][Type] = strval(fetch);
		
		cache_get_field_content(0, "Price", fetch);
		CargoInfo[id][Bank] = strval(fetch);
		
		cache_get_field_content(0, "Tpdaname", fetch);
		format(CargoInfo[id][Tpda], 128, fetch);
		
		cache_get_field_content(0, "Tpdaprimary", fetch);
		format(CargoInfo[id][Tpdaprimary], 128, fetch);
		
		cache_get_field_content(0, "Open", fetch);
		CargoInfo[id][Open] = strval(fetch);
  		
		CargoInfo[id][Icon] = CreateDynamicPickup(1318, 1, CargoInfo[id][Xo], CargoInfo[id][Yo], CargoInfo[id][Zo], -1, -1, -1, 50);

		new msg[1024];

		format(msg, sizeof(msg), "[{E5FF00}%s{FFFFFF}]\n{FFFFFF}Storage: %d / %d\n{FFFFFF}Price: $%d / unit",CargoInfo[id][Name], CargoInfo[id][Products], CargoInfo[id][MaxProducts], CargoInfo[id][Bank]);

		CargoInfo[id][Text] = CreateDynamic3DTextLabel(msg, COLOR_WHITE, CargoInfo[id][Xo], CargoInfo[id][Yo], CargoInfo[id][Zo] + 0.7, 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1);
		
		Iter_Add(CargoIterator, id);

		printf("Cargo %i a fost incarcat! (Name: %s cu tipul %i)", id, CargoInfo[id][Name], CargoInfo[id][Type]);

	}
	return 1;
}

 

Link to comment
Share on other sites

  • 0
stock LoadCargos()
{
	new query[256];
	for(new i = 0; i < MAX_CARGO; i++)
	{
		format(query, sizeof(query), "SELECT * FROM cargos WHERE ID=%d", i);
		mysql_function_query(handlesql, query, true, "LoadCargo", "d", i);
	}

	printf("LOADING CARGO...");
	return 1;
}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.