2 commands at one?!?
#1

Hi.
I want to open/close a gate with ONE command, how it's possible?
This is cmd what open gate.
Код:
    
if (strcmp("/vдrav", cmdtext, true, 10) == 0)
{
GetPlayerName(playerid,pName,64);
if(!strcmp(pName,"Steven_Hayen2",true))
{
MoveObject(gate, 321.35000000,-1188.19000000,70.52000000,1.00000000)
}
return 1;
}
This is cmd what close the gate.
Код:
if (strcmp("/vдravc", cmdtext, true, 10) == 0)
{
GetPlayerName(playerid,pName,64);
if(!strcmp(pName,"Steven_Hayen2",true))
{
MoveObject(gate, 321.35000000,-1188.19000000,75.35000000,2.00000000)
}
return 1;
}
Can anybody help me?
Reply
#2

Код:
if (strcmp("/vдrav", cmdtext, true, 10) == 0)
{
GetPlayerName(playerid,pName,64);
if(!strcmp(pName,"Steven_Hayen2",true))
{
MoveObject(gate, 321.35000000,-1188.19000000,70.52000000,1.00000000)
SetTimer("CloseGate", 8000, 0);//we set the timer to run the function CloseGate in 8 seconds
}
return 1;
}


public CloseGate()
{
      MoveDynamicObject(gate, 321.35000000,-1188.19000000,75.35000000,2.00000000);
	  return 1;
}
dont forget to forward the function

Код:
forward CloseGate();
btw next time there are tons of tutorials use search
Reply
#3

pawn Код:
new bool:GateOpen;

if ( !strcmp("/vдrav", cmdtext, true ))
{
    GetPlayerName(playerid,pName,64);
    if( GateOpen )
    {
        if(!strcmp(pName,"Steven_Hayen2",true))
        {
            MoveObject(gate, 321.35000000,-1188.19000000,75.35000000,2.00000000);
            GateOpen = false;
        }
    }
    else
    {
        if(!strcmp(pName,"Steven_Hayen2",true))
        {
            MoveObject(gate, 321.35000000,-1188.19000000,70.52000000,1.00000000);
            GateOpen = true;
        }
    }
    return 1;
}
Or use the code posted by ronnie3148 for auto close.
Reply
#4

Big big thanks to you!
Reply
#5

To iggy1: When i type this command /vдrav then gates goes down, but if i'm entering this cmd again, gate won't come up.. what's wrong?
Reply
#6

just use mine it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)