SA-MP Forums Archive
SetPlayerAttachedObject - 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: SetPlayerAttachedObject (/showthread.php?tid=397701)



SetPlayerAttachedObject - [CG]Milito - 06.12.2012

Hello!

My problem is with "SetPlayerAttachedObject" function, When I type /santahat, it gives you a santa hat -.-' but it just dissapear after 2 seconds. How can i avoid that? + how can i remove the hat with the same command ?(/santahat)

PHP код:
     if (strcmp("/santahat"cmdtexttrue10) == 0)
    {
        new 
pname[24];
        new 
string[128];
           
GetPlayerName(playerid,pname,sizeof(pname));
        
format(string,sizeof(string),"[_Christmas_] %s(%d) is wearing a sant hat! You can do it too by typing /santahat",pname,playerid);
        
SendClientMessageToAll(COLOR_CYAN,string);
        
SetPlayerAttachedObject(playerid31906520.1200000.040000, -0.00350001001001.41.41.4);
        return 
1;
    } 
Thanks in advance


Re: SetPlayerAttachedObject - DaRk_RaiN - 06.12.2012

Well if you make the object too close to his head it will disappear.
to remove his hat use this RemovePlayerAttachedObject.


Re: SetPlayerAttachedObject - [Ro]DuReX - 06.12.2012

A friend had the same problem. I've resolved his problem in Non-English section.
Remove " You can do it too by typing /santahat" from the string format.
I know it's weird, but do it.

If you can understand something, see this: https://sampforum.blast.hk/showthread.php?tid=394149


Re: SetPlayerAttachedObject - Horrible - 06.12.2012

if player type twice and for the second time it remove the attach object
pawn Код:
if (strcmp("/santahat", cmdtext, true, 10) == 0)
    {
        if(IsPlayerAttachedObjectSlotUsed(playerid, 3))
        {
            RemovePlayerAttachedObject(playerid, 3);
        }
        if(!IsPlayerAttachedObjectSlotUsed(playerid, 3))
        {
            new pname[24];
            new string[128];
            GetPlayerName(playerid,pname,sizeof(pname));
            format(string,sizeof(string),"[_Christmas_] %s(%d) is wearing a sant hat! You can do it too by typing /santahat",pname,playerid);
            SendClientMessageToAll(COLOR_CYAN,string);
            SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
        }
        return 1;
    }



Re: SetPlayerAttachedObject - Freak@ - 06.12.2012

Already had this problem, download the update below and include your includes and test.

http://www.4shared.com/file/ma_fad5b/IldeSamp.html