24.02.2014, 10:32
I have my functions like that
But is it possible to do all this with only one function, so i could use it in that way?
I mean, that i wouldnt need to write this in that way:
If my code is wrong above, its okay, important is the point about that. :d
If it is possible, could you help me? Because i am tired of writing almost the same functions so many times :P
Thanks.
Код:
public UpdateOCarInt(qCarId, qValue[], qInt) { new query[140]; format(query, sizeof(query), "UPDATE ownablecars SET %s=%d WHERE ID=%d", qValue, qInt, qCarId); mysql_function_query(gSQL, query, false, "SendQuery", ""); return 1; } public UpdateOCarStr(qCarId, qValue[], Str) { new query[140]; format(query, sizeof(query), "UPDATE ownablecars SET %s=%s WHERE ID=%d", qValue, qInt, qCarId); mysql_function_query(gSQL, query, false, "SendQuery", ""); return 1; } public UpdateOCarFlo(qCarId, qValue[], Float:qFlo) { new query[140]; format(query, sizeof(query), "UPDATE ownablecars SET %s=%f WHERE ID=%d", qValue, qFlo, qCarId); mysql_function_query(gSQL, query, false, "SendQuery", ""); return 1; }
Код:
UpdateOCar(car, "PosX", FloatToStr(ScriptCarInfo[car][PosX])); UpdateOCar(car, "OwnerName", StringToStr(ScriptCarInfo[car][OwnerName])); UpdateOCar(car, "OwnerID", IntToStr(ScriptCarInfo[car][OwnerID]));
Код:
UpdateOCarFlo(car, "PosX", ScriptCarInfo[car][PosX]); UpdateOCarStr(car, "OwnerName", ScriptCarInfo[car][OwnerName]); UpdateOCarInt(car, "OwnerID", ScriptCarInfo[car][OwnerID]);
If it is possible, could you help me? Because i am tired of writing almost the same functions so many times :P
Thanks.