SA-MP Forums Archive
Gate problem - 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)
+--- Thread: Gate problem (/showthread.php?tid=519300)



Gate problem - xdarren - 13.06.2014

Hello I have a problem with gates, whener I press Y it shows me the text but it's not moving it's just there not moving. Please help, I can't find the reason of this problem.

Код:
enum _gates
{
	gID,
	gFactionID,

	gModelID,

	gOpen,

	Float:closeX, Float:closeY, Float:closeZ, Float: rotX, Float: rotY, Float: rotZ,

	Float:openX, Float:openY, Float:openZ, Float: openrotX, Float: openrotY, Float: openrotZ,
}
Код:
{ 0, -1, 3037, 0, 1589.20276, -1638.26514, 14.48878,0.00000000,0.00000000,-90.00000, 1589.20276, -1638.26514, 8.05993,0.00000000,0.00000000,-90.00000 }
Код:
if((newkeys & KEY_YES) && !(oldkeys & KEY_YES))
    {
        for(new h=0; h<=MAX_GATES; h++)
    	{
		if(GateInfo[h][gModel] && IsPlayerInRangeOfPoint(playerid, 8, GateInfo[h][gCX], GateInfo[h][gCY], GateInfo[h][gCZ]))
		if(PlayerInfo[playerid][playerteam]==GateInfo[h][gFaction])
		{
			if(!GateInfo[h][gStatus])
			{
         		MoveObject(GateInfo[h][gGate], GateInfo[h][gCX], GateInfo[h][gCY], GateInfo[h][gCZ], GateInfo[h][gSpeed]);
				GateInfo[h][gStatus]=1;
				SendClientInfo(playerid, "Done, Good day ! TEST OPEN");
			}
			else
			{
         		MoveObject(GateInfo[h][gGate], GateInfo[h][gCX], GateInfo[h][gCY], GateInfo[h][gCZ], GateInfo[h][gSpeed]);
                GateInfo[h][gStatus]=0;
                SendClientInfo(playerid, "Done, Good day ! ");
			}
			return 1;
		}
	}
	return 1;
    }



Re: Gate problem - xdarren - 13.06.2014

Nevermind it fixed it.


Re: Gate problem - maramizo - 13.06.2014

Quote:
Originally Posted by xdarren
Посмотреть сообщение
Nevermind it fixed it.
Rule of thumb:
Whenever you have a problem and you fix it, post in the thread how you did so others don't have to create the same thread as you.

And the problem with this code was that he set both if and else checks to set the gate position to the same one.