Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public SauvMaisons(playerid)
- {
- new idx = 1;
- while(idx < sizeof(InfoMaison))
- {
- new nom[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `xEntree`='%f'", idx, InfoMaison[idx][xEntree]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `yEntree`='%f'", idx, InfoMaison[idx][yEntree]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `zEntree`='%f'", idx, InfoMaison[idx][zEntree]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `xSortie`='%f'", idx, InfoMaison[idx][xSortie]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `ySortie`='%f'", idx, InfoMaison[idx][ySortie]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `zSortie`='%f'", idx, InfoMaison[idx][zSortie]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `location`='%d'", idx, InfoMaison[idx][mLocation]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `prix_location`='%d'", idx, InfoMaison[idx][mPrixLocation]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `nombre_locataires`='%d'", idx, InfoMaison[idx][mNombreLocataires]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `coffre_pos`='%d'", idx, InfoMaison[idx][mCoffrePos]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `sante_pos`='%d'", idx, InfoMaison[idx][mSantePos]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `armure_pos`='%d'", idx, InfoMaison[idx][mArmurePos]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `defaultd`='%s'", idx, InfoMaison[idx][mDefaultd]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `prix`='%d'", idx, InfoMaison[idx][mPrix]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `phrase`='%s'", idx, InfoMaison[idx][mPhrase]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `portes`='%d'", idx, InfoMaison[idx][mPortes]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Maisons` WHERE `id`='%d' SET `type`='%d'", idx, InfoMaison[idx][mType]);
- mysql_query(query);
- // printf("Maison %d sauvegardée", idx);
- idx++;
- }
- if(idx == sizeof(InfoMaison))
- {
- print("Toutes les maisons ont été sauvegardées !");
- }
- return 1;
- }
- public SauvCoffres()
- {
- new idx = 1;
- while(idx < sizeof(InfoCoffre))
- {
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `ameliod`='%d'", idx, InfoCoffre[idx][cAmeliod]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `ameliom`='%d'", idx, InfoCoffre[idx][cAmeliom]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `amelioa`='%d'", idx, InfoCoffre[idx][cAmelioa]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `amelioar`='%d'", idx, InfoCoffre[idx][cAmelioar]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `pass`='%s'", idx, InfoCoffre[idx][cPass]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `drogues`='%d'", idx, InfoCoffre[idx][cDrogues]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `matos`='%d'", idx, InfoCoffre[idx][cMatos]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `arme1`='%d'", idx, InfoCoffre[idx][cArme1]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `arme1m`='%d'", idx, InfoCoffre[idx][cArme1m]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `arme2`='%d'", idx, InfoCoffre[idx][cArme2]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `arme2m`='%d'", idx, InfoCoffre[idx][cArme2m]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `arme3`='%d'", idx, InfoCoffre[idx][cArme3]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `arme3m`='%d'", idx, InfoCoffre[idx][cArme3m]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `arme4`='%d'", idx, InfoCoffre[idx][cArme4]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `arme4m`='%d'", idx, InfoCoffre[idx][cArme4m]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `argent`='%d'", idx, InfoCoffre[idx][cArgent]);
- mysql_query(query);
- format(query, 1024, "UPDATE `Coffres` WHERE `id`='%d' SET `ouvert`='%d'", idx, InfoCoffre[idx][cOuvert]);
- mysql_query(query);
- // printf("Coffre %d sauvegardé !", idx);
- idx++;
- }
- if(idx == sizeof(InfoCoffre))
- {
- print("Tous les coffres de maison ont été sauvegardés !");
- }
- return 1;
- }
- public ChargerMaisons()
- {
- new idx = 1;
- while(idx < sizeof(InfoMaison))
- {
- new txe[50], tye[50], tze[50], txs[50], tys[50], tzs[50], tloc[50], tprix_loc[50], tnombre_loc[50];
- new tcoffrep[50], tsantep[50], tarmurep[50], tprix[50], tportes[50], ttype[50];
- new propname[MAX_PLAYER_NAME+1], phrase[1024], defaultd[256];
- #pragma unused txe, tyz, tze, txs, tys, tzs, tloc, tprix_loc, tnombre_loc
- #pragma unused tcoffrep, tsantep, tarmurep, tprix, tportes, ttype
- mysql_query("SELECT * FROM `Maisons`");
- mysql_store_result();
- while(mysql_retrieve_row())
- {
- InfoMaison[idx][mID] = idx;
- mysql_get_field("proprio", propname);
- mysql_get_field("phrase", phrase);
- mysql_get_field("defaultd", defaultd);
- mysql_get_field("xEntree", txe);
- mysql_get_field("yEntree", tye);
- mysql_get_field("zEntree", tze);
- mysql_get_field("xSortie", txs);
- mysql_get_field("ySortie", tys);
- mysql_get_field("zSortie", tzs);
- mysql_get_field("location", tloc);
- mysql_get_field("prix_location", tprix_loc);
- mysql_get_field("nombre_locataires", tnombre_loc);
- mysql_get_field("coffre_pos", tcoffrep);
- mysql_get_field("sante_pos", tsantep);
- mysql_get_field("armure_pos", tarmurep);
- mysql_get_field("prix", tprix);
- mysql_get_field("portes", tportes);
- mysql_get_field("type", ttype);
- InfoMaison[idx][mProprio] = propname;
- InfoMaison[idx][xEntree] = floatstr(txe);
- InfoMaison[idx][yEntree] = floatstr(tye);
- InfoMaison[idx][zEntree] = floatstr(tze);
- InfoMaison[idx][xSortie] = floatstr(txs);
- InfoMaison[idx][ySortie] = floatstr(tys);
- InfoMaison[idx][zSortie] = floatstr(tzs);
- InfoMaison[idx][mLocation] = strval(tloc);
- InfoMaison[idx][mPrixLocation] = strval(tprix_loc);
- InfoMaison[idx][mNombreLocataires] = strval(tnombre_loc);
- InfoMaison[idx][mCoffrePos] = strval(tcoffrep);
- InfoMaison[idx][mSantePos] = strval(tsantep);
- InfoMaison[idx][mArmurePos] = strval(tarmurep);
- InfoMaison[idx][mPrix] = strval(tprix);
- InfoMaison[idx][mPortes] = strval(tportes);
- InfoMaison[idx][mType] = strval(ttype);
- // Spawn
- InfoMaison[idx][mPickup] = CreateDynamicPickup(1273, 2, InfoMaison[idx][xEntree], InfoMaison[idx][yEntree], InfoMaison[idx][zEntree]);
- if(strcmp(propname, MAISON_DEFAULTP, false) == 0)
- {
- format(InfoMaison[idx][mPhrase], 1024, "%s.\nA vendre\n%d$", defaultd, InfoMaison[idx][mPrix]);
- }
- else
- {
- if(InfoMaison[idx][mLocation] != 1)
- {
- format(InfoMaison[idx][mPhrase], 1024, "%s.\nAppartient à %s.", defaultd, propname);
- }
- else
- {
- format(InfoMaison[idx][mPhrase], 1024, "%s.\nppartient à %s.\nLouable\nLoyer : %d$", defaultd, propname, InfoMaison[idx][mPrixLocation]);
- }
- }
- InfoMaison[idx][mDesc] = CreateDynamic3DTextLabel(InfoMaison[idx][mPhrase], 0x07BB00FF, InfoMaison[idx][xEntree], InfoMaison[idx][yEntree], InfoMaison[idx][zEntree]+2.0, 20.0);
- printf("Maison %d chargée !", idx);
- idx++;
- }
- mysql_free_result();
- }
- return 1;
- }
- public ChargerCoffres()
- {
- new idx = 1;
- while(idx < sizeof(InfoCoffre))
- {
- mysql_query("SELECT * FROM `Coffres`");
- mysql_store_result();
- while(mysql_retrieve_row())
- {
- new ameliod[50], ameliom[50], amelioa[50], amelioar[50], pass[36], drogues[50], matos[50];
- new arme1[50], arme1m[50], arme2[50], arme2m[50], arme3[50], arme3m[50], arme4[50], arme4m[50], argent[50], ouvert[50];
- InfoCoffre[idx][cID] = idx;
- mysql_get_field("ameliod", ameliod);
- mysql_get_field("ameliom", ameliom);
- mysql_get_field("amelioa", amelioa);
- mysql_get_field("amelioar", amelioar);
- mysql_get_field("pass", pass);
- mysql_get_field("drogues", drogues);
- mysql_get_field("matos", matos);
- mysql_get_field("argent", argent);
- mysql_get_field("ouvert", ouvert);
- mysql_get_field("arme1", arme1);
- mysql_get_field("arme1m", arme1m);
- mysql_get_field("arme2", arme2);
- mysql_get_field("arme2m", arme2m);
- mysql_get_field("arme3", arme3);
- mysql_get_field("arme3m", arme3m);
- mysql_get_field("arme4", arme4);
- mysql_get_field("arme4m", arme4m);
- InfoCoffre[idx][cAmeliod] = strval(ameliod);
- Infocoffre[idx][cAmeliom] = strval(ameliom);
- InfoCoffre[idx][cAmelioa] = strval(amelioa);
- InfoCoffre[idx][cAmelioar] = strval(amelioar);
- InfoCoffre[idx][cPass] = pass;
- InfoCoffre[idx][cDrogues] = strval(drogues);
- InfoCoffre[idx][cMatos] = strval(matos);
- InfoCoffre[idx][cArgent] = strval(argent);
- InfoCoffre[idx][cOuvert] = strval(ouvert);
- InfoCoffre[idx][cArme1] = strval(arme1);
- InfoCoffre[idx][cArme1m] = strval(arme1m);
- InfoCoffre[idx][cArme2] = strval(arme2);
- InfoCoffre[idx][cArme2m] = strval(arme2m);
- InfoCoffre[idx][cArme3] = strval(arme3);
- InfoCoffre[idx][cArme4] = strval(arme4);
- InfoCoffre[idx][cArme3m] = strval(arme3m);
- InfoCoffre[idx][cArme4m] = strval(arme4m);
- printf("Coffre %d chargé !", idx);
- idx++;
- }
- mysql_free_result();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement