SA-MP Forums Archive
Deelay on CreateVehicle - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Deelay on CreateVehicle (/showthread.php?tid=662602)



Deelay on CreateVehicle - qRazor - 06.01.2019

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?


Re: Deelay on CreateVehicle - Hazon - 06.01.2019

So, after a 5 seconds a private vehicle will be spawned or ? I think you don't need that, unless you want it.


Re: Deelay on CreateVehicle - qRazor - 06.01.2019

Yea, after maximum 5 seconds the personal car it's spawned.

EDIT: I want to spawn the car because when player login on server the car is despawned.

EDIT(2): I want to know just if it's a normal deelay or it's from my scripts. I make an debug but isn't deelay on all function SpawnPlayerCar it's just on CreateVehicle.

There it is my script:
HTML Code:
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;
}
EDIT(3): Sometimes deelay on CreateVehicle is 3 seconds sometimes 4. It's just deelay on this samp function.


Re: Deelay on CreateVehicle - Kaliber - 07.01.2019

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:
UPDATE `carsSET `Spawned`='%d' WHERE `ID`='%d' LIMIT 1 
But maybe there are some other Callbacks like
PHP Code:
OnPlayerUpdate 
or timer, which slows your server.

Check with the profiler plugin


Re: Deelay on CreateVehicle - qRazor - 07.01.2019

Quote:
Originally Posted by Kaliber
View Post
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:
UPDATE `carsSET `Spawned`='%d' WHERE `ID`='%d' LIMIT 1 
But maybe there are some other Callbacks like
PHP Code:
OnPlayerUpdate 
or timer, which slows your server.

Check with the profiler plugin
HTML Code:
[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
It was my bad... i open mysql_log and i see one error. I loaded wrong from database(i load "LOcationZ" but in database was "LocationZ" and this was the problem). Now it's fine the car is spawned instantly, thank you. How to use this profiler plugin, you can teach me please?

EDIT:
HTML Code:
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.
How i can see that? What settings i need to do?