[Ajuda] Me ajudem a desbugar isso
#1

Код:
#include <a_samp>
#include "../include/mSelection.inc"

#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 Acessorios = mS_INVALID_LISTID;

new AttachmentObjects[MAX_PLAYERS];

new AttachmentBones[][24] = {
	{"Spine"},
	{"Head"},
	{"Left upper arm"},
	{"Right upper arm"},
	{"Left hand"},
	{"Right hand"},
	{"Left thigh"},
	{"Right thigh"},
	{"Left foot"},
	{"Right foot"},
	{"Right calf"},
	{"Left calf"},
	{"Left forearm"},
	{"Right forearm"},
	{"Left clavicle"},
	{"Right clavicle"},
	{"Neck"},
	{"Jaw"}
};
public OnFilterScriptInit()
{
	Acessorios = LoadModelSelectionMenu("Acessorios.txt");
	return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/acessorios", true))  //attachments
	{
		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[])
{
	switch(dialogid)
	{
		case 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
				{
                    for(new x;x<sizeof(AttachmentObjects);x++)
					{

						ShowModelSelectionMenu(playerid, Acessorios, "BCL");
					}
				}
				SetPVarInt(playerid, "AttachmentIndexSel", listitem);
			}
			return 1;
		}
		case DIALOG_ATTACH_EDITREPLACE:
		{
			if(response) EditAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
			else RemovePlayerAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
			DeletePVar(playerid, "AttachmentIndexSel");
			return 1;
		}
		case 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;
		}
	}
	return 0;
}

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, "Ediзгo terminada.");

	return 1;
}
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
	if(listid == Acessorios)
	{
		if(response)
		{
			if(GetPVarInt(playerid, "AttachmentUsed") == 1) EditAttachedObject(playerid, listid);
			else
			{
                SetPVarInt(playerid, "AttachmentModelSel", AttachmentObjects[listid]);
				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");
			}
		}
		else DeletePVar(playerid, "AttachmentIndexSel");
		return 1;
	}
	else SendClientMessage(playerid, 0xFF0000AA, "Cancelado.");
	return 1;
}
A Textdrwa esta bugando depois que escloher o slot que vai ser salva o objeto no player como faзo para funcionar normalmente!

download do ARQUIVO
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)