I need a teacher (how to use 1 cmd to make 2 things move)
#1

Ok, i made my gate but i have to make 2 cmds, 1 to open the gate, and another to close the gate, can anyone show me how to use 1 cmd to open and close gate.
Reply
#2

You could use timer to close gates automaticly or

on top
new GatesOpen;

in cmd
if(GatesOpen == 0)
{
GatesOpen = 1;
Open
}
else
{
Close
GatesOpen = 0;
}
Reply
#3

OK i will try to add it, and will i have or use 2 or 1 cmds?
Reply
#4

If you use a timer like I did, 1 cmd.
Reply
#5

I dont want to use timers, i want gate to open manually.
Reply
#6

Sorry to double post, here is my code, but i cant seem to get it working, can u add it for me.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/gateopen", cmdtext, true, 10) == 0)
	{
		MoveObject(mygate,2705.8347167969, 657.30255126953, 11.070308685303,3.0);
		SendClientMessage(playerid,0xFFFF00FF,"You have just opened the Yard gate");
		return 1;
	}
	if (strcmp("/gateclose", cmdtext, true, 10) == 0)
	{
		MoveObject(mygate,2706.0078125, 652.048828125, 11.070308685303,3.0);
		SendClientMessage(playerid,0xFFFF00FF,"You have just closed the Yard gate");
		return 1;
	}
 	else
 	{
 	    SendClientMessage(playerid,0xFF0000FF,"You are too far to open the gate");
 		return 0;
	}
}
Reply
#7

pawn Код:
if (!strcmp("/gateclose", cmdtext, true))
    {
        if(IsPlayerInRangeOfPoint(playerid,5,2706.0078125, 652.048828125, 11.070308685303);
        {
            MoveObject(mygate,2706.0078125, 652.048828125, 11.070308685303,3.0);
            SendClientMessage(playerid,0xFFFF00FF,"You have just closed the Yard gate");
           
        }
        else
        {
            SendClientMessage(playerid,0xFF0000FF,"You are too far to open the gate");
            return 1;
        }
    }
there you go , thats for the /gateclose command do the same with the gate open one to
Reply
#8

Cale, my gate commands are working, i just want to reduce it to 1 command (i want 1 command that will open and close the gate)
Reply
#9

Like Voldemort said somthing like this.

pawn Код:
new gOpen;//top with other global variables
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/gateopen", cmdtext, true, 10) == 0)//change this command to gate?
    {
        if(gOpen == 1)
        {
            gOpen = 0;
            MoveObject(mygate,2706.0078125, 652.048828125, 11.070308685303,3.0);
            SendClientMessage(playerid,0xFFFF00FF,"You have just closed the Yard gate");
            return 1;
        }
        else
        {
            gOpen = 1;
            MoveObject(mygate,2705.8347167969, 657.30255126953, 11.070308685303,3.0);
            SendClientMessage(playerid,0xFFFF00FF,"You have just opened the Yard gate");
        }
    }
    return 0;
}
Reply
#10

ok Thanks guys it worked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)