SA-MP Forums Archive
MoveDynamicObject - I fail - 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: MoveDynamicObject - I fail (/showthread.php?tid=324281)



MoveDynamicObject - I fail - Riddy - 08.03.2012

pawn Код:
if(strcmp(cmdtext, "/dooropen", true) == 0) {
        if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pMember] == 14 || AdminDuty[playerid]==1) {
            if (PlayerToPoint(2, playerid,1550.80004883, -1691.59997559, 1722.09997559, 5.0)) {
                MoveDynamicObject(lspddoor1, 1535.80004883, -1691.59997559, 1722.09997559, 5.0);
                SendClientMessage(playerid, COLOR_BLUE,"You have opened the lobby door, please close it");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GiveNameSpace(sendername);
                format(string, sizeof(string), "* %s takes his/her remote control and opens the door.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else if (PlayerToPoint(2, playerid, 1559.50000000, -1677.80004883, 1722.09997559, 5.0)) {
                MoveDynamicObject(lspddoor2, 1544.50000000, -1677.80004883, 1722.09997559, 5.0);
                SendClientMessage(playerid, COLOR_BLUE,"LSPD door is open, please close it!");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GiveNameSpace(sendername);
                format(string, sizeof(string), "* %s takes his/her remote control and opens the door.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else if (PlayerToPoint(2, playerid, 1555.39941406, -1710.69921875, 1724.80004883, 5.0)) {
                MoveDynamicObject(lspddoor3, 1540.39941406, -1710.69921875, 1724.80004883, 5.0);
                SendClientMessage(playerid, COLOR_BLUE,"LSPD door is open, please close it!");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GiveNameSpace(sendername);
                format(string, sizeof(string), "* %s takes his/her remote control and opens the door.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else if (PlayerToPoint(2, playerid, 1560.69995117, -1714.00000000, 1724.80004883, 5.0)) {
                SetDynamicObjectRot(lspddoor4, 1555.69995117, -1714.00000000, 1724.80004883, 5.0);
                SendClientMessage(playerid, COLOR_BLUE,"LSPD door is open, please close it!");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GiveNameSpace(sendername);
                format(string, sizeof(string), "* %s takes his/her remote control and opens the door.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else {
                SendClientMessage(playerid, COLOR_GREY,"Destination is too far.");
            }
        }
        return 1;
    }

    if(strcmp(cmdtext, "/doorclose", true) == 0) {
        if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3|| PlayerInfo[playerid][pMember] == 14 || AdminDuty[playerid]==1) {
            if (PlayerToPoint(3, playerid, 1550.80004883, -1691.59997559, 1722.09997559, 0)) {
                MoveDynamicObject(lspddoor1, 1550.80004883, -1691.59997559, 1722.09997559, 0);
                SendClientMessage(playerid, COLOR_BLUE,"LSPD door is closed, thank you!");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GiveNameSpace(sendername);
                format(string, sizeof(string), "* %s takes his/her remote control and closes the door.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else if (PlayerToPoint(3, playerid, 1559.50000000, -1677.80004883, 1722.09997559, 0)) {
                MoveDynamicObject(lspddoor2, 1559.50000000, -1677.80004883, 1722.09997559, 0);
                SendClientMessage(playerid, COLOR_BLUE,"LSPD door is closed, thank you!");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GiveNameSpace(sendername);
                format(string, sizeof(string), "* %s takes his/her remote control and closes the door.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else if (PlayerToPoint(3, playerid, 1555.39941406, -1710.69921875, 1724.80004883, 0)) {
                MoveDynamicObject(lspddoor3, 1555.39941406, -1710.69921875, 1724.80004883, 0);
                SendClientMessage(playerid, COLOR_BLUE,"LSPD door is closed, thank you!");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GiveNameSpace(sendername);
                format(string, sizeof(string), "* %s takes his/her remote control and closes the door.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else if (PlayerToPoint(3, playerid, 1562.40002441, -1660.19995117, 1729.09997559, 0)) {
                 MoveDynamicObject(lspddoor4, 1562.40002441, -1660.19995117, 1729.09997559, 0);
                 GetPlayerName(playerid, sendername, sizeof(sendername));
                GiveNameSpace(sendername);
                format(string, sizeof(string), "* %s takes his/her remote control and closes the door.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else {
                SendClientMessage(playerid, COLOR_GREY,"Destination is too far.");
            }
        }
        return 1;
    }
This is what I get with that code

C:\Users\Rehab1\Documents\Name Roleplay\gamemodes\HE-RP.pwn(28082) : warning 202: number of arguments does not match definition
C:\Users\Rehab1\Documents\Name Roleplay\gamemodes\HE-RP.pwn(28090) : warning 202: number of arguments does not match definition
C:\Users\Rehab1\Documents\Name Roleplay\gamemodes\HE-RP.pwn(2809 : warning 202: number of arguments does not match definition
C:\Users\Rehab1\Documents\Name Roleplay\gamemodes\HE-RP.pwn(28123) : warning 202: number of arguments does not match definition
C:\Users\Rehab1\Documents\Name Roleplay\gamemodes\HE-RP.pwn(28131) : warning 202: number of arguments does not match definition
C:\Users\Rehab1\Documents\Name Roleplay\gamemodes\HE-RP.pwn(28139) : warning 202: number of arguments does not match definition
C:\Users\Rehab1\Documents\Name Roleplay\gamemodes\HE-RP.pwn(28147) : warning 202: number of arguments does not match definition


Re: MoveDynamicObject - I fail - Shabi RoxX - 08.03.2012

Which streamer u r using?

Try this
pawn Код:
MoveDynamicObject( objectid, Float:X,
Float:Y, Float:Z, Float:Speed, Float:RotX =
-1000.0, Float:RotY = -1000.0, Float:RotZ =
-1000.0 )



Re: MoveDynamicObject - I fail - Vince - 08.03.2012

Код:
PlayerToPoint
Sigh. https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint


Re: MoveDynamicObject - I fail - Riddy - 09.03.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
This isnt neccessary, I already know about that function but, Just dont use it


Re: MoveDynamicObject - I fail - Vince - 09.03.2012

I'm pretty sure you DO need it, as it looks like you've defined the range twice in every call to your PlayerToPoint function. Then again, why would you use a slower function if a native one is available?


Re: MoveDynamicObject - I fail - Riddy - 09.03.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
I'm pretty sure you DO need it, as it looks like you've defined the range twice in every call to your PlayerToPoint function. Then again, why would you use a slower function if a native one is available?
It does help as its faster, but, I dunno, I dont bother, I may do it though