03.01.2012, 02:10
I used this script somewhere, let me find it..
Change where necessary, and rep me !
pawn Код:
stock LoadPVehicles()
{
new
Query[512],
vModel2,
vC[2],
vPrice2,
vOwner2[MAX_PLAYER_NAME],
Float:Pos[4],
vID,
PlateNum[32],
vPaint_Job,
vLockedd,
vOwnedd,
vLevell,
vTypee,
vModsToLoad[17];
mysql_query("SELECT * FROM `privateveh` WHERE `vID` < "#MAX_BUYABLE_VEH);
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row_format(Query))
{
sscanf(Query, "p<|>iiiiis[24]ffffs[32]iiiiiiiiiiiiiiiiiiiiii", vID, vModel2, vC[0], vC[1], vPrice2, vOwner2, Pos[0], Pos[1], Pos[2], Pos[3], PlateNum, vPaint_Job,
vModsToLoad[0], vModsToLoad[1], vModsToLoad[2], vModsToLoad[3], vModsToLoad[4], vModsToLoad[5], vModsToLoad[6], vModsToLoad[7], vModsToLoad[8], vModsToLoad[9], vModsToLoad[10], vModsToLoad[11],vModsToLoad[12],vModsToLoad[13],vModsToLoad[14],vModsToLoad[15],vModsToLoad[16],vLockedd,vOwnedd,vLevell,vTypee);
vInfo[vID][vModel] = vModel2;
vInfo[vID][vColor1] = vC[0];
vInfo[vID][vColor2] = vC[1];
vInfo[vID][vPrice] = vPrice2;
strmid(vInfo[vID][vOwner], vOwner2, 0, 24, 24);
vInfo[vID][vPosX] = Pos[0];
vInfo[vID][vPosY] = Pos[1];
vInfo[vID][vPosZ] = Pos[2];
vInfo[vID][vPosA] = Pos[3];
strmid(vInfo[vID][vPlate], PlateNum, 0, 32, 32);
vInfo[vID][vPaintJ] = vPaint_Job;
vMods[vID][0] = vModsToLoad[0];
vMods[vID][1] = vModsToLoad[1];
vMods[vID][2] = vModsToLoad[2];
vMods[vID][3] = vModsToLoad[3];
vMods[vID][4] = vModsToLoad[4];
vMods[vID][5] = vModsToLoad[5];
vMods[vID][6] = vModsToLoad[6];
vMods[vID][7] = vModsToLoad[7];
vMods[vID][8] = vModsToLoad[8];
vMods[vID][9] = vModsToLoad[9];
vMods[vID][10] = vModsToLoad[10];
vMods[vID][11] = vModsToLoad[11];
vMods[vID][12] = vModsToLoad[12];
vMods[vID][13] = vModsToLoad[13];
vMods[vID][14] = vModsToLoad[14];
vMods[vID][15] = vModsToLoad[15];
vMods[vID][16] = vModsToLoad[16];
vInfo[vID][vLocked] = vLockedd;
vInfo[vID][vOwned] = vOwnedd;
vInfo[vID][vLevel] = vLevell;
vInfo[vID][vType] = vTypee;
if(vInfo[vID][vModel] != 0)
{
new
vCarID = CreateVehicle(vModel2, Pos[0], Pos[1], Pos[2], Pos[3], vC[0], vC[1], 500000);
SetVehicleNumberPlate(vCarID, PlateNum);
ChangeVehiclePaintjob(vCarID, vPaint_Job);
Engine[vCarID] = 0;
if(vInfo[vID][vOwned] == 0)
{
vInfo[vID][vLocked] = 0;
}
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vCarID,engine,lights,alarm,doors,bonnet,boot,objective);
if(vInfo[vID][vLocked] == 1)
{
SetVehicleParamsEx(vCarID,engine,lights,alarm,1,bonnet,boot,objective);
}
else
{
SetVehicleParamsEx(vCarID,engine,lights,alarm,0,bonnet,boot,objective);
}
Spawned[vCarID] = 0;
for(new i = 0; i < MAX_VEH_MODS; i++)
{
if(vMods[vCarID][i] > 0)
{
AddVehicleComponent(vCarID, vMods[vCarID][i]);
}
}
OwnedVeh(vCarID) = vID;
RealID[vID] = vCarID;
++ Total_Veh_Created;
}
}
}
mysql_free_result();
printf("** A total of: \"%i\" vehicle(s) were loaded!", vID);
print("\n==============================================================");
print("Car sys loaded.");
print("==============================================================\n");
return 1;
}