Deelay on CreateVehicle
#1

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?
Reply
#2

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

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.
Reply
#4

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
Reply
#5

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)