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



EditPlayerAttachedObject - TaLhA XIV - 26.07.2012

Hello,
I wanted to ask that how can we make player edit his attached object,I know the command that is EditPlayerAttachedObject but I can't really use it as I am new at scripter.Please someone post a little code.And how to save that into a slot and playerfile.


Re: EditPlayerAttachedObject - [KHK]Khalid - 26.07.2012

It's EditAttachedObject and it's well-explained in the wiki page.

An example from the wiki with some comments:
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerAttachedObject(playerid, 0, 1337, 2); // second parameter (0) is the slot id that you will need in EditAttachedObject
}
 
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/edit", true))
    {
        EditAttachedObject(playerid, 0); // second parameter (0) is the slot we used in SetPlayerAttachedObject
        // so if you have used SetPlayerAttachedObject like this SetPlayerAttachedObject(playerid, 1, 1337, 2);
        // then your EditAttachedObject function should be like this EditAttachedObject(playerid, 1); to edit the attached object in the slot 1
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You now edit your attached object on index slot 0!");
        return 1;
    }
    return 0;
}