Attachments not rotating or positioning -
KingyKings - 23.12.2013
So im using TreePuncher Object Editor
As thats the only attachment editor that doesn't use Dialogs.
And it works fine for showing the object however for other players on the server it doesn't show the new position, size or rotation. Im not sure how to fix this?
Thanks
Re: Attachments not rotating or positioning -
Pottus - 23.12.2013
You need to reload the attached objects basically just run the attach function and updated parameters cheers.
Re: Attachments not rotating or positioning -
KingyKings - 23.12.2013
How do i reload them?
Re: Attachments not rotating or positioning -
Pottus - 23.12.2013
https://sampwiki.blast.hk/wiki/OnPlayerEditAttachedObject
https://sampwiki.blast.hk/wiki/SetPlayerAttachedObject
All you need to do is do is put this line in the appropriate place under OnPlayerEditAttachedObject()
pawn Код:
if(response) SetPlayerAttachedObject(playerid, index, modelid, bone, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ);
Re: Attachments not rotating or positioning -
KingyKings - 23.12.2013
Im confused i added it but still no luck:/ Don't know if its just the script being dodgy... ?
Here is the whole thing
Код:
//Made by TreePuncher or Jay_McReary
#include <a_samp>
#include <DOF2>
new bool:UsingEDIT[MAX_PLAYERS];
stock IsNumeric(string[])
{
for (new i = 0, j = strlen(string);
i < j; i++)
{
if (string[i] > '9' || string[i] < '0')
return 0;
}
return 1;
}
public OnFilterScriptInit()
{
print("----------TreePuncher Object Editor Loaded asdasd---------");
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new treecmd[256], treeidx;
treecmd = strtok(cmdtext, treeidx);
if(!strcmp(treecmd, "/started", true))
{
if(!IsPlayerAdmin(playerid)) return 0;
new tmp[256];
tmp = strtok(cmdtext, treeidx);
if(!strlen(tmp)) return SendClientMessage(playerid, 0xFF0000FF, "Please, input an OBJECT id");
if(!IsNumeric(tmp)) return SendClientMessage(playerid, 0xFF0000FF, "You cannot use letters, just integer numbers");
if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
new objectid;
objectid = strval(tmp);
SetPlayerAttachedObject(playerid, 9, objectid, 1);
EditAttachedObject(playerid, 9);
SendClientMessage(playerid, 0xFF0000FF, "Edition Started, please use the diskette when you are done");
UsingEDIT[playerid] = true;
TogglePlayerControllable(playerid, false);
return 1;
}
return 0;
}
public OnFilterScriptExit()
{
print("----------TreePuncher Object Editor Unloaded-------");
DOF2_Exit();
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)
{
if(response && UsingEDIT[playerid] == true)
{
new file[30];
format(file, sizeof(file), "%i.txt", modelid);
DOF2_CreateFile(file);
DOF2_SetInt(file, "Object ID", modelid);
DOF2_SetFloat(file, "OffSet Float X", fOffsetX);
DOF2_SetFloat(file, "OffSet Float Y", fOffsetY);
DOF2_SetFloat(file, "OffSet Float Z", fOffsetZ);
DOF2_SetFloat(file, "OffSet Rotation X", fRotX);
DOF2_SetFloat(file, "OffSet Rotation Y", fRotY);
DOF2_SetFloat(file, "OffSet Rotation Z", fRotZ);
DOF2_SetFloat(file, "OffSet Scale X", fScaleX);
DOF2_SetFloat(file, "OffSet Scale Y", fScaleY);
DOF2_SetFloat(file, "OffSet Scale Z", fScaleZ);
DOF2_WriteFile();
DOF2_SaveFile();
UsingEDIT[playerid] = false;
TogglePlayerControllable(playerid, true);
}
if(!response && UsingEDIT[playerid] == true)
{
SendClientMessage(playerid, 0xFF0000FF, "You have cancelled your attachment edition");
UsingEDIT[playerid] = false;
TogglePlayerControllable(playerid, true);
return RemovePlayerAttachedObject(playerid, 9);
}
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}