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
{
new string[4000+1];
for(new x;x<sizeof(AttachmentObjects);x++)
{
format(string, sizeof(string), "%s%s\n", string, AttachmentObjects[x][attachname]);
}
ShowPlayerDialog(playerid, DIALOG_ATTACH_MODEL_SELECTION, DIALOG_STYLE_LIST, \
"{FF0000}Attachment Modification - Model Selection", string, "Select", "Cancel");
}
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_MODEL_SELECTION:
{
if(response)
{
if(GetPVarInt(playerid, "AttachmentUsed") == 1) EditAttachedObject(playerid, listitem);
else
{
SetPVarInt(playerid, "AttachmentModelSel", AttachmentObjects[listitem][attachmodel]);
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;
}
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 )
{
new debug_string[256+1];
format(debug_string,256,"SetPlayerAttachedObject(p layerid,%d,%d,%d,%f,%f,%f,%f,%f,%f,%f,%f,%f)",
index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fR otX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
print(debug_string);
SetPlayerAttachedObject(playerid,index,modelid,bon eid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,f ScaleX,fScaleY,fScaleZ);
SendClientMessage(playerid, 0xFFFFFFFF, "You finished editing an attached object");
return 1;
}
|