Script problem: When use script server bugs. -
Fantje - 09.03.2015
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?
Re: Script problem: When use script server bugs. -
CalvinC - 09.03.2015
You might be returning 0 in OnPlayerUpdate, show us the code.
Re: Script problem: When use script server bugs. -
Fantje - 09.03.2015
Nope I did not returned 0
Re: Script problem: When use script server bugs. -
CalvinC - 09.03.2015
Then show us the code, we can't help without it.
Re: Script problem: When use script server bugs. -
Fantje - 09.03.2015
Okay I'll take it
Re: Script problem: When use script server bugs. -
Fantje - 09.03.2015
PHP код:
new autogate;
Forward:
forward close();
On the bottom of the gamemode:
public close()
{
MoveObject(autogate,-308.49820, 1508.65869, 74.33560,3);
return 1;
}
Under GameModeInit:
autogate = CreateObject(987, -308.49820, 1508.65869, 74.33560, 0.00000, 0.00000, 0.00000);
Under OnPlayerUpdate:
public OnPlayerUpdate(playerid)
{
if(PlayerInfo[playerid][dRank] < 1 && IsPlayerInRangeOfPoint(playerid, 8, -308.49820, 1508.65869, 74.33560))
{
MoveObject(autogate, -308.49820, 1508.65869, 68.10109, 3);
SetTimer("close", 4000, 0);
}
return 1;
}
Re: Script problem: When use script server bugs. -
Fantje - 09.03.2015
Anybody?
Re: Script problem: When use script server bugs. -
FunnyBear - 09.03.2015
Quote:
Originally Posted by Fantje
PHP код:
new autogate;
Forward:
forward close();
On the bottom of the gamemode:
public close()
{
MoveObject(autogate,-308.49820, 1508.65869, 74.33560,3);
return 1;
}
Under GameModeInit:
autogate = CreateObject(987, -308.49820, 1508.65869, 74.33560, 0.00000, 0.00000, 0.00000);
Under OnPlayerUpdate:
public OnPlayerUpdate(playerid)
{
if(PlayerInfo[playerid][dRank] < 1 && IsPlayerInRangeOfPoint(playerid, 8, -308.49820, 1508.65869, 74.33560))
{
MoveObject(autogate, -308.49820, 1508.65869, 68.10109, 3);
SetTimer("close", 4000, 0);
}
return 1;
}
|
Why would you want to set a timer then open the gate, why not just open the gate under OnPlayerUpdate?
Re: Script problem: When use script server bugs. -
Fantje - 09.03.2015
What you mean?
Re: Script problem: When use script server bugs. -
CalvinC - 09.03.2015
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.