setplayerpos laggs up the player on spawn? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: setplayerpos laggs up the player on spawn? (
/showthread.php?tid=191021)
setplayerpos laggs up the player on spawn? -
0ne - 17.11.2010
pawn Код:
new pRandom = random(sizeof(SFRandom));
SetPlayerPos(playerid,SFRandom[pRandom][0],SFRandom[pRandom][1],SFRandom[pRandom][2]);
This code lags up the onplayerspawn for player, i set up one place to spawn and it worked fine, but as i want him to spawn in some random place i defined, it lags up and then spawns, any ideas why?
Re: setplayerpos laggs up the player on spawn? -
Hiddos - 17.11.2010
Is this server performance lag or framelag?
As in:
Server performance lag: The script 'freezes' for a second or two.
Framelag: The player freezes for a second or two.
Server performance lag can easily be detected by using a check of how long it took to complete the code with GetTickCount() and print():
pawn Код:
new tc = GetTickCount();
new pRandom = random(sizeof(SFRandom));
SetPlayerPos(playerid,SFRandom[pRandom][0],SFRandom[pRandom][1],SFRandom[pRandom][2]);
printf("Ticks: %d", GetTickCount() - tc);
Re: setplayerpos laggs up the player on spawn? -
Zh3r0 - 17.11.2010
No idea. But instead of what you have try this.
In this code, NUMBER_OF_TELEPORTS, should be 5, because there are 5 cases. 0 is counted too.
pawn Код:
switch( random( NUMBER_OF_TELEPORTS ) )
{
case 0: SetPlayerPos(...);
case 1: SetPlayerPos(...);
case 2: SetPlayerPos(...);
case 3: SetPlayerPos(...);
case 4: SetPlayerPos(...);
//...
}
NUMBER_OF_TELEPORTS = Number of coordination you have.
At SetPlayerPos add your positions.
Re: setplayerpos laggs up the player on spawn? -
0ne - 17.11.2010
Quote:
Originally Posted by Zh3r0
No idea. But instead of what you have try this.
In this code, NUMBER_OF_TELEPORTS, should be 5, because there are 5 cases. 0 is counted too.
pawn Код:
switch( random( NUMBER_OF_TELEPORTS ) ) { case 0: SetPlayerPos(...); case 1: SetPlayerPos(...); case 2: SetPlayerPos(...); case 3: SetPlayerPos(...); case 4: SetPlayerPos(...); //... }
NUMBER_OF_TELEPORTS = Number of coordination you have.
At SetPlayerPos add your positions.
|
At first time it worked ,but then after i died again didn't work. When I'm about to spawn it shows with me some sort of anim, it looks like I'm laying on air, but in cubics form LOL.
Hiddos - It writes ticks 0. At first when i spawn from requestclass screen when connected it works fine..
Re: setplayerpos laggs up the player on spawn? -
0ne - 18.11.2010
bump, help please, the bug is annoying
offtopic:
1999 threads of scripting discussion created haha lol