01.02.2017, 16:33
PHP код:
[19:22:53] sscanf warning: Strings without a length are deprecated, please add a destination size.
PHP код:
CMD:asv(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
new vehmodel = GetVehicleModel(vehicleid);
new string[25], Float:vehx, Float:vehy, Float:vehz, Float:vehrot;
GetVehiclePos(vehicleid, vehx, vehy, vehz);
GetVehicleZAngle(vehicleid, vehrot);
new col1, col2, vehtype, price, plate[24], DB_Query[256];
if (sscanf(params, "iiiis", col1, col2, vehtype, price, plate)) SendClientMessage(playerid, COLOR_GREY, "> Type /asv <color1> <color2> <VehicleType> <Price> <Plate>");
if(vehtype == 1)
{
mysql_format(Database, DB_Query, sizeof(DB_Query), "INSERT INTO `Vehicles` ( `vModel`, `Pos_x`, `Pos_y`, `Pos_z`, `Rot`, `Fuel`, `Type`, `Plate`, `vLock`, `Color1`, `Color2`, `RespawnDelay`, `Price`)\
VALUES ( %d, %f, %f, %f, %f, '100', %d, '%s', 0, %d, %d, -1, %d)", vehmodel, vehx, vehy, vehz, vehrot, vehtype, plate, col1, col2, price);
mysql_tquery(Database, DB_Query);
}
else if(vehtype == 2)
{
}
else if(vehtype == 3)
{
mysql_format(Database, DB_Query, sizeof(DB_Query), "INSERT INTO `Vehicles` ( `vModel`, `Pos_x`, `Pos_y`, `Pos_z`, `Rot`, `Fuel`, `Type`, `Plate`, `vLock`, `Color1`, `Color2`, `RespawnDelay`, `Price`)\
VALUES ( %d, %f, %f, %f, %f, '100', %d, '%s', 0, %d, %d, -1, %d)", vehmodel, vehx, vehy, vehz, vehrot, vehtype, plate, col1, col2, price);
mysql_tquery(Database, DB_Query);
}
else if(vehtype == 4)
{
mysql_format(Database, DB_Query, sizeof(DB_Query), "INSERT INTO `Vehicles` ( `vModel`, `Pos_x`, `Pos_y`, `Pos_z`, `Rot`, `Fuel`, `Type`, `Plate`, `vLock`, `Color1`, `Color2`, `RespawnDelay`, `Price`)\
VALUES ( %d, %f, %f, %f, %f, '100', %d, '%s', 0, %d, %d, -1, %d)", vehmodel, vehx, vehy, vehz, vehrot, vehtype, plate, col1, col2, price);
mysql_tquery(Database, DB_Query);
}
format(string, sizeof(string), "Vehicle model is: %d | Type: %d | Price: %d | Plate: %s", vehmodel, vehtype, price, plate);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}