SA-MP Forums Archive
[HELP] /gate - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] /gate (/showthread.php?tid=598673)



[HELP] /gate - BornHuman - 15.01.2016

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!


Re: [HELP] /gate - d1git - 15.01.2016

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]);



Re: [HELP] /gate - BornHuman - 15.01.2016

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


Re: [HELP] /gate - Sk1lleD - 15.01.2016

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