einmal GetInt
stock mysql_GetInt(Table[], Field[], Where[], Is[])
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT %s FROM %s WHERE %s = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
new sqlint = mysql_fetch_int();
mysql_free_result();
return sqlint;
}
und GetFloat
stock Float:mysql_GetFloat(Table[], Field[], Where[], Is[])
{
new query[128], Float:sqlfloat;
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT %s FROM %s WHERE %s = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
mysql_fetch_float(sqlfloat);
mysql_free_result();
return sqlfloat;
}
ich hab das von hier: [ SCRIPTING ] MySQL (Installation, Zugriff, Einstellungen, Login & Register Beispiel) ich wollte das mal ausprobieren
//edit:
hab da mal ne idee :
stock LoadFrakCars()
{
new fc;
new string[16];
while(fc<50)
format(string, sizeof(string),"%d",fc);
{
FrakCarInfo[fc][Model] = mysql_GetInt("vehicles", "Model", "id", string);
FrakCarInfo[fc][x] = mysql_GetFloat("vehicles", "x", "id", string);
FrakCarInfo[fc][y] = mysql_GetFloat("vehicles", "y", "id", string);
FrakCarInfo[fc][z] = mysql_GetFloat("vehicles", "z", "id", string);
FrakCarInfo[fc][a] = mysql_GetFloat("Vehicles", "a", "id", string);
FrakCarInfo[fc][Color1] = mysql_GetInt("vehicles", "Color1", "id", string);
FrakCarInfo[fc][Color2] = mysql_GetInt("vehicles", "Color2", "id", string);
if(FrakCarInfo[fc][Model] >= 400 && FrakCarInfo[fc][Model] <= 611)
{
FrakCarInfo[fc][CarID] = AddStaticVehicleEx(FrakCarInfo[fc][Model], FrakCarInfo[fc][x], FrakCarInfo[fc][y], FrakCarInfo[fc][z], FrakCarInfo[fc][a], FrakCarInfo[fc][Color1], FrakCarInfo[fc][Color2], -1);
}
fc++;
}
return 1;
}
Aber dann startet der Server nicht mehr richtig.
Es steht dort dann nicht ob vehicles geladen werden