Accessories editor (Toy editor) - 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: Accessories editor (Toy editor) (
/showthread.php?tid=544877)
Accessories editor (Toy editor) -
Lucky™ - 04.11.2014
Could someone help me to convert this old toy editor into new 0.3e toy editor? (attachment edit or whatever you call it). It has old coordinates editor, if you remember.
I've been playing with the code and I even managed to get the 0.3e toy editor, but it won't save. So I need someones help so badly.
pawn Код:
stock ShowEditMenu(playerid)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, slotselection[playerid]))
{
RemovePlayerAttachedObject(playerid, slotselection[playerid]);
}
if(PlayerToyInfo[playerid][slotselection[playerid]][ptScaleX] == 0) {
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleX] = 1.0;
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleY] = 1.0;
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleZ] = 1.0;
}
SetPlayerAttachedObject(playerid, slotselection[playerid], PlayerToyInfo[playerid][slotselection[playerid]][ptModelID],
PlayerToyInfo[playerid][slotselection[playerid]][ptBone], PlayerToyInfo[playerid][slotselection[playerid]][ptPosX],
PlayerToyInfo[playerid][slotselection[playerid]][ptPosY], PlayerToyInfo[playerid][slotselection[playerid]][ptPosZ],
PlayerToyInfo[playerid][slotselection[playerid]][ptRotX], PlayerToyInfo[playerid][slotselection[playerid]][ptRotY],
PlayerToyInfo[playerid][slotselection[playerid]][ptRotZ], PlayerToyInfo[playerid][slotselection[playerid]][ptScaleX],
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleY], PlayerToyInfo[playerid][slotselection[playerid]][ptScaleZ]);
new stringg[512];
format(stringg, sizeof(stringg), "Bone (%s)\nOffset X (%f)\nOffset Y (%f)\nOffset Z (%f)\nRotation X (%f)\nRotation Y (%f)\nRotation Z (%f)\nScale X (%f)\nScale Y (%f)\nScale Z (%f)",
HoldingBones[PlayerToyInfo[playerid][slotselection[playerid]][ptBone]],
(PlayerToyInfo[playerid][slotselection[playerid]][ptPosX]*100),
(PlayerToyInfo[playerid][slotselection[playerid]][ptPosY]*100),
(PlayerToyInfo[playerid][slotselection[playerid]][ptPosZ]*100),
PlayerToyInfo[playerid][slotselection[playerid]][ptRotX],
PlayerToyInfo[playerid][slotselection[playerid]][ptRotY],
PlayerToyInfo[playerid][slotselection[playerid]][ptRotZ],
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleX],
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleY],
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleZ]);
ShowPlayerDialogEx(playerid, EDITTOYS2, DIALOG_STYLE_LIST, "Toy Menu: Edit", stringg, "Select", "Cancel");
}
pawn Код:
if((dialogid == EDITTOYS) && response)
{
if(PlayerToyInfo[playerid][listitem][ptModelID] == 0)
{
ShowPlayerDialogEx(playerid, 0, DIALOG_STYLE_MSGBOX, "Toy Menu: Edit", "Woops! You don't have anything on that slot", "OK", "");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "{AA3333}HINT:{FFFF00} Position your camera differently to better see where your editing.");
slotselection[playerid] = listitem;
ShowEditMenu(playerid);
}
}
if((dialogid == EDITTOYS2)) {
if(response) switch(listitem) {
case DIALOG_ATTACH_EDITREPLACE:
{
if(response) EditAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
else RemovePlayerAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
DeletePVar(playerid, "AttachmentIndexSel");
return 1;
}
}
else
{
new stringg[512];
for(new x;x<MAX_PLAYERTOYS;x++)
{
new name[24];
format(name, sizeof(name), "None");
for(new i;i<sizeof(HoldingObjectsAll);i++)
{
if(HoldingObjectsAll[i][holdingmodelid] == PlayerToyInfo[playerid][x][ptModelID])
{
format(name, sizeof(name), "%s", HoldingObjectsAll[i][holdingmodelname]);
}
}
format(stringg, sizeof(stringg), "%s(%d) %s (Bone: %s)\n", stringg, x, name, HoldingBones[PlayerToyInfo[playerid][x][ptBone]]);
}
ShowPlayerDialogEx(playerid, EDITTOYS, DIALOG_STYLE_LIST, "Select a Toy", stringg, "Select", "Cancel");
}
}
if(dialogid == EDITTOYSSX)
{
if(response)
{
new Float:offset = floatstr(inputtext);
if(offset < 0.1) offset = 0.1;
else if(offset > 1.5) offset = 1.5;
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleX] = offset;
}
ShowEditMenu(playerid);
}
if(dialogid == EDITTOYSSY)
{
if(response)
{
new Float:offset = floatstr(inputtext);
if(offset < 0.1) offset = 0.1;
else if(offset > 1.5) offset = 1.5;
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleY] = offset;
}
ShowEditMenu(playerid);
}
if(dialogid == EDITTOYSSZ)
{
if(response)
{
new Float:offset = floatstr(inputtext);
if(offset < 0.1) offset = 0.1;
else if(offset > 1.5) offset = 1.5;
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleZ] = offset;
}
ShowEditMenu(playerid);
}
if(dialogid == EDITTOYSPX)
{
if(response)
{
new Float:offset = floatstr(inputtext);
if(offset < -100) offset = 0;
else if(offset > 100) offset = 100;
offset = offset/100;
PlayerToyInfo[playerid][slotselection[playerid]][ptPosX] = offset;
}
ShowEditMenu(playerid);
}
if(dialogid == EDITTOYSPY)
{
if(response)
{
new Float:offset = floatstr(inputtext);
if(offset < -100) offset = 0;
else if(offset > 100) offset = 100;
offset = offset/100;
PlayerToyInfo[playerid][slotselection[playerid]][ptPosY] = offset;
}
ShowEditMenu(playerid);
}
if(dialogid == EDITTOYSPZ)
{
if(response)
{
new Float:offset = floatstr(inputtext);
if(offset < -100) offset = 0;
else if(offset > 100) offset = 100;
offset = offset/100;
PlayerToyInfo[playerid][slotselection[playerid]][ptPosZ] = offset;
}
ShowEditMenu(playerid);
}
if(dialogid == EDITTOYSRX)
{
if(response)
{
new Float:offset = floatstr(inputtext);
if(offset < -100) offset = 0;
else if(offset > 360) offset = 360;
PlayerToyInfo[playerid][slotselection[playerid]][ptRotX] = offset;
}
ShowEditMenu(playerid);
}
if(dialogid == EDITTOYSRY)
{
if(response)
{
new Float:offset = floatstr(inputtext);
if(offset < -100) offset = 0;
else if(offset > 360) offset = 360;
PlayerToyInfo[playerid][slotselection[playerid]][ptRotY] = offset;
}
ShowEditMenu(playerid);
}
if(dialogid == EDITTOYSRZ)
{
if(response)
{
new Float:offset = floatstr(inputtext);
if(offset < -100) offset = 0;
else if(offset > 360) offset = 360;
PlayerToyInfo[playerid][slotselection[playerid]][ptRotZ] = offset;
}
ShowEditMenu(playerid);
}
if(dialogid == EDITTOYSBONE)
{
if(response)
{
PlayerToyInfo[playerid][slotselection[playerid]][ptBone] = listitem+1;
}
ShowEditMenu(playerid);
}