Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum vInfo
- {
- vPrixLOC,
- vSQL,
- vModel,
- vJob,
- vOwner,
- vEtat,
- vRent,
- vSorti,
- vColor1,
- vColor2,
- vEngine,
- vAttEngine,
- Float:vGas,
- Float:vHealCar,
- Float:vKms,
- vKey1,
- vKey2,
- vNumberPlate[6],
- vCharge,
- Traceur,
- vAutoRadio,
- vAutoRadioLink[144],
- vLock,
- vCapot,
- vLights,
- vCoffreLock,
- vCoffreObj[12],
- vCoffreInfo[12],
- vCoffreSerie[12],
- vCoffreIdentif[12],
- vCoffreCaisseObj[18],
- vCoffreCaisseType[18],
- vCoffreCaisseVisibleVar[4],
- vCoffreCaisseVisible[4],
- Float:vPos[3],
- vAlarm,
- vDesc[96],
- vAlarmState,
- Kit[35],
- vCarbu,
- gCanna,
- gStero,
- gCoke,
- gMeth,
- gHero,
- Fire[2],
- Mod[10],
- Helico[2]
- };
- static VehicleInfo[MAX_VEHICLES][vInfo];
- ///////////////////////////////////////////////////////
- else if(strcmp(tmp, "acheter", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, -1, "USAGE: {AFAFAF}/v acheter [ID/NomDuVehicule] [IDcouleur1] [IDcouleur2]");
- return SendClientMessage(playerid, COLOR_USAGE, "Les ID de couleurs sont renseignées en écrivant \"/v couleurs\". Faîtes attention lors de la saisie.");
- }
- if(PlayerInfo[playerid][pLevel] < 2)
- return SendClientMessage(playerid, COLOR_RED, "Vous devez être Level 2 pour acheter un véhicule.");
- new model = ReturnVehicleModel(tmp);
- if(model < 400 || model > 611) return SendClientMessage(playerid, COLOR_RED, "Ce nom de véhicule est inconnu.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, -1, "USAGE: {AFAFAF}/v acheter [ID/NomDuVehicule] [IDcouleur1] [IDcouleur2]");
- return SendClientMessage(playerid, COLOR_USAGE, "Les ID de couleurs sont renseignées en écrivant \"/v couleurs\". Faîtes attention lors de la saisie.");
- }
- new color1 = strval(tmp);
- if(!IsValidVehicleColor(color1)) return SendClientMessage(playerid, COLOR_RED, "Couleur1 invalide !");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, -1, "USAGE: {AFAFAF}/v acheter [ID/NomDuVehicule] [IDcouleur1] [IDcouleur2]");
- return SendClientMessage(playerid, COLOR_USAGE, "Les ID de couleurs sont renseignées en écrivant \"/v couleurs\". Faîtes attention lors de la saisie.");
- }
- new color2 = strval(tmp);
- if(!IsValidVehicleColor(color2)) return SendClientMessage(playerid, COLOR_RED, "Couleur2 invalide !");
- if(VehicleParams[model-400][PRIX] == 0)
- {
- return SendClientMessage(playerid, COLOR_RED, "Ce modèle de véhicule n'est pas en vente.");
- }
- if(VehicleParams[model-400][PLANE] == 1)
- {
- if(!IsPlayerInRangeOfPoint(playerid, 3.0, 1956.7676, -2183.7097, 13.5469))
- return SendClientMessage(playerid, COLOR_RED, "Vous n'êtes pas au concessionnaire des avions.");
- }
- else
- {
- if(VehicleParams[model-400][BOAT] == 1)
- {
- if(!IsPlayerInRangeOfPoint(playerid, 3.0, 154.0953, -1942.1666, 3.7734))
- return SendClientMessage(playerid, COLOR_RED, "Vous n'êtes pas au concessionnaire des bateaux.");
- }
- else
- {
- if(!IsPlayerInRangeOfPoint(playerid, 3.0, 2132.0017, -1148.8852, 24.3299))
- return SendClientMessage(playerid, COLOR_RED, "Vous n'êtes pas au concessionnaire des voitures classiques.");
- }
- }
- if(VehicleParams[model-400][DONATOR] > gDonator[playerid])
- {
- if(gettime() > gDonator[playerid])
- {
- return SendClientMessage(playerid, COLOR_RED, "Vous n'êtes pas/plus donator.");
- }
- }
- for(new v = 0; v < MAX_VEHICLES; v++)
- {
- if(VehicleInfo[v][vOwner] == PlayerInfo[playerid][pSQL])
- {
- format(string, sizeof(string), "Vous avez déjà un véhicule spawn (%s).", VehicleParams[VehicleInfo[v][vModel]-400][NAME]);
- SendClientMessage(playerid, COLOR_RED, string);
- return 1;
- }
- }
- new prix = 0;
- prix = VehicleParams[model-400][PRIX];
- if(PlayerInfo[playerid][pBank] < prix)
- {
- format(string, sizeof(string), "Vous n'avez pas assez d'argent dans votre compte en banque (%s $%d).", VehicleParams[model-400][NAME], VehicleParams[model-400][PRIX]);
- SendClientMessage(playerid, COLOR_RED, string);
- return 1;
- }
- new playersql = PlayerInfo[playerid][pSQL];
- format(query,sizeof(query),"SELECT Count(*) FROM `vehicles` WHERE Owner=%d", playersql);
- mysql_tquery(g_Handle, query, "OnPlayerDataVeh", "iiiiii", color1, color2, prix, playerid, playersql, model); // ->>>>>>>>>>>> NICKEL
- return 1;
- }
- /////////////////////////////////////////////////////////////////////////////////
- forward OnPlayerDataVeh(color1, color2, prix, playerid, playersql, model);
- public OnPlayerDataVeh(color1, color2, prix, playerid, playersql, model)
- {
- new rows,
- fields,
- string[256];
- cache_get_data(rows, fields);
- if(rows)
- {
- new count;
- for(new iSlot, count_nb = cache_get_row_count(); iSlot < count_nb; iSlot++)
- {
- count++;
- }
- if(count >= 3)
- {
- return SendClientMessage(playerid, COLOR_RED, "Vous possédez déjà 3 véhicules (maximum).");
- }
- new Float: pos[4];
- if(VehicleParams[model-400][PLANE] == 1)
- {
- pos[0] = 1997.5248;
- pos[1] = -2194.9395;
- pos[2] = 13.5469;
- pos[3] = 173.1066;
- }
- else
- {
- if(VehicleParams[model-400][BOAT] == 1)
- {
- pos[0] = 113.6482;
- pos[1] = -1952.5614;
- pos[2] = 0.5938;
- pos[3] = 286.6111;
- }
- else
- {
- new rand = random(8);
- if(rand == 0) { pos[0] = 2118.1189; pos[1] = -1152.4578; pos[2] = 23.9104; pos[3] = 353.1512; }
- else if(rand == 1) { pos[0] = 2134.0391; pos[1] = -1132.2255; pos[2] = 25.3829; pos[3] = 90.7573; }
- else if(rand == 1) { pos[0] = 2134.2456; pos[1] = -1127.2827; pos[2] = 25.2597; pos[3] = 88.0522; }
- else if(rand == 1) { pos[0] = 2120.3618; pos[1] = -1135.0988; pos[2] = 25.0031; pos[3] = 265.2511; }
- else if(rand == 1) { pos[0] = 2149.2908; pos[1] = -1138.5972; pos[2] = 25.1861; pos[3] = 269.5748; }
- else if(rand == 1) { pos[0] = 2161.1362; pos[1] = -1143.5836; pos[2] = 24.5667; pos[3] = 91.2258; }
- else if(rand == 1) { pos[0] = 2148.9314; pos[1] = -1143.2675; pos[2] = 24.6718; pos[3] = 268.5374; }
- else if(rand == 1) { pos[0] = 2161.0310; pos[1] = -1148.3916; pos[2] = 24.0763; pos[3] = 88.5537; }
- else if(rand == 1) { pos[0] = 2148.8545; pos[1] = -1152.7941; pos[2] = 23.6491; pos[3] = 269.8862; }
- else { pos[0] = 2160.7129; pos[1] = -1157.8556; pos[2] = 23.5452; pos[3] = 90.3864; }
- }
- }
- new nbplate[6];
- nbplate = VehiclePlate();
- new Float:gas = VehicleParams[model-400][RESERVOIR]/2;
- mysql_format(g_Handle, string,sizeof(string),"INSERT INTO `vehicles` (Model, Job, Owner, PosX, PosY, PosZ, Rot, Color1, Color2, Gas, HealCar, Key1, Key2, NumberPlate) VALUES (%d, %d, %d, '%0.4f', '%0.4f', '%0.4f', '%0.4f', %d, %d, %0.4f, %0.2f, %d, %d, '%e')",
- model, 0, playersql, pos[0], pos[1], pos[2], pos[3], color1, color2, gas, 1000.0, playersql, playersql, nbplate);
- mysql_tquery(g_Handle, string, "OnPlayerDataVeh1", "siiiiifff", nbplate, color1, color2, model, playerid, prix, pos[0], pos[1], pos[2]);
- }
- return 1;
- }
- //////////////////////////////////////////////////////////
- forward OnPlayerDataVeh1(nbplate[], color1, color2, model, playerid, prix, Float:xx, Float:yy, Float:zz);
- public OnPlayerDataVeh1(nbplate[], color1, color2, model, playerid, prix, Float:xx, Float:yy, Float:zz)
- {
- new string[144];
- format(string, sizeof(string), "SELECT * FROM `vehicles` WHERE VEHid = %d", cache_insert_id());
- mysql_tquery(g_Handle, string, "DataLoadVeh", "iii", cache_insert_id(), playerid, 2); // ->>>>>>>>>>>> NICKEL
- PlayerInfo[playerid][pBank] -= prix;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement