SA-MP Forums Archive
Object Not Attaching? - 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: Object Not Attaching? (/showthread.php?tid=263122)



Object Not Attaching To Player [Please Help]? - Tommy_Mandaz - 20.06.2011

pawn Код:
CMD:roadcone(playerid, params[])
{
    new string[128], sendername[MAX_PLAYER_NAME];
    new oldcar = gLastCar[playerid];
    new model = GetVehicleModel(oldcar);
    if(gPlayerInfo[playerid][pFaction] == 1)
    {
        if(model == 413)
        {
            if(!IsPlayerInAnyVehicle(playerid))
            {
                if(ItemHolding[playerid] == 0)
                {
                    new Float:tx,Float:ty,Float:tz;
                    GetVehiclePos(oldcar, tx, ty, tz);
                    if(IsPlayerInRangeOfPoint(playerid, 10, tx, ty, tz))
                    {
                        ItemHolding[playerid] = 1;
                        TrafficCone[playerid] = CreateObject(1210,0,0,0,0,0,0,0);
                        SetPlayerAttachedObject(playerid,5,1210,6,0.271233, 0.078992, 0.041259, 0.349204, 260.329711, 358.628845,0.0,1);
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        Fmsg("%s opens the back of the truck and takes out a traffic cone", sendername);
                        SLM(playerid, string, 15, COLOR_PURPLE, COLOR_PURPLE);
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_RED, "You are not near the truck!");
                    }
                }
                else
                {
                    ItemHolding[playerid] = 0;
                    DestroyObject(TrafficCone[playerid]);
                    RemovePlayerAttachedObject(playerid, 5);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    Fmsg("%s opens the back of the truck and puts a traffic cone inside", sendername);
                    SLM(playerid, string, 15, COLOR_PURPLE, COLOR_PURPLE);
                    return 1;
                }
            }
        }
    }
    return 1;
}
The command works fine and I get the action in purple saying the person took out the cone and put it back in, but I can't get the actual cone to show... Not sure why, someone help?


Re: Object Not Attaching? - Tommy_Mandaz - 20.06.2011

Anyone please? I just need to get this working to move on with my scripting, thanks!