setplayerpos laggs up the player on spawn?
#1

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

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);
Reply
#3

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

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

bump, help please, the bug is annoying


offtopic:

1999 threads of scripting discussion created haha lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)