LSPD Gate Barrier | MoveObject
#1

I'm trying to make a simple moving gate object, the barrier of the LSPD, After doing some coding,
besides moving up and down he moves one time up, then down left then he just switching Z, everytime im doing the command again /gate.

Код:
new pdbarriergateobj;  //pdgate barrier object
Код:
new pdgatebar = 0;
Код:
pdbarriergateobj = CreateDynamicObject(968, 1544.681640625, -1630.8924560547, 13.3, 180, 90, 90);
here's the script can you tell what's wrong? :

Код:
		else if(IsPlayerInRangeOfPoint(playerid,9,1544.4913,-1627.2817,13.3828))
		{ //POLICE BAR
		if(!IsACop(playerid) || IsAnAgent(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a member of the LSPD / SASD / FBI !");
    		if(pdgatebar==0)
    		{
     		pdgatebar = 1;
       		MoveDynamicObject(pdbarriergateobj, 1544.681640625, -1630.8924560547, 13.3, 180, 180, 90, 1.5);
       		format(string, sizeof(string), "* %s Pushes the button on their remote to Open/Close the gate.", sendername);
                return 1;
       		}
	    	else if(pdgatebar==1)
		{
		pdgatebar = 0;
                MoveDynamicObject(pdbarriergateobj, 1544.681640625, -1630.8924560547, 13.3, 180, 90, 90, 1.5);
            	format(string, sizeof(string), "* %s Pushes the button on their remote to Open/Close the gate.", sendername);
                return 1;
		}
	}
either this doesn't work.. there is no errors, just a few warnings about 'number of arguments does not match definition' if i'm doing SetObjectRot, which isn't working well like the MoveObject.

Код:
    if(newstate & KEY_CROUCH && !(oldstate & KEY_CROUCH)) //horn gates
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            if(PlayerToPoint(playerid,9,1544.4913,-1627.2817,13.3828))  //near barrier
            {
                if(!IsACop(playerid) || IsAnAgent(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a member of the LSPD / SASD / FBI !");
                {
                    if(pdgatebar == 0)
                    {
                        pdgatebar = 1;
		        MoveDynamicObject(pdbarriergateobj, 1544.681640625, -1630.8924560547, 13.3, 180, 180, 90, 1.5);
			format(string, sizeof(string), "* %s Pushes the button on their remote to Open/Close the gate.", sendername);
                        return 1;
                    }
                    else if(pdgatebar==1)
                    {
                        pdgatebar = 0;
		        MoveDynamicObject(pdbarriergateobj, 1544.681640625, -1630.8924560547, 13.3, 180, 90, 90, 1.5);
                        format(string, sizeof(string), "* %s Pushes the button on their remote to Open/Close the gate.", sendername);
                        return 1;
                    }
                }
            }
        }
    }
Reply
#2

You put speed on last player, but it should be before x,y,z like MoveDynamicObject(object, x,y,z,speed,rotx,roty,rotz);
Reply
#3

I've changed this:
Код:
MoveObject(pdbarriergateobj, 1544.681640625, -1630.8924560547, 13.3, 180, 180, 90, 1.5);
To this:
Код:
MoveObject(pdbarriergateobj, 1544.681640625, -1630.8924560547, 13.3, 1.5, 180, 180, 90);
As you told me to do and now the gate doesn't opening when /gate or horn.


EDIT: I've changed the MoveObject to MoveDynamicObject and the gate is opening but not slowly with speed.
And when i horn, the gate doesn't open.
Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) //Detecting keys
Reply
#4

*BUMP* Please someone help me I really want this gate to work properly :/
Reply
#5

Dynamic objects must be moved with their corresponding function, MoveDynamicObject.
Reply
#6

Код:
MoveDynamicObject(pdbarriergateobj, 1544.681640625, -1630.8924560547, 13.3, 1.5, 180, 180, 90);
THIS OPEN^

Код:
MoveDynamicObject(pdbarriergateobj, 1544.681640625, -1630.8924560547, 13.3, 1.5, 180, 90, 90);
THIS CLOSE^

MoveDynamicObject(object, x,y,z,speed,rotx,roty,rotz);
But it opens immediately without speed, so what's the problem?^
Reply
#7

*BUMP*
Reply
#8

pawn Код:
MoveDynamicObject(pdbarriergateobj, 1544.681640625, -1630.8924560547, 13.3, 180, 90, 90, 1.5); //object, x,y,z,rotz,roty,rotz,speed
Try this.
Reply
#9

Nvm, I fixed the problem, thanks anyways !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)