29.12.2014, 12:32
PHP код:
stock LoadVehicle(playerid)
{
new carData [ 3 ] , Float:posi [ 4 ];
format(g_szBuffer,sizeof(g_szBuffer),"SELECT * FROM `"MySQL_VEHICLE_TABLE"` WHERE savininkas = '%s'", getPlayerName(playerid));
mysql_query(g_szBuffer);
mysql_store_result(); new resultline[400];
if(mysql_fetch_row_format(resultline))
{
sscanf(resultline,"p<|>{is[24]}i{if}iiffff{iiiifs[24]fiiiiiiiiiiiiiii}", \
carData[ 0 ],
carData[ 1 ],
carData[ 2 ],
posi[ 0 ],
posi[ 1 ],
posi[ 2 ],
posi[ 3 ]);
playerCar1 [ playerid ] = CreateVehicle ( carData[0] , posi [ 0 ] , posi [ 1 ] , posi [ 2 ] , posi [ 3 ] , carData [ 1 ] , carData [ 2 ] , -1 ) ;
new tr = playerCar1 [ playerid ];
sscanf(resultline,"p<|>is[24]{i}if{iiffff}iii{i}fs[21]f{iiiiiiiiiiiiii}ii", \
masina[ tr ][ SQLID ],
masina[ tr ][ vehOwner ],
masina[ tr ][ lock ],
masina[ tr ][ Gas ],
masina[ tr ][ vehKaina ],
masina[ tr ][ status ],
masina[ tr ][ vehVariklis ],
masina[ tr ][ vehHealth ],
masina[ tr ][ vehNumber ],
masina[ tr ][ vehRida ],
masina[ tr ][ vehTech ],
masina[ tr ][ vehTechtime ]);
masina[ tr ][ vehOwned ] = true;
if ( masina [ tr ] [ status ] == true )
{
SendError ( playerid, " jūsų transportas sudauћytas, norėdami jį atsatyti naudokite ( {FF8585}/atstatyti{ffffff} ) !" );
DestroyVehicle(tr);
}
SetVehicleParamsEx ( tr, masina[ tr ][ vehVariklis ], false, false, false, false, false, false ) ;
SetVehicleHealth(tr, masina[ tr ][ vehHealth ]);
SetVehicleNumberPlate(tr, masina [ tr ] [ vehNumber ]);
printf("SQL(%i), Owner(%s), Lock(%i) Gas(%f) Price(%i) Status(%i) Engine(%i) Heath(%f) VehNumber(%s) Rida(%f) Tech(%i) Time(%i)", \
masina[ tr ][ SQLID ],masina[ tr ][ vehOwner ],masina[ tr ][ lock ],masina[ tr ][ Gas ],masina[ tr ][ vehKaina ], masina[ tr ][ status ],masina[ tr ][ vehVariklis ],masina[ tr ][ vehHealth ],masina[ tr ][ vehNumber ],masina[ tr ][ vehRida ],masina[ tr ][ vehTech ],masina[ tr ][ vehTechtime ]);
}
mysql_free_result();
return 1;
}