Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===========//
- enum E_VEHICLES
- {
- vSQL,
- vID,
- vModel,
- vColor1,
- vColor2,
- Float:vPosX,
- Float:vPosY,
- Float:vPosZ,
- Float:vPosA,
- bool:vExist,
- };
- new vInfo[MAX_VEHICLES][E_VEHICLES];
- modeinit:
- mysql_tquery(mysql, "SELECT * FROM vehicles", "Load_Vehicles", ""); //VEHICLES
- //---------------------------------------------------------------------------------------------//
- public Load_Vehicles() //Chargement des véhicules
- {
- new rows, fields, string[256];
- cache_get_data(rows, fields);
- print(" ");
- print("|__________ CHARGEMENT DES VEHICULES __________|");
- if(cache_num_rows() > 0)
- {
- //for(new i; i < rows; i++)
- for(new i = 1; i < rows; i++)
- {
- vInfo[i][vSQL] = cache_get_field_content_int(i, "id");
- vInfo[i][vModel] = cache_get_field_content_int(i, "model");
- vInfo[i][vColor1] = cache_get_field_content_int(i, "color1");
- vInfo[i][vColor2] = cache_get_field_content_int(i, "color2");
- vInfo[i][vPosX] = cache_get_field_content_float(i, "x");
- vInfo[i][vPosY] = cache_get_field_content_float(i, "y");
- vInfo[i][vPosZ] = cache_get_field_content_float(i, "z");
- vInfo[i][vPosA] = cache_get_field_content_float(i, "a");
- vInfo[i][vID] = CreateVehicle(vInfo[i][vModel], vInfo[i][vPosX], vInfo[i][vPosY], vInfo[i][vPosZ], vInfo[i][vPosA], vInfo[i][vColor1], vInfo[i][vColor2], -1, 0);
- SetVehicleVirtualWorld(i, 0);
- vInfo[i][vExist] = true;
- printf("VEHICLE SQL %d", vInfo[i][vSQL]);
- }
- }
- print(" ");
- printf("%d véhicules trouvés dans la database", rows);
- print("|______________________________________________|");
- print(" ");
- print(" ");
- return true;
- }
- //---------------------------------------------------------------------------------------------//
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- new string[256];
- for(new i; i < MAX_VEHICLES; i++)
- {
- if(!vInfo[i][vExist]) continue;
- if(vehicleid == vInfo[i][vID])
- {
- format(string, sizeof(string), "Vous entrez dans le véhicule %d", vInfo[i][vSQL]);
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "Modèle: %d - Couleur1: %d - Couleur2: %d", vInfo[i][vModel], vInfo[i][vColor1], vInfo[i][vColor2]);
- SendClientMessage(playerid, -1, string);
- break;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement