So, I found these lines, I don't know...
Код:
stock RegisterVehicle(ownerid,vehicleid,pre_plate[],vpricex)
{
new Float:x, Float:y, Float:z, Float:angle, plate[128],modelid,sql[128], line[1024], result[1024];
//[RACCOLTA DATI]
GetVehiclePos(vehicleid, x, y, z);
GetVehicleZAngle(vehicleid, angle);
modelid=GetVehicleModel(vehicleid);
GetPlayerName(ownerid, pname, sizeof (pname));
strmid(vehicleVariables[vehicleid][vOwner], pname, 0, strlen(pname), MAX_PLAYER_NAME);
vehicleVariables[vehicleid][vOwned] = 1;
vehicleVariables[vehicleid][visvalid] = 1;
format(plate,sizeof(plate),"%s%d",pre_plate,random(99999-10000));
strmid(vehicleVariables[vehicleid][vPlate], plate, 0, strlen(pname), 255);
vehicleVariables[vehicleid][vVehicleModelID] = modelid;
vehicleVariables[vehicleid][vVehiclePosition][0] = x;
vehicleVariables[vehicleid][vVehiclePosition][1] = y;
vehicleVariables[vehicleid][vVehiclePosition][2] = z;
vehicleVariables[vehicleid][vFuel]=100;
ChangeVehiclePaintjob(vehicleVariables[va][vVehicleScriptID], 24);
vehicleVariables[vehicleid][vCurrentX] = x;
vehicleVariables[vehicleid][vCurrentY] = y;
vehicleVariables[vehicleid][vCurrentZ] = z;
vehicleVariables[vehicleid][vVehicleRotation] = angle;
vehicleVariables[vehicleid][vSpawned] = 1;
for(new m = 0; m < MAX_MODS; m++)
{
vehicleVariables[vehicleid][vMod][m] = 0;
}
vehicleVariables[vehicleid][vVehicleScriptID] = vehicleid;
SetVehicleNumberPlate(vehicleid,vehicleVariables[vehicleid][vPlate]);
//[PRINTAGGIO DATI]
format(stringsize, sizeof(stringsize), "INSERT INTO playervehicles (vOwner,vModel,vColor1,vColor2,vPlate) VALUES ('%s','%d','%d','%d','%s')", pname, modelid,vehicleVariables[vehicleid][vVehicleColour][0],vehicleVariables[vehicleid][vVehicleColour][1], vehicleVariables[vehicleid][vPlate]);
mysql_query(stringsize);
format(sql, sizeof(sql), "SELECT * FROM playervehicles WHERE vPlate = '%s'", vehicleVariables[vehicleid][vPlate]);
mysql_query(sql);
mysql_store_result();
mysql_fetch_row(line);
mysql_get_field("ID", result);
vehicleVariables[vehicleid][Id] = strval(result);
mysql_free_result();
printf("Owner: %s, ID %d, Plate: %d, Price: %d",vehicleVariables[vehicleid][vOwner], vehicleVariables[vehicleid][Id], vehicleVariables[vehicleid][vPlate], vpricex);
SavePlayerVehicle(vehicleid);
SetVehicleToRespawn(vehicleid);
return 1;
}
Код:
stock initiatePVehicleSpawns(playerid) {
new sql[164],result[224], line[924];
GetPlayerName(playerid, pname, sizeof (pname));
format(sql, sizeof(sql), "SELECT * FROM playervehicles WHERE vOwner = '%s'", pname);
mysql_query(sql);
mysql_store_result();
for(new i=0; i<mysql_num_rows(); i++)
{
va = CreateVehicle(520, 0, 0, 0, 82.2873, 0, 1, 60000);
DestroyVehicle(va);
mysql_fetch_row(line);
mysql_get_field("ID", result);
vehicleVariables[va][Id] = strval(result);
mysql_get_field("vOwner", vehicleVariables[va][vOwner]);
mysql_get_field("vModel", result);
vehicleVariables[va][vVehicleModelID] = strval(result);
mysql_get_field("vX", result);
vehicleVariables[va][vVehiclePosition][0] = floatstr(result);
mysql_get_field("vY", result);
vehicleVariables[va][vVehiclePosition][1] = floatstr(result);
mysql_get_field("vZ", result);
vehicleVariables[va][vVehiclePosition][2] = floatstr(result);
mysql_get_field("vA", result);
vehicleVariables[va][vVehicleRotation] = floatstr(result);
mysql_get_field("vColor1", result);
vehicleVariables[va][vVehicleColour][0] = strval(result);
mysql_get_field("vColor2", result);
vehicleVariables[va][vVehicleColour][1] = strval(result);
mysql_get_field("vPaintjob", result);
vehicleVariables[va][vPaintjob] = strval(result);
mysql_get_field("vEngine", result);
vehicleVariables[va][vEngine] = strval(result);
mysql_get_field("vLocked", result);
vehicleVariables[va][vLocked] = strval(result);
mysql_get_field("vPanelsDmg", result);
vehicleVariables[va][vPanelsDmg] = strval(result);
mysql_get_field("vDoorsDmg", result);
vehicleVariables[va][vDoorsDmg] = strval(result);
mysql_get_field("vLightsDmg", result);
vehicleVariables[va][vLightsDmg] = strval(result);
mysql_get_field("vTiresDmg", result);
vehicleVariables[va][vTiresDmg] = strval(result);
mysql_get_field("vHealth", result);
vehicleVariables[va][vHealth] = strval(result);
mysql_get_field("vSpawned", result);
vehicleVariables[va][vSpawned] = strval(result);
mysql_get_field("vCurrentX", result);
vehicleVariables[va][vCurrentX] = strval(result);
mysql_get_field("vCurrentY", result);
vehicleVariables[va][vCurrentY] = strval(result);
mysql_get_field("vCurrentZ", result);
vehicleVariables[va][vCurrentZ] = strval(result);
mysql_get_field("vCurrentA", result);
vehicleVariables[va][vCurrentA] = strval(result);
mysql_get_field("vMod1", result);
vehicleVariables[va][vMod][0] = strval(result);
mysql_get_field("vMod2", result);
vehicleVariables[va][vMod][1] = strval(result);
mysql_get_field("vMod3", result);
vehicleVariables[va][vMod][2] = strval(result);
mysql_get_field("vMod4", result);
vehicleVariables[va][vMod][3] = strval(result);
mysql_get_field("vMod5", result);
vehicleVariables[va][vMod][4] = strval(result);
mysql_get_field("vMod6", result);
vehicleVariables[va][vMod][5] = strval(result);
mysql_get_field("vMod7", result);
vehicleVariables[va][vMod][6] = strval(result);
mysql_get_field("vMod8", result);
vehicleVariables[va][vMod][7] = strval(result);
mysql_get_field("vMod9", result);
vehicleVariables[va][vMod][8] = strval(result);
mysql_get_field("vMod10", result);
vehicleVariables[va][vMod][9] = strval(result);
mysql_get_field("vMod11", result);
vehicleVariables[va][vMod][10] = strval(result);
mysql_get_field("vMod12", result);
vehicleVariables[va][vMod][11] = strval(result);
mysql_get_field("vMod13", result);
vehicleVariables[va][vMod][12] = strval(result);
mysql_get_field("vMod14", result);
vehicleVariables[va][vMod][13] = strval(result);
mysql_get_field("vTrunkDrug", result);
vehicleVariables[va][vTrunkDrug] = strval(result);
mysql_get_field("vTrunkMats", result);
vehicleVariables[va][vTrunkMats] = strval(result);
mysql_get_field("vTrunkArmour", result);
vehicleVariables[va][vTrunkArmour] = strval(result);
mysql_get_field("vTrunkWep1", result);
vehicleVariables[va][vTrunkWep][0] = strval(result);
mysql_get_field("vTrunkAmmo1", result);
vehicleVariables[va][vTrunkAmmo][0] = strval(result);
mysql_get_field("vTrunkWep2", result);
vehicleVariables[va][vTrunkWep][1] = strval(result);
mysql_get_field("vTrunkAmmo2", result);
vehicleVariables[va][vTrunkAmmo][1] = strval(result);
mysql_get_field("vTrunkWep3", result);
vehicleVariables[va][vTrunkWep][2] = strval(result);
mysql_get_field("vTrunkAmmo3", result);
vehicleVariables[va][vTrunkAmmo][2] = strval(result);
mysql_get_field("vPlate", vehicleVariables[va][vPlate]);
mysql_get_field("vCurrentInt", result);
vehicleVariables[va][vCurrentInt] = strval(result);
mysql_get_field("vFuel", result);
vehicleVariables[va][vFuel] = floatstr(result);
vehicleVariables[va][visvalid] = 1;
CarWindowStatus[va] = 1; //1 = up, 0 = down.
if(vehicleVariables[va][vSpawned] == 0) {
vehicleVariables[va][vVehicleScriptID] = CreateVehicle(vehicleVariables[va][vVehicleModelID],vehicleVariables[va][vVehiclePosition][0], vehicleVariables[va][vVehiclePosition][1], vehicleVariables[va][vVehiclePosition][2], vehicleVariables[va][vVehicleRotation], vehicleVariables[va][vVehicleColour][0], vehicleVariables[va][vVehicleColour][1], 120000);
SetVehicleZAngle(vehicleVariables[va][vVehicleScriptID], vehicleVariables[va][vVehicleRotation]);
vehicleVariables[va][vSpawned] = 1;}
else{
vehicleVariables[va][vVehicleScriptID] = CreateVehicle(vehicleVariables[va][vVehicleModelID],vehicleVariables[va][vCurrentX], vehicleVariables[va][vCurrentY], vehicleVariables[va][vCurrentZ], vehicleVariables[va][vCurrentA], vehicleVariables[va][vVehicleColour][0], vehicleVariables[va][vVehicleColour][1], 120000);
SetVehicleZAngle(vehicleVariables[va][vVehicleScriptID], vehicleVariables[va][vCurrentA]);}
SetVehicleHealth(vehicleVariables[va][vVehicleScriptID],vehicleVariables[va][vHealth]);
ChangeVehiclePaintjob(vehicleVariables[va][vVehicleScriptID], vehicleVariables[va][vPaintjob]);
UpdateVehicleDamageStatus(vehicleVariables[va][vVehicleScriptID],vehicleVariables[va][vPanelsDmg],vehicleVariables[va][vDoorsDmg],vehicleVariables[va][vLightsDmg],vehicleVariables[va][vTiresDmg]);
VehicleLocked[vehicleVariables[va][vVehicleScriptID]]=vehicleVariables[va][vLocked];
SetVehicleNumberPlate(vehicleVariables[va][vVehicleScriptID], vehicleVariables[va][vPlate]);
SetVehicleToRespawn(vehicleVariables[va][vVehicleScriptID]);
for(new m = 0; m < MAX_MODS; m++)
{
if (vehicleVariables[va][vMod][m] > 0)
{
AddVehicleComponent(vehicleVariables[va][vVehicleScriptID],vehicleVariables[va][vMod][m]);
}
}
if(vehicleVariables[va][vEngine]==ENGINE_STARTED){
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(va, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(va, true, lights, alarm, doors, bonnet, boot, objective);}else{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(va, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(va, false, lights, alarm, doors, bonnet, boot, objective);}
vehicleVariables[va][vOwned] = 1;
systemVariables[vehicleCounts][0]++;
}
mysql_free_result();
}
Код:
public OnVehicleSpawn(vehicleid) //will add the right objects for the vehicle, is also customly called on vehicle respawn!
{
new model = GetVehicleModel(vehicleid);
if(vehicleVariables[vehicleVariables[vehicleid][vVehicleScriptID]][vOwned]) {
if(vehicleVariables[vehicleid][vSpawned] == 0){
SetVehiclePos(vehicleVariables[vehicleid][vVehicleScriptID], vehicleVariables[vehicleid][vVehiclePosition][0], vehicleVariables[vehicleid][vVehiclePosition][1], vehicleVariables[vehicleid][vVehiclePosition][2]);
SetVehicleZAngle(vehicleid, vehicleVariables[vehicleid][vVehicleRotation]);
vehicleVariables[vehicleid][vSpawned] = 1;
}else{
SetVehiclePos(vehicleVariables[vehicleid][vVehicleScriptID],vehicleVariables[vehicleid][vCurrentX], vehicleVariables[vehicleid][vCurrentY], vehicleVariables[vehicleid][vCurrentZ]);
SetVehicleZAngle(vehicleVariables[vehicleid][vVehicleScriptID], vehicleVariables[vehicleid][vCurrentA]);
SetVehicleInterior(vehicleid, vehicleVariables[vehicleid][vCurrentInt]);
}
SetVehicleNumberPlate(vehicleVariables[vehicleid][vVehicleScriptID],vehicleVariables[vehicleid][vPlate]);
ChangeVehicleColor(vehicleVariables[vehicleid][vVehicleScriptID], vehicleVariables[vehicleid][vVehicleColour][0],vehicleVariables[vehicleid][vVehicleColour][1]);
ChangeVehiclePaintjob(vehicleVariables[vehicleid][vVehicleScriptID], vehicleVariables[vehicleid][vPaintjob]);
SetVehicleHealth(vehicleVariables[va][vVehicleScriptID],vehicleVariables[va][vHealth]);
UpdateVehicleDamageStatus(vehicleVariables[va][vVehicleScriptID],vehicleVariables[va][vPanelsDmg],vehicleVariables[va][vDoorsDmg],vehicleVariables[va][vLightsDmg],vehicleVariables[va][vTiresDmg]);
VehicleLocked[vehicleVariables[va][vVehicleScriptID]]=vehicleVariables[va][vLocked];
for(new m = 0; m < MAX_MODS; m++)
{
if (vehicleVariables[vehicleid][vMod][m] > 0)
{
AddVehicleComponent(vehicleVariables[vehicleid][vVehicleScriptID],vehicleVariables[vehicleid][vMod][m]);
}
}
if(model == 509 || model == 481 || model == 510){
vehicleVariables[vehicleid][vEngine]=ENGINE_STARTED;
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, true, lights, alarm, doors, bonnet, boot, objective);
}
}
return 1;
}
Код:
// case THREAD_INITIATE_VEHICLES: {
//mysql_store_result();
new x,
bool: success = true,
result[258];
while(mysql_retrieve_row()) {
va = CreateVehicle(520, 15, 712, 33, 82.2873, 0, 1, 60000);
DestroyVehicle(va);
mysql_get_field("ID", result);
x = strval(result);
vehicleVariables[va][Id] = x;
if(systemVariables[vehicleCounts][1] + systemVariables[vehicleCounts][2] < MAX_VEHICLES) {
mysql_get_field("CarModel", result);
vehicleVariables[va][vVehicleModelID] = strval(result);
mysql_get_field("CarX", result);
vehicleVariables[va][vVehiclePosition][0] = floatstr(result);
mysql_get_field("CarY", result);
vehicleVariables[va][vVehiclePosition][1] = floatstr(result);
mysql_get_field("CarZ", result);
vehicleVariables[va][vVehiclePosition][2] = floatstr(result);
mysql_get_field("CarAngle", result);
vehicleVariables[va][vVehicleRotation] = floatstr(result);
mysql_get_field("CarColor1", result);
vehicleVariables[va][vVehicleColour][0] = strval(result);
mysql_get_field("CarColor2", result);
vehicleVariables[va][vVehicleColour][1] = strval(result);
mysql_get_field("CarInt", result);
vehicleVariables[va][vCarInt] = strval(result);
mysql_get_field("CarVW", result);
vehicleVariables[va][vCarVW] = strval(result);
mysql_get_field("FactionCar", result);
vehicleVariables[va][FactionCar] = strval(result);
mysql_get_field("Borghese", result);
vehicleVariables[va][Borghese] = strval(result);
mysql_get_field("Rentable", result);
vehicleVariables[va][Rentable] = strval(result);
mysql_get_field("RentPrice", result);
vehicleVariables[va][RentPrice] = strval(result);
CarWindowStatus[va] = 1; //1 = up, 0 = down.
vehicleVariables[va][Sirenato]=0;
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(x, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(x, false, lights, alarm, doors, bonnet, boot, objective);
vehicleVariables[va][vOwned] = 0;
if(vehicleVariables[va][vVehicleColour][0] < 0) {
vehicleVariables[va][vVehicleColour][0] = random(126);
}
if(vehicleVariables[va][vVehicleColour][1] < 0) {
vehicleVariables[va][vVehicleColour][1] = random(126);
}
vehicleVariables[va][vFuel]=100;
vehicleVariables[va][vVehicleScriptID] = CreateVehicle(vehicleVariables[va][vVehicleModelID], vehicleVariables[va][vVehiclePosition][0], vehicleVariables[va][vVehiclePosition][1], vehicleVariables[va][vVehiclePosition][2], vehicleVariables[va][vVehicleRotation], vehicleVariables[va][vVehicleColour][0], vehicleVariables[va][vVehicleColour][1], 60000);
switch(vehicleVariables[va][vVehicleModelID]) { // OnVehicleSpawn has some annoying glitches with this!1. Should fix.
case 427, 428, 432, 601, 528: SetVehicleHealth(vehicleVariables[va][vVehicleScriptID], 5000.0);
}
systemVariables[vehicleCounts][0]++;
}
else {
success = false;
printf("ERROR: Vehicle limit reached (MODEL %d, VEHICLEID %d, MAXIMUM %d, TYPE STATIC) [01x08]", vehicleVariables[va][vVehicleModelID], x, MAX_VEHICLES);
}
}
if(systemVariables[vehicleCounts][0]==0) initiateVehicleSpawns();
if(success) printf("[script] %d vehicles loaded.", systemVariables[vehicleCounts][0]);
mysql_free_result();