GetPlayerPos + GMX.
#1

Hello. When I'm trying to GetPlayerPos, within server GMX, it's setting coordinations as x - 0, y - 0, z - 0. Is there any solution about this?
Reply
#2

I'm wondering how you're actually able to retrieve a player's coordinates when you're restarting the server 0.o
Reply
#3

2 Options that I can think off hand that could resolve this issue...

1.) Use the GVar Plugin to save your Coordinates Globally, a server restart don't reset GVars
(Thread Information for this GVar Plugin: https://sampforum.blast.hk/showthread.php?tid=151076 )

2.) Save your cordinates to a file, then Read them again after the GMX...
(But I'd go with the GVar Plugin instead if possible)
Reply
#4

He's able to retrieve the coordinates when the server restarting, if he's loading a filterscript which does that, during the restarting.
But the position of the player on GMX is actually 0.0 0.0 0.0, it's just the player camera showing the sea on LS.

What exactly are you trying to do?

Also, wrong section.
Reply
#5

I don't want to GetPlayerPos - OnPlayerUpdate or with timers. It would lag my server. So, I'm taking player position on his disconnect.

But I want to disable getting position, if I'm gmxing.

Код:
public OnPlayerDisconnect(playerid)
{
	if(PlayerInfo[playerid][loggedIn] == 1)
	{
		GetPlayerPos(playerid, PlayerInfo[playerid][x], PlayerInfo[playerid][y], PlayerInfo[playerid][z]);
    		GetPlayerFacingAngle(playerid, PlayerInfo[playerid][angle]);
		format(query, 128, "UPDATE `players` SET `x`=%f,`y`=%f,`z`=%f,`angle`=%f WHERE `login`='%s'", PlayerInfo[playerid][x], PlayerInfo[playerid][y], PlayerInfo[playerid][z], PlayerInfo[playerid][angle], playerName(playerid));
    		mysql_query(query);
	}
	return 1;
}
And I'm sorry for wrong section ;P
Reply
#6

GMX & OnPlayerDisconnect are two diffirent things although when GMX is called, so is OnPlayerDisconnect for the players. If you attempt to get the player's position during those times, it's going to result as 0 (And your current problem). So you'll have to get the Player Pos before executing GMX... So if you have a scripted GMX Command for example, then first save the Player's Positions & THEN GameModeExit()

Now you're just confusing me, you want Player Positions on GMX & you don't... Which is it?

Or perphaps just using a varible to determine when Player Positions should be saved or not no matter what method is caused...
Reply
#7

i would do this:
set a global variable like
Код:
new ServerRunning=1;
before you /gmx (i hope you got a command for that, not the rcon gmx), then set the
Код:
ServerRunning=0;
and add that into the check for getting the positions:
Код:
if(ServerRuning==1)
{
GetPlayerPos(blabla);
}
Reply
#8

It worked in earlier versions of SA-MP, but then it stopped working.
Reply
#9

Ah... I know what you mean now. You must call OnPlayerDisconnect before the GMX

Код:
OnPlayerDisconnect(playerid);
GameModeExit();
However, use the earlier mentioned Varible to prevent it from running after the GMX...
Reply
#10

Just make a /gmx command in-game.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)