SA-MP Forums Archive
AttachObjectToVehicle - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: AttachObjectToVehicle (/showthread.php?tid=278864)



AttachObjectToVehicle - Dragony92 - 24.08.2011

GameMod Using: Ravens RP (Fully edited by me)

This command dont want to attach object on vehicle....just send message and nothing else....

This is part of this FS http://forum.sa-mp.com/showthread.ph...highlight=neon
FS also dont want to work on my server....
I'm running server on 0.3c R5 (Linux) with plugins streamer(last update, by Incognito) and sscanf(last update), FS junkbuster(v10), that's all...

On my home server everything works fine, on windows with same plugins and FS....
pawn Code:
if(strcmp(cmd, "/undercover", true) == 0)
    {
        if(IsACop(playerid) || IsAFreecop(playerid))
        {
            SetPVarInt(playerid, "undercover", CreateDynamicObject(18646,0,0,0,0,0,0));
            SetPVarInt(playerid, "undercover1", CreateDynamicObject(18646,0,0,0,0,0,0));
            AttachObjectToVehicle(GetPVarInt(playerid, "undercover"), GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
            AttachObjectToVehicle(GetPVarInt(playerid, "undercover1"), GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
            SendClientMessage(playerid, 0xFFFFFFAA, "You have Attched Undercover light on your vehicle!");
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "**You are not a Cop!");
        }
        return 1;
    }



Re: AttachObjectToVehicle - Wesley221 - 24.08.2011

pawn Code:
new UnderCoverobj[3];
UnderCoverobj[0] = CreateDynamicObject(18646,0,0,0,0,0,0);
UnderCoverObj[1] = CreateDynamicObject(18646,0,0,0,0,0,0);
AttachObjectToVehicle(UnderCoverobj[0], GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
AttachObjectToVehicle(UnderCoverobj[1], GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
You have to create the object before you can attach it. And i dont think this can be done through PVars.


Re: AttachObjectToVehicle - Gh0sT_ - 24.08.2011

You can't attach dynamic object, you must use CreateObject


Re: AttachObjectToVehicle - Dragony92 - 24.08.2011

Nothing...i tryed with normal objects (CreateObject)....


Re: AttachObjectToVehicle - Wesley221 - 24.08.2011

Try it the way like i said b4. Just add the pieces to your code, and remove the createobjects in the pvars


Re: AttachObjectToVehicle - Dragony92 - 24.08.2011

Same...
pawn Code:
if(strcmp(cmd, "/undercover", true) == 0)
    {
        if(IsACop(playerid) || IsAFreecop(playerid))
        {
            new UnderCoverobj[3];
            UnderCoverobj[0] = CreateObject(18646,0,0,0,0,0,0);
            UnderCoverobj[1] = CreateObject(18646,0,0,0,0,0,0);
            AttachObjectToVehicle(UnderCoverobj[0], GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
            AttachObjectToVehicle(UnderCoverobj[1], GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
            SendClientMessage(playerid, 0xFFFFFFAA, "You have Attched Undercover light on your vehicle!");
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "**You are not a Cop!");
        }
        return 1;
    }
Edit; Object is creted on coordinates 0 0 0 but not attached...


Re: AttachObjectToVehicle - Wesley221 - 24.08.2011

Are you sure you got the right coцrds of the neon?


Re: AttachObjectToVehicle - Dragony92 - 24.08.2011

Object is creted on coordinates 0 0 0 but not attached to vehicle...
Yeah because i paste it from working FS http://forum.sa-mp.com/showthread.ph...highlight=neon
Edit: It works on windows server but not on Linux...