Quero que essa [FS] salve e carregue os objetos em cada slot que o mбximo e 9, e quando digitar /Acessorios vai estar a lista de obejetos salvos
Код:
#include <a_samp>
#include <mSelection>
#define DIALOG_ATTACH_INDEX 13500
#define DIALOG_ATTACH_INDEX_SELECTION DIALOG_ATTACH_INDEX+1
#define DIALOG_ATTACH_EDITREPLACE DIALOG_ATTACH_INDEX+2
#define DIALOG_ATTACH_MODEL_SELECTION DIALOG_ATTACH_INDEX+3
#define DIALOG_ATTACH_BONE_SELECTION DIALOG_ATTACH_INDEX+4
new AttachmentObjects[MAX_PLAYERS];
new AttachmentBones[][24] =
{
{"Coluna"},
{"Cabeзa"},
{"Braзo esquerdo"},
{"Braзo direito"},
{"Mгo esquerda"},
{"Mгo direita"},
{"Coxa esquerda"},
{"Coxa direita"},
{"Pй esquerdo"},
{"Pй direito"},
{"Panturrilha direita"},
{"Panturrilha esquerda"},
{"Antebraзo esquerdo"},
{"Antebraзo direito"},
{"Clavнcula esquerda"},
{"Clavнcula direita"},
{"Pescoзo"},
{"Mandнbula"}
};
new Acessorios = mS_INVALID_LISTID;
public OnFilterScriptInit()
{
Acessorios = LoadModelSelectionMenu("Acessorios.txt");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/ace", true))
{
new string[128];
for(new x;x<MAX_PLAYER_ATTACHED_OBJECTS;x++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, x)) format(string, sizeof(string), "%s%d (Used)\n", string, x);
else format(string, sizeof(string), "%s%d\n", string, x);
}
ShowPlayerDialog(playerid, DIALOG_ATTACH_INDEX_SELECTION, DIALOG_STYLE_LIST, \
"{FF0000}Attachment Modification - Index Selection", string, "Select", "Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_ATTACH_INDEX_SELECTION)
{
if(response)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, listitem))
{
ShowPlayerDialog(playerid, DIALOG_ATTACH_EDITREPLACE, DIALOG_STYLE_MSGBOX, \
"{FF0000}Attachment Modification", "Do you wish to edit the attachment in that slot, or delete it?", "Edit", "Delete");
}
else
{
ShowModelSelectionMenu(playerid, Acessorios, "BCL");
}
SetPVarInt(playerid, "AttachmentIndexSel", listitem);
}
return 1;
}
if(dialogid == DIALOG_ATTACH_EDITREPLACE)
{
if(response) EditAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
else RemovePlayerAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
DeletePVar(playerid, "AttachmentIndexSel");
return 1;
}
if(dialogid == DIALOG_ATTACH_BONE_SELECTION)
{
if(response)
{
SetPlayerAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"), GetPVarInt(playerid, "AttachmentModelSel"), listitem+1);
EditAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
SendClientMessage(playerid, 0xFFFFFFFF, "Hint: Use {FFFF00}~k~~PED_SPRINT~{FFFFFF} to look around.");
}
DeletePVar(playerid, "AttachmentIndexSel");
DeletePVar(playerid, "AttachmentModelSel");
}
return 1;
}
public OnPlayerEditAttachedObject( playerid, response, index, modelid, boneid,
Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ,
Float:fRotX, Float:fRotY, Float:fRotZ,
Float:fScaleX, Float:fScaleY, Float:fScaleZ )
{
SetPlayerAttachedObject(playerid,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
SendClientMessage(playerid, 0xFFFFFFFF, "You finished editing an attached object");
return 1;
}
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
if(listid == Acessorios)
{
if(response)
{
if(GetPVarInt(playerid, "AttachmentUsed") == 1) EditAttachedObject(playerid, modelid);
else
{
SetPVarInt(playerid, "AttachmentModelSel", AttachmentObjects[listid]);
SetPVarInt(playerid, "AttachmentModelSel", modelid);
new string[256+1];
for(new x;x<sizeof(AttachmentBones);x++)
{
format(string, sizeof(string), "%s%s\n", string, AttachmentBones[x]);
}
ShowPlayerDialog(playerid, DIALOG_ATTACH_BONE_SELECTION, DIALOG_STYLE_LIST, \
"{FF0000}Attachment Modification - Bone Selection", string, "Select", "Cancel");
}
}
return 1;
}
else SendClientMessage(playerid, 0xFF0000AA, "Cancelado.");
return 1;
}