SA-MP Forums Archive
Attaching object ti player problem - 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: Attaching object ti player problem (/showthread.php?tid=348480)



Attaching object ti player problem - calin1996 - 05.06.2012

I have:
pawn Код:
new Nume1[25];
                                GetPlayerName(playerid, Nume1, sizeof(Nume1));
                                BancomatRob[playerid] = 1;
                                BancomatRobTime[playerid] = 30;
                                BancomatRobbed = 1;
                                new randtax = 10000 + random(15000);
                                SafeGivePlayerMoney(playerid, randtax);
                                SetPlayerHoldingObject(playerid, 1550, 1, 0.030669, -0.200303, -0.021784, 0.000000, 89.592170, 147.024810, 1.000000, 1.000000, 1.000000);
                                SetPlayerAttachedObject( playerid, 9, 1550, 1, 0.030669, -0.200303, -0.021784, 0.000000, 89.592170, 147.024810, 1.000000, 1.000000, 1.000000 );
                                WantedLevel[playerid] = 10;
                                PlayerInfo[playerid][pSuspect] = 10;
                                TogglePlayerControllable(playerid, 0);
                                format(string, sizeof(string), "Ai tras cateva gloante in Bancomat si ai nimerit balamalele.", randtax);
                                format(string, sizeof(string), "Ai spart Bancomatul cu succes, %d RON. Cand ai vazut banii ai incremenit (Ai fost blocat 30 secunde)", randtax);
                                SendClientMessage(playerid, COLOR_GREEN, string);
                                SetTimer("ResetRobTimer", 3600000, false);
These lines are from my /robatm command, if i succeed it, the player should have attached on his back a sack of money, i've tried:
pawn Код:
SetPlayerHoldingObject(playerid, 1550, 1, 0.030669, -0.200303, -0.021784, 0.000000, 89.592170, 147.024810, 1.000000, 1.000000, 1.000000);
And
pawn Код:
SetPlayerAttachedObject( playerid, 9, 1550, 1, 0.030669, -0.200303, -0.021784, 0.000000, 89.592170, 147.024810, 1.000000, 1.000000, 1.000000);
But nothing happen, there is no object on player. A little help?


Re: Attaching object ti player problem - calin1996 - 05.06.2012

Someone??


Re: Attaching object ti player problem - calin1996 - 05.06.2012

pawn Код:
if(strcmp(cmd, "/robbancomat", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(BancomatRobbed == 1)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "Bancomatul a fost jefuit acum 2 ore si este paza prea mare pentru un jaf.");
                return 1;
            }
            if(PlayerToPoint(2, playerid,x,y,z)))
            {
                if (IsPlayerConnected(playerid))
                {
                    if(GetPlayerWeapon(playerid) == 22 || GetPlayerWeapon(playerid) == 23 || GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 25  || GetPlayerWeapon(playerid) == 29  || GetPlayerWeapon(playerid) == 30  || GetPlayerWeapon(playerid) == 31 )
                    {
                        new rand = random(2);
                        switch(rand)
                        {
                            case 0:
                            {
                                new Nume1[25];
                                GetPlayerName(playerid, Nume1, sizeof(Nume1));
                                BancomatRob[playerid] = 1;
                                BancomatRobTime[playerid] = 30;
                                BancomatRobbed = 1;
                                WantedLevel[playerid] = 10;
                                PlayerInfo[playerid][pSuspect] = 10;
                                TogglePlayerControllable(playerid, 0);
                                SendClientMessage(playerid, COLOR_RED, "Ai esuat in spargerea bancomatului. (Ati fost blocat 30 secunde)");
                                for(new i = 0; i < MAX_PLAYERS; i++)
                                {
                                    if(IsPlayerConnected(i))
                                    {
                                        if(IsACop(i))
                                        {
                                            new anuntpd[255];
                                            format(anuntpd, sizeof(anuntpd), "DISPECER: Toate unitatile, %s este suspectat de spargerea unui Bancomat",Nume1);
                                            SendClientMessage(i, TEAM_BLUE_COLOR, anuntpd);
                                        }
                                    }
                                }
                            }
                            case 1:
                            {
                                SetPlayerHoldingObject(playerid, 1550, 1, 0.030669, -0.200303, -0.021784, 0.000000, 89.592170, 147.024810, 1.000000, 1.000000, 1.000000);
                                SetPlayerAttachedObject( playerid, 9, 1550, 1, 0.030669, -0.200303, -0.021784, 0.000000, 89.592170, 147.024810, 1.000000, 1.000000, 1.000000 );
                                new Nume1[25];
                                GetPlayerName(playerid, Nume1, sizeof(Nume1));
                                BancomatRob[playerid] = 1;
                                BancomatRobTime[playerid] = 30;
                                BancomatRobbed = 1;
                                new randtax = 10000 + random(15000);
                                SafeGivePlayerMoney(playerid, randtax);
                                WantedLevel[playerid] = 10;
                                PlayerInfo[playerid][pSuspect] = 10;
                                TogglePlayerControllable(playerid, 0);
                                format(string, sizeof(string), "Ai tras cateva gloante in Bancomat si ai nimerit balamalele.", randtax);
                                format(string, sizeof(string), "Ai spart Bancomatul cu succes, %d RON. Cand ai vazut banii ai incremenit (Ai fost blocat 30 secunde)", randtax);
                                SendClientMessage(playerid, COLOR_GREEN, string);
                                SetTimer("ResetRobTimer", 3600000, false);
                                for(new i = 0; i < MAX_PLAYERS; i++)
                                {
                                    if(IsPlayerConnected(i))
                                    {
                                        if(IsACop(i))
                                        {
                                            new anuntpd[255];
                                            format(anuntpd, sizeof(anuntpd), "DISPECER: Toate unitatile, %s este suspectat de spargerea unui Bancomat",Nume1);
                                            SendClientMessage(i, TEAM_BLUE_COLOR, anuntpd);
                                            return 1;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "   Armele detinute nu corespund jafului. (Doar arme de foc!)");
                        return 1;
                    }
                }
                else
                {
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Nu esti langa un bancomat!");
                return 1;
            }
        }
        return 1;
    }
There is the entire command,but idk why the attached object is not shown


Re: Attaching object ti player problem - calin1996 - 06.06.2012

Wtf someone??I need help?Why the object is not appearing?


Re: Attaching object ti player problem - Sandiel - 06.06.2012

I don't see the line where you attach the object to the player?
Post it here please.
Also, mind telling us what does the command do in the first place?