06.01.2019, 15:29
Hi guys, i make an personal vehicle system and i have 4-5 seconds deelay on function CreateVehicle. It's this a problem or it's normal?
stock SpawnPlayerCar(carid) { SCMTA(COLOR_YELLOW, "S-a executat(SPAWN)!"); new query[128]; CarInfo[carid][cSpawned] = CreateVehicle(CarInfo[carid][cModel], CarInfo[carid][cLocationX], CarInfo[carid][cLocationY], CarInfo[carid][cLocationZ], CarInfo[carid][cAngle], -1, -1, -1); format(query, sizeof(query), "UPDATE `cars` SET `Spawned`='%d' WHERE `ID`='%d'", CarInfo[carid][cSpawned], carid); mysql_query(SQL, query); return 1; }
UPDATE `cars` SET `Spawned`='%d' WHERE `ID`='%d' LIMIT 1
OnPlayerUpdate
You can check with the profiler Plugin if there is something slowing your server down.
You should use newer mysql versions for asynchron mysql querys. To speed this query up, write it like this: PHP Code:
PHP Code:
Check with the profiler plugin |
[18:46:33 01/07/19] [WARNING] CMySQLResult::GetRowDataByName - field not found ("LOcationZ") (Query: "SELECT * FROM `cars` WHERE `ID`='29' LIMIT 1") [18:46:33 01/07/19] [ERROR] cache_get_field_content_float - invalid datatype
This plugin can count how many times each of functions is called and how much time it takes to execute. This information is outputted in one of the currently supported formats: HTML , XML or and plain text.