Script problem: When use script server bugs.
#1

Hey guys,

When I use a script for gate auto open/close I see all people as AFK and the people glitches.

When I delete the script everything works fine

HOW?
Reply
#2

You might be returning 0 in OnPlayerUpdate, show us the code.
Reply
#3

Nope I did not returned 0
Reply
#4

Then show us the code, we can't help without it.
Reply
#5

Okay I'll take it
Reply
#6

PHP код:
new autogate;  

Forward:  

forward close();  

On the bottom of the gamemode:  

public 
close()  
{  
MoveObject(autogate,-308.498201508.6586974.33560,3);  
return 
1;  
}  

Under GameModeInit:  

autogate CreateObject(987, -308.498201508.6586974.33560,   0.000000.000000.00000);  

Under OnPlayerUpdate:  
public 
OnPlayerUpdate(playerid)

    if(
PlayerInfo[playerid][dRank] < && IsPlayerInRangeOfPoint(playerid8, -308.498201508.6586974.33560))
    {
        
MoveObject(autogate, -308.498201508.6586968.101093); 
        
SetTimer("close"40000);
    } 

    return 
1;

Reply
#7

Anybody?
Reply
#8

Quote:
Originally Posted by Fantje
Посмотреть сообщение
PHP код:
new autogate;  
Forward:  
forward close();  
On the bottom of the gamemode:  
public 
close()  
{  
MoveObject(autogate,-308.498201508.6586974.33560,3);  
return 
1;  
}  
Under GameModeInit:  
autogate CreateObject(987, -308.498201508.6586974.33560,   0.000000.000000.00000);  
Under OnPlayerUpdate:  
public 
OnPlayerUpdate(playerid)

    if(
PlayerInfo[playerid][dRank] < && IsPlayerInRangeOfPoint(playerid8, -308.498201508.6586974.33560))
    {
        
MoveObject(autogate, -308.498201508.6586968.101093); 
        
SetTimer("close"40000);
    } 
    return 
1;

Why would you want to set a timer then open the gate, why not just open the gate under OnPlayerUpdate?
Reply
#9

What you mean?
Reply
#10

Quote:
Originally Posted by FunnyBear
Посмотреть сообщение
Why would you want to set a timer then open the gate, why not just open the gate under OnPlayerUpdate?
He is opening it in OnPlayerUpdate, but he's setting a timer of 4 seconds to close it again it seems.

But you see, if a player is in range of the gate, let's say that player has a FPS of 60.
It will open the gate, AND create a new timer lasting 4 seconds. It will do this 60 times a second.
You quickly see this creating infinitely more and more timers, 60 times a second.
You should use a boolean to check whether the gate is opened or not, to close it again.

Although im not sure this is the problem, if this happens immediately when you start the server, and not when a player is near the gate, it's still a major issue.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)