[HELP] /gate
#1

So, I've almost got this blasted dynamic gate system working, but there's an issue.

PHP код:
command(gateplayeridparams[])
{
    new 
string[128];
    for(new 
0MAX_GATESi++)
    {
        if(
IsPlayerInRangeOfPoint(playeridGates[i][GateRange], Gates[i][GateX], Gates[i][GateY], Gates[i][GateZ]))
        {
            print(
"0");
            if(
Gates[i][UseF] >= 1) return 1;
            print(
"1");
            
            if(
Gates[i][GateStatus] == 0)
            {
                print(
"2");
                
MoveDynamicObject(Gates[i][GateID], Gates[i][GateXM], Gates[i][GateYM], Gates[i][GateZM], Gates[i][GateSpeed], Gates[i][GateRXM], Gates[i][GateRYM], Gates[i][GateRZM]);
                
Gates[i][GateStatus] = 1;
                
                
format(stringsizeof(string), "%s uses their remote to open the gates."GetName(playerid));
                
SetPlayerChatBubble(playeridstringPURPLE15.05000);
            }
            else if(
Gates[i][GateStatus] == 1)
            {
                print(
"3");
                
MoveDynamicObject(Gates[i][GateID], Gates[i][GateX], Gates[i][GateY], Gates[i][GateZ], Gates[i][GateSpeed], Gates[i][GateRX], Gates[i][GateRY], Gates[i][GateRZ]);
                 
Gates[i][GateStatus] = 0;
                
                
format(stringsizeof(string), "%s uses their remote to close the gates."GetName(playerid));
                
SetPlayerChatBubble(playeridstringPURPLE15.05000);
            }
            else
            {
                return 
1;
            }
        }
    }
    return 
1;

The gate will not move, however every print will show up for some odd reason. I'm not exactly sure why that is, but I will REP+++++ you if you can figure this out. Thanks!
Reply
#2

It's because of the fact that you're not actually moving it downwards, or setting the Z position lower than the original position.

Код:
MoveDynamicObject(Gates[i][GateID], Gates[i][GateXM], Gates[i][GateYM], Gates[i][GateZM]-5, Gates[i][GateSpeed], Gates[i][GateRXM], Gates[i][GateRYM], Gates[i][GateRZM]);
Reply
#3

Quote:
Originally Posted by d1git
Посмотреть сообщение
It's because of the fact that you're not actually moving it downwards, or setting the Z position lower than the original position.

Код:
MoveDynamicObject(Gates[i][GateID], Gates[i][GateXM], Gates[i][GateYM], Gates[i][GateZM]-5, Gates[i][GateSpeed], Gates[i][GateRXM], Gates[i][GateRYM], Gates[i][GateRZM]);
GateX = Gate's original position. GateXM = Gate's move position. When they do /gate I want it to move to that position. From GateX to GateXM
Reply
#4

Debug those positions and make sure they haven't the same values
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)