My gate is not complying, help?
#1

pawn Код:
new open = 0;
    if (strcmp("/", cmdtext, true,1) == 0)
    {
       
        if(IsPlayerInRangeOfPoint(playerid,15.0,-1701.44042969,687.58593750,24.65380096))
        {
            if(open == 1)
            {
                SetDynamicObjectRot(sfent,0.00000000,270.0,90.0);
                print("TEST ONE ONE");
                open = 0;
            }
            else
            {
                SetDynamicObjectRot(sfent,0.00000000,0.00000000,90.00000000);
                open = 1;
                print("TEST ONE");
            }
        }
    }

I want it so when i use the slash command that it will open the gate if open = 0, otherwis close it. It wont close, so can you please help me solve this issue?
Reply
#2

You cant have
pawn Код:
if (strcmp("/", cmdtext, true,1) == 0)
You must have atleast one character in the command.
Reply
#3

No, you dont. It works, just currently i cannot get it to "close" it "opens" just fine.
Reply
#4

Check your coordinates, the variables are looking good to me.
If it opens as you say it is, then the variable turns into 1 and then it should close it.
Reply
#5

try
pawn Код:
else if(open == 1)
instead of
pawn Код:
else
Reply
#6

Where are you defining "open" Because if you're doing it inside OnPlayerCommandText (or w/e the callback is) "open" will be set to 0 ever time you run a command.

Define it at the top of your script.
Reply
#7

Quote:
Originally Posted by PrawkC
Посмотреть сообщение
Where are you defining "open" Because if you're doing it inside OnPlayerCommandText (or w/e the callback is) "open" will be set to 0 ever time you run a command.

Define it at the top of your script.
Thank you, i just figured that out once i posted this topic lol.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)