Help with saving attachments position. -
Kestro - 14.12.2012
So, I have updated from old coords placing attachments and have been interested in using the 0.3e toy editor, so I followed the wiki for it, and it all works fine, but, it edits the first slot of my attachment system and dosn't save the position, here is the code for a showeditmenu:
Код:
stock ShowEditMenu(playerid)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, slotselection[playerid]))
{
RemovePlayerAttachedObject(playerid, slotselection[playerid]);
}
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], 1, 1, 1);
new stringg[512];
format(stringg, sizeof(stringg), "%sBone (%s)\n", stringg, HoldingBones[PlayerToyInfo[playerid][slotselection[playerid]][ptBone]]);
format(stringg, sizeof(stringg), "Edit Offset (%f)\n", stringg,(PlayerToyInfo[playerid][slotselection[playerid]][ptPosX]*100));
ShowPlayerDialog(playerid, EDITTOYS2, DIALOG_STYLE_LIST, "Toy Menu: Edit", stringg, "Select", "Cancel");
}
and the edittoys2 code.
Код:
if((dialogid == EDITTOYS2))
{
if(response)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid, EDITTOYSBONE, DIALOG_STYLE_LIST, "Select a Bone", "Spine\nHead\nLeft upper arm\nRight upper arm\nLeft hand\nRight hand\nLeft thigh\nRight thigh\nLeft foot\nRight foot\nRight calf\nLeft calf\nLeft forearm\nRight forearm\nLeft clavicle\nRight clavicle\nNeck\nJaw", "Select", "Cancel");
}
else if(listitem == 1)
{
EditAttachedObject(playerid, 0);
}
else if(listitem == 2)
{
EditAttachedObject(playerid, 0);
}
else if(listitem == 3)
{
EditAttachedObject(playerid, 0);
}
else if(listitem == 4)
{
EditAttachedObject(playerid, 0);
else if(listitem == 5)
{
EditAttachedObject(playerid, 0);
}
else if(listitem == 6)
{
EditAttachedObject(playerid, 0);
}
}
Please help, thank you.
Re: Help with saving attachments position. -
park4bmx - 14.12.2012
ok if you want to save them then...
first you need an enum.
pawn Код:
enum atobj
{
Float:PosX,
Float:PosY,
Float:PosZ,
Float:RotX,
Float:RotY,
Float:RotZ,
}
new PlayerAttObj[MAX_PLAYERS][atobj];
Now to save it...
pawn Код:
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)
{
if(response)
{
PlayerAttObj[playerid][PosX] = fOffsetX;
PlayerAttObj[playerid][PosY] = fOffsetY;
PlayerAttObj[playerid][PosZ] = fOffsetZ;
PlayerAttObj[playerid][RotX] = fRotX;
PlayerAttObj[playerid][RotY] = fRotY;
PlayerAttObj[playerid][RotZ] = fRotZ;
//i will show you how to save it with Y_INI
new file[80],name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"abj(%s).txt",name);
//
new INI:Acc = INI_Open(file);
{
INI_WriteFloat(Acc,"PosX",PlayerAttObj[playerid][PosX]);
INI_WriteFloat(Acc,"PosY",PlayerAttObj[playerid][PosY]);
INI_WriteFloat(Acc,"PosZ",PlayerAttObj[playerid][PosZ]);
INI_WriteFloat(Acc,"RotX",PlayerAttObj[playerid][RotX]);
INI_WriteFloat(Acc,"RotY",PlayerAttObj[playerid][RotY]);
INI_WriteFloat(Acc,"RotZ",PlayerAttObj[playerid][RotZ]);
}
}
}
Re: Help with saving attachments position. -
Kestro - 14.12.2012
Get a bunch of errors, would I need to edit anything in my code?
Re: Help with saving attachments position. -
park4bmx - 14.12.2012
edited my post should solve some errors, i didnt use floats on the enums
Re: Help with saving attachments position. -
Kestro - 14.12.2012
Yeah, that solved some, here are my warnings/errors:
Код:
C:\Users\Aidan\Desktop\HSRP\samp03 [MY CUSTOM SCRIPT]\gamemodes\RP.pwn(3972) : error 017: undefined symbol "INI_Open"
C:\Users\Aidan\Desktop\HSRP\samp03 [MY CUSTOM SCRIPT]\gamemodes\RP.pwn(3972) : warning 213: tag mismatch
C:\Users\Aidan\Desktop\HSRP\samp03 [MY CUSTOM SCRIPT]\gamemodes\RP.pwn(3974) : error 017: undefined symbol "INI_WriteFloat"
C:\Users\Aidan\Desktop\HSRP\samp03 [MY CUSTOM SCRIPT]\gamemodes\RP.pwn(3975) : error 017: undefined symbol "INI_WriteFloat"
C:\Users\Aidan\Desktop\HSRP\samp03 [MY CUSTOM SCRIPT]\gamemodes\RP.pwn(3976) : error 017: undefined symbol "INI_WriteFloat"
C:\Users\Aidan\Desktop\HSRP\samp03 [MY CUSTOM SCRIPT]\gamemodes\RP.pwn(3977) : error 017: undefined symbol "INI_WriteFloat"
C:\Users\Aidan\Desktop\HSRP\samp03 [MY CUSTOM SCRIPT]\gamemodes\RP.pwn(3978) : error 017: undefined symbol "INI_WriteFloat"
C:\Users\Aidan\Desktop\HSRP\samp03 [MY CUSTOM SCRIPT]\gamemodes\RP.pwn(3979) : error 017: undefined symbol "INI_WriteFloat"
C:\Users\Aidan\Desktop\HSRP\samp03 [MY CUSTOM SCRIPT]\gamemodes\RP.pwn(3972) : warning 204: symbol is assigned a value that is never used: "Acc"
Includes are:
Код:
/*============================= {INCLUDES} ==================================*/
#include <a_samp>
#include <streamer>
#include <a_zones>
#include <foreach>
#include <yom_buttons>
#include <djson>
#include <progress>
#include <YSI\y_timers>
#include <ZCMD>
#include <sscanf2>
#include <removebuilding_fix>
#include <fire2>
Re: Help with saving attachments position. -
park4bmx - 14.12.2012
you need
#include <YSI\y_ini>