SetPlayerAttachedObject
#1

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
Reply
#2

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

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
Reply
#4

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;
    }
Reply
#5

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)