new query[500];
format(query, sizeof(query),"INSERT INTO `ownedcars` (`spawnid`, `Model`, `Location_X`, `Location_Y`, `Location_Z`, `Angle`, `Color_1`, `Color_2`, `Owner`, `Owned`, `Locked`, `PlateSet`, `Plate`, `Paintjob`, `Virtualworld`, `Component0`, `Component1`, `Component2`, `Component3`, `Component4`, `Component5`, `Component6`, `Component7`, `Component8`, `Component9`, `Component10`, `Component11`, `Component12`, `Component13`, `SecurityCode`) VALUES ('%d', '%d', '%f', '%f', '%f', '%f', '0', '1', '1', '%s', '1', '1', '0', '', '999', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '%d')", sid, vmodel, x, y, z, angle, sname, strval(pass));
mysql_query(query);
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\ugrp_sql.pwn(41100) : error 075: input line too long (after substitutions)
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\ugrp_sql.pwn(41101) : error 037: invalid string (possibly non-terminated string)
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\ugrp_sql.pwn(41101) : error 017: undefined symbol "INSERT"
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\ugrp_sql.pwn(41101) : error 017: undefined symbol "INTO"
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\ugrp_sql.pwn(41101) : fatal error 107: too many error messages on one line
The input line is to long for the compiler.
Use STRCAT for that string. Tip: 0 values doesn't need to be setted. Insert will create INT's as 0 as far as I know. |
format(query, sizeof(query),"INSERT INTO `ownedcars` (`spawnid`, `Model`, `Location_X`, `Location_Y`, `Location_Z`, `Angle`, `Owned`, `Paintjob`, `SecurityCode`) VALUES ('%d', '%d', '%f', '%f', '%f', '%f', '%s', '999', '%d')", sid, vmodel, x, y, z, angle, sname, strval(pass));
query = "INSERT INTO `ownedcars` (`spawnid`, `Model`, `Location_X`, `Location_Y`, `Location_Z`, `Angle`, `Color_1`, `Color_2`, `Owner`, `Owned`, `Locked`, `PlateSet`, `Plate`, `Paintjob`, `Virtualworld`, `Component0`, `Component1`, `Component2`, `Component3`, `Component4`";
strcat(query,",`Component5`, `Component6`, `Component7`, `Component8`, `Component9`, `Component10`, `Component11`, `Component12`, `Component13`, `SecurityCode`) VALUES");
format(query, sizeof(query),"%s('%d', '%d', '%f', '%f', '%f', '%f', '0', '1', '1', '%s', '1', '1', '0', '0', '999', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '%d')", query, sid, vmodel, x, y, z, angle, sname, strval(pass));
new query[500];
format(query, sizeof(query),"INSERT INTO `ownedcars` (`spawnid`, `Model`, `Location_X`, `Location_Y`, `Location_Z`, `Angle`, `Color_1`, `Color_2`, `Owner`, `Owned`, `Locked`, `PlateSet`, `Plate`, `Paintjob`,\
`Virtualworld`, `Component0`, `Component1`, `Component2`, `Component3`, `Component4`, `Component5`, \
`Component6`, `Component7`, `Component8`, `Component9`, `Component10`, `Component11`, \
`Component12`, `Component13`, `SecurityCode`) VALUES ('%d', '%d', '%f', '%f', '%f', '%f', '0', '1', '1', '%s', '1', \
'1', '0', '', '999', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '%d')", sid, vmodel, x, y, z, angle, sname, strval(pass));
mysql_query(query);
public LoadCar()
{
new query[90], rows;
format(query, sizeof(query),"SELECT COUNT(*) FROM ownedcars");
mysql_query(query);
mysql_store_result();
rows = mysql_num_rows();
printf("[MYSQL-DATABASE]: Loaded %d Vehicles (Dynamic)", rows);
mysql_free_result();
return 1;
}