Command bug [Prison RP]
#1

Hello all,

I have downloaded a Prison RP, but some command doesnt work and the code is already in the .amx file.

Example command (/gate)
PWN Code:
Код:
command(gate, playerid, params[])
{
	#pragma unused params

	new string[128];

	if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
	{
		GetPlayerPos(playerid, Positions[0][0], Positions[0][1], Positions[0][2]);
        GetDynamicObjectPos(lspdgate, Positions[1][0], Positions[1][1], Positions[1][2]);
		GetDynamicObjectPos(ImpoundGate, Positions[2][0], Positions[2][1], Positions[2][2]);
		GetDynamicObjectPos(PrisonGate, Positions[3][0], Positions[3][1], Positions[3][2]);

		if(GetDistance(Positions[0][0], Positions[0][1], Positions[0][2], Positions[1][0], Positions[1][1], Positions[1][2]) < 30.0)
		{
			if(GateOpen == 0)
			{
				format(string, sizeof(string), "* %s uses their remote to open the gates.", GetName(playerid));
                NearByMessage(playerid, NICESKY, string);
                MoveDynamicObject(lspdgate, 1588.5617, -1638.0871, 5.7200, 1);
                GateOpen = 1;
                SetTimer("CloseLspdGate", 5000, false);
			}
			else
			{
				SendClientMessage(playerid, WHITE, "The gate is already open, wait for it to close.");
			}
		}
		else if(GetDistance(Positions[0][0], Positions[0][1], Positions[0][2], Positions[2][0], Positions[2][1], Positions[2][2]) < 30.0)
		{
			if(ImpoundOpen == 0)
			{
				format(string, sizeof(string), "* %s uses their remote to open the gates.", GetName(playerid));
                NearByMessage(playerid, NICESKY, string);
                DestroyDynamicObject(ImpoundGate);
				ImpoundGate = CreateDynamicObject(968, 1544.681640625, -1630.8916015625, 13.054567337036, 0, 0, 90); // Gate open coords
                ImpoundOpen = 1;
                SetTimer("CloseImpoundGate", 5000, false);
			}
			else
			{
				SendClientMessage(playerid, WHITE, "The gate is already open, wait for it to close.");
			}
		}
		else if(GetDistance(Positions[0][0], Positions[0][1], Positions[0][2], Positions[3][0], Positions[3][1], Positions[3][2]) < 30.0)
		{
			if(PrisonGateOpen == 0)
			{
				format(string, sizeof(string), "* %s uses their remote to open the gates.", GetName(playerid));
                NearByMessage(playerid, NICESKY, string);
				MoveDynamicObject(PrisonGate, 1788.4794921875, -1600.173828125, 19.745199203491, 1);
				PrisonGateOpen = 1;
				SetTimer("PrisonGateTimer", 5000, false);
			}
			else
			{
				SendClientMessage(playerid, WHITE, "The gate is already open, wait for it to close.");
			}
		}
	}
	else if(Player[playerid][Group] == 11)
	{
		GetPlayerPos(playerid, Positions[0][0], Positions[0][1], Positions[0][2]);
		GetDynamicObjectPos(MarketGate, Positions[1][0], Positions[1][1], Positions[1][2]);

		if(MarketGateOpen == 0)
		{
			format(string, sizeof(string), "* %s uses their remote to open the gates.", GetName(playerid));
            NearByMessage(playerid, NICESKY, string);
			MoveDynamicObject(MarketGate, 828.37866210938, -1357.3833007813, 4.50577330589294, 1);
			MarketGateOpen = 1;
		}
		else
		{
			format(string, sizeof(string), "* %s uses their remote to close the gates.", GetName(playerid));
            NearByMessage(playerid, NICESKY, string);
			MoveDynamicObject(MarketGate, 828.37866210938, -1357.3833007813, 0.50577330589294, 1);
			MarketGateOpen = 0;
		}
	}
	else
    {
        if(Player[playerid][Group] == 5)
        {
			GetPlayerPos(playerid, Positions[0][0], Positions[0][1], Positions[0][2]);
	        GetDynamicObjectPos(CGate1, Positions[1][0], Positions[1][1], Positions[1][2]);

			if(GetDistance(Positions[0][0], Positions[0][1], Positions[0][2], Positions[1][0], Positions[1][1], Positions[1][2]) < 30.0)
			{
				if(CGateOpen == 0)
				{
					format(string, sizeof(string), "* %s uses their remote to open the doors.", GetName(playerid));
					NearByMessage(playerid, NICESKY, string);
					MoveDynamicObject(CGate1, 1479.6882324219, -1649.5045166016, -38.890918731689, 1);
					MoveDynamicObject(CGate2, 1485.3944091797, -1649.4760742188, -38.890918731689, 1);
					CGateOpen = 1;
				}
				else
				{
					format(string, sizeof(string), "* %s uses their remote to close the doors.", GetName(playerid));
					NearByMessage(playerid, NICESKY, string);
					MoveDynamicObject(CGate1, 1481.1398925781, -1649.4718017578, -38.890918731689, 1);
					MoveDynamicObject(CGate2, 1484.1184082031, -1649.4512939453, -38.890918731689, 1);
					CGateOpen = 0;
				}
			}
		}
    }
	return 1;
}
if i type /gate then it does nothing.



Reply
#2

do you still have the onplayercommandtext public?
if yes, delete it, because when using zcmd it's not needed
Reply
#3

It doesn have public onplayercommandtext, i think its a other problem
Reply
#4

Debug your code. Put a SendClientMessage in there so you can see if it's actually executing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)