SA-MP Forums Archive
LSPD Gate Barrier | MoveObject - 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: LSPD Gate Barrier | MoveObject (/showthread.php?tid=448447)



LSPD Gate Barrier | MoveObject - maxpain43 - 04.07.2013

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;
                    }
                }
            }
        }
    }



Re: LSPD Gate Barrier | MoveObject - feartonyb - 04.07.2013

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


Re: LSPD Gate Barrier | MoveObject - maxpain43 - 04.07.2013

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



Re: LSPD Gate Barrier | MoveObject - maxpain43 - 05.07.2013

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


Re: LSPD Gate Barrier | MoveObject - Vince - 05.07.2013

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


Re: LSPD Gate Barrier | MoveObject - maxpain43 - 05.07.2013

Код:
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?^


Re: LSPD Gate Barrier | MoveObject - maxpain43 - 06.07.2013

*BUMP*


Re: LSPD Gate Barrier | MoveObject - nickyW - 06.07.2013

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


Re: LSPD Gate Barrier | MoveObject - maxpain43 - 06.07.2013

Nvm, I fixed the problem, thanks anyways !