SA-MP Forums Archive
PD Door not opening and closing right... - 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: PD Door not opening and closing right... (/showthread.php?tid=388439)



PD Door not opening and closing right... - jakejohnsonusa - 28.10.2012

My police door does not open and close right... Like the door faces the wrong direction (see picture). Whats wrong in my script... this is what I have:

Код:
			else if(IsPlayerInRangeOfPoint(playerid, 2,246.228,72.4962,1003.04))
			{
			    if(lspd2 == 0)
			    {
		      		MoveDynamicObject(lspddoor2, 246.228,72.4962,1000.63, 4.5000);
		      		SendClientMessage(playerid, COLOR_BLUE,"SAPD door is open, please close it!");
		      		GetPlayerName(playerid, sendername, sizeof(sendername));
		      		format(string, sizeof(string), "* %s takes his/her remote control and opens the door.", sendername);
		      		ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
		      		lspd2 = 1;
				}
	      		else
				{
				    MoveDynamicObject(lspddoor2, 246.228,72.4962,1003.04, 4.5000);
		      		SendClientMessage(playerid, COLOR_BLUE,"SAPD Control door is closed, thank you!");
		      		GetPlayerName(playerid, sendername, sizeof(sendername));
		      		format(string, sizeof(string), "* %s takes his/her remote control and Closes the door.", sendername);
		      		ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
		      		lspd2 = 0;
				}
			}
http://i.imgur.com/ninfn.jpg


Re: PD Door not opening and closing right... - ryansheilds - 28.10.2012

The coordinates changed in 0.3e, the code is based on 0.3d (I think). Update the "MoveDynamicObject" code based on:
pawn Код:
native MoveDynamicObject(objectid, Float:x, Float:y, Float:z, Float:speed, Float:rx = -1000.0, Float:ry = -1000.0, Float:rz = -1000.0);



Re: PD Door not opening and closing right... - jakejohnsonusa - 28.10.2012

Wait so what exactly should I replace MoveDynamicObject(lspddoor2, 246.228,72.4962,1000.63, 4.5000);
with?


Re: PD Door not opening and closing right... - ryansheilds - 28.10.2012

Uhhh. Try this.
pawn Код:
else if(IsPlayerInRangeOfPoint(playerid, 2,246.228,72.4962,1003.04))
            {
                if(lspd2 == 0)
                {
                    MoveDynamicObject(lspddoor2, 246.228,72.4962,1000.63, 4.5000, 0.0, 0.0, 90.0);
                    SendClientMessage(playerid, COLOR_BLUE,"SAPD door is open, please close it!");
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "* %s takes his/her remote control and opens the door.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                    lspd2 = 1;
                }
                else
                {
                    MoveDynamicObject(lspddoor2, 246.228,72.4962,1003.04, 4.5000, 0.0, 0.0, 90.0);
                    SendClientMessage(playerid, COLOR_BLUE,"SAPD Control door is closed, thank you!");
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "* %s takes his/her remote control and Closes the door.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                    lspd2 = 0;
                }
            }



Re: PD Door not opening and closing right... - jakejohnsonusa - 28.10.2012

Thanks will try... +1 REP both of you guys


Re: PD Door not opening and closing right... - jakejohnsonusa - 28.10.2012

With
Код:
 MoveDynamicObject(lspddoor2, 246.228,72.4962,1000.63, 4.5000, 0.0, 0.0, 90.0);
the door doesn't work at all... What should I put?


Re: PD Door not opening and closing right... - jakejohnsonusa - 28.10.2012

Anyone know?


Re: PD Door not opening and closing right... - ryansheilds - 28.10.2012

Hmm, try using:
pawn Код:
SetDynamicObjectPos(objectid, Float:x, Float:y, Float:z);
So:
pawn Код:
else if(IsPlayerInRangeOfPoint(playerid, 2,246.228,72.4962,1003.04))
            {
                if(lspd2 == 0)
                {
                    SetDynamicObjectPos(lspddoor2, 246.228,72.4962,1000.63);
                    SendClientMessage(playerid, COLOR_BLUE,"SAPD door is open, please close it!");
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "* %s takes his/her remote control and opens the door.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                    lspd2 = 1;
                }
                else
                {
                    SetDynamicObjectPos(lspddoor2, 246.228,72.4962,1003.04);
                    SendClientMessage(playerid, COLOR_BLUE,"SAPD Control door is closed, thank you!");
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "* %s takes his/her remote control and Closes the door.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                    lspd2 = 0;
                }
            }
Also avoid bumping the topic so early.