[FilterScript] [0.3e+]Player Attached Object Editor
#1

Rate ^ | Latest stable version: 0.4 - November, 2015
Player Attached Object Editor
This filter-script is useful for creating and editing a player attached object (also known as attached object, holding object, player attachment, clothes, dress, toy) on the player character/skin. Create up to 10 attached objects directly in game, adjust them with cursor, save, load, or share and make it together with other player(s) in the server. After it's saved, you can copy and paste the code to your SA:MP PAWN script or load them again to edit it. This is just like the attachments editor script made by h02, but with more commands and functions. Please note that this is not an attachment system, but an editor script.

Features
  • Editor menu with dialog
  • Edit function, adjust your object with cursor
  • Save and load attached object file (as pawn code)
  • Auto restore on re-spawn
  • Last deleted (by editor) attached objects can be restored
  • Multi-player supported, you can make attachment together with other players.
Screenshots
Download
Just pick compiled code if you are just going to use it and not to develop it.
Version
Date
Compiled Script
Source Code
License
0.4
recommended
November, 2015 AOE4.amx (±313 KB, 0.3.7-1000p)MPL 2.0
0.3
old
March, 2014 AOE3.amx (±207 KB, 0.3z-500p)
CC BY-NC-SA 3.0
0.2
unstable
July, 2013N/A Download via PastebinCC BY-NC-SA 3.0
0.1b
old
March, 2013N/A Download via PastebinListed in code
0.1a
unstable
February, 2013N/A Download via PastebinListed in code
0.1
unstable
February, 2013N/A Download via PastebinListed in code
Requirements
Version
Compiled Script
Source
0.4
—————
0.3
  1. SA:MP server package (Windows/Linux) version 0.3e or newer
  2. sscanf plugin (v2.8.1+)
  1. SA:MP server package with pawncc (Windows) version 0.3e or newer
  2. sscanf plugin + include (v2.8.1+)
  3. zcmd include (v0.3.1)
0.2
0.1b
0.1a
0.1
  1. SA:MP server package (Windows/Linux) version 0.3e or newer
  1. SA:MP server package with pawncc (Windows) version 0.3e or newer
  2. Dini include (v1.6)
Usage & Installation
Installation
  1. Make sure you have downloaded the compiled code (.amx) of the newest version from the link above
  2. Place the AMX file to your "\filterscripts\" folder in the sa-mp server directory
  3. If you are using version 0.3 or 0.4, make sure sscanf plugin is loaded, you should see this on server.cfg file:
    • Windows:
      Code:
      plugins sscanf
    • Linux:
      Code:
      plugins sscanf.so
  4. Load and run the filter-script,
    • If the server is not running yet, place the AMX file name on the server.cfg file, example:
      Code:
      filterscripts AOE4
      And then start the sa-mp server
    • If the server is already running, send this server console/RCON command:
      Code:
      loadfs AOE4
  5. Once it's done, you should get this on server console/log:
    Quote:

    Attached Object Editor by Robo_N1X
    -------------loading--------------
    >> Version: 0.4 - November 2015 for SA:MP 0.3e+
    >> Player attached objects count: 0
    Filterscript 'AOE4.amx' loaded.

    Congratulations, this filter-script has successfully installed and loaded on your server.
Usage
After the filter-script is loaded, you can start by using /aoe command, this shows the main menu of the filter-script. Select "Help" to view the command list and its description. Additionally, login as RCON Admin to get more privileges such as deleting file and to bypass limit.

Command list and usages below, command in red means only for RCON admin:
  • /attachedobjecteditor
    Alias: /aoe
    Show the attached object editor filter-script main menu dialog

  • /resetattachedobjecteditor
    Alias: /raoepv
    Reset a player's editor variable in case of bug.
    Code:
    /resetattachedobjecteditor PlayerName/ID AttachedObjectIndex
    • PlayerName/ID: The target's player name or id to perform this action on
    • AttachedObjectIndex (Optional): The attached object index to reset (and remove if invalid), none by default

  • /createattachedobject
    Alias: /cao
    Create your player attached object
    Code:
    /createattachedobject AttachedObjectIndex ObjectModelID BoneName/ID
    • AttachedObjectIndex: The attached object slot number to create, shows free slot dialog list if not specified
    • ObjectModelID: The GTA:SA/SA-MP object model id to create as attached object, shows dialog input if not specified
    • BoneName/ID: The attached object bone name or id, shows bone dialog list if not specified

  • /removeattachedobject
    Alias: /rao
    Remove your player attached object
    Code:
    /removeattachedobject AttachedObjectIndex
    • AttachedObjectIndex: The attached object slot number to remove

  • /removeattachedobjects
    Alias: /raos
    Removes all of your player attached objects

  • /undeleteattachedobject
    Alias: /udao
    Restore your removed attached object
    Code:
    /undeleteattachedobject AttachedObjectIndex
    • AttachedObjectIndex (Optional): The attached object slot number to restore, restores the last removed if not specified

  • /refreshattachedobject
    Alias: /rpao
    Load another player's attached object
    Code:
    /refreashattachedobject PlayerName/ID AttachedObjectIndex
    • PlayerName/ID: The target's player name or id to load the attached object from
    • AttachedObjectIndex (Optional): The attached object slot number to load from, shows slot dialog list if not specified

  • /duplicateattachedobject
    Alias: /dao
    Duplicates your attached object
    Code:
    /duplicateattachedobject FromAttachedObjectIndex ToAttachedObjectIndex
    • FromAttachedObjectIndex: The existing attached object slot number
    • ToAttachedObjectIndex: The attached object slot number to duplicate on, shows slot dialog list if not specified

  • /attachedobjectproperties
    Aliases: /attachedobjectstatus, /aop, /aos
    Shows yours or another player's attached object properties data value
    Code:
    /attachedobjectproperties AttachedObjectIndex PlayerName/ID
    • AttachedObjectIndex: The attached object slot number to view its properties
    • PlayerName/ID (Optional): The target's player name or id to view its properties, shows your own if not specified

  • /editattachedobject
    Alias: /eao
    Edit and adjust your attached object with mouse cursor
    Code:
    /editattachedobject AttachedObjectIndex
    • AttachedObjectIndex: The attached object slot number to edit

  • /setattachedobjectindex
    Aliases: /setattachedobjectslot, /saoi
    Change your attached object slot number
    Code:
    /setattachedobjectindex OldAttachedObjectIndex NewAttachedObjectIndex
    • OldAttachedObjectIndex: The existing attached object slot number to change from
    • NewAttachedObjectIndex: The new attached object slot number to change at, shows free slot dialog list if not specified

  • /setattachedobjectmodel
    Alias: /saom
    Change your attached object model
    Code:
    /setattachedobjectmodel AttachedObjectIndex NewObjectModelID
    • AttachedObjectIndex: The attached object slot number to change its model
    • NewObjectModelID: The new attached object model number to change, shows model id dialog input if not specified

  • /setattachedobjectbone
    Alias: /saob
    Change your attached object slot bone
    Code:
    /setattachedobjectbone AttachedObjectIndex NewBoneName/ID
    • AttachedObjectIndex : The attached object slot number to change its bone
    • NewBoneName/ID: The new attached object bone name or id to change, shows bone dialog list if not specified

  • /setattachedobjectoffset
    Alias: /saoo
    Change your attached object offset/position
    Code:
    /setattachedobjectoffset AttachedObjectIndex X/Y/Z OffsetValue
    • AttachedObjectIndex: The attached object slot number to change its offset value
    • X/Y/Z: The offset axis (X/Y/Z) to edit
    • OffsetValue: The new attached object offset value

  • /setattachedobjectrot
    Alias: /saor
    Change your attached object rotation
    Code:
    /setattachedobjectrot AttachedObjectIndex X/Y/Z RotationValue
    • AttachedObjectIndex: The attached object slot number to change its rotation value
    • X/Y/Z: The rotation axis (X/Y/Z) to edit
    • RotationValue: The new attached object rotation value

  • /setattachedobjectscale
    Alias: /saos
    Change your attached object scale/size
    Code:
    /setattachedobjectscale AttachedObjectIndex X/Y/Z ScaleValue
    • AttachedObjectIndex: The attached object slot number to change its scale value
    • X/Y/Z: The scale axis (X/Y/Z) to edit
    • ScaleValue: The new attached object scale value

  • /setattachedobjectmc
    Alias: /saomc
    Change your attached object material color
    Code:
    /setattachedobjectoffset AttachedObjectIndex MaterialColor1 MaterialColor2
    • AttachedObjectIndex: The attached object slot number to change its material color
    • MaterialColor1: The new attached object #1 material color value
    • MaterialColor2: The new attached object #2 material color value

  • /setattachedobjectmc1
    Alias: /saomc1
    Change your attached object material color
    Code:
    /setattachedobjectoffset AttachedObjectIndex MaterialColor1
    • AttachedObjectIndex: The attached object slot number to change its material color
    • MaterialColor1: The new attached object #1 material color value

  • /setattachedobjectmc2
    Alias: /saomc2
    Change your attached object material color
    Code:
    /setattachedobjectoffset AttachedObjectIndex MaterialColor2
    • AttachedObjectIndex: The attached object slot number to change its material color
    • MaterialColor2: The new attached object #2 material color value

  • /saveattachedobject
    Alias: /sao
    Save one of your attached object as file (PAWN code)
    Code:
    /saveattachedobject AttachedObjectIndex FileName Comment
    • AttachedObjectIndex: The attached object slot number to save
    • FileName: The name of the save file excluding extension, shows file name dialog input if not specified
    • Comment (Optional): The comment message to save, does not work at the current version, writes your name, skin, and time information if not specified.

  • /saveallattachedobjects
    Alias: /saao
    Save all of your attached object set as file (PAWN code)
    Code:
    /saveattachedobjects FileName Comment
    • FileName: The name of the save file excluding extension, shows file name dialog input if not specified
    • Comment (Optional): The comment message to save, does not work at the current version, writes your name, skin, and time information if not specified.

  • /loadattachedobject
    Alias: /lao
    Load one of attached object from saved file
    Code:
    /loadattachedobject FileName AttachedObjectIndex
    • FileName: The name of saved attached object file to load excluding extension
    • AttachedObjectIndex (Optional): The attached object slot number to load from, shows free slot dialog list if not specified

  • /loadattachedobjects
    Alias: /laos
    Load all attached object set from saved file
    Code:
    /loadattachedobjects FileName
    • FileName: The name of saved attached object file to load excluding extension

  • /deleteattachedobjectfile
    Alias: /daof
    Delete a saved attached object file
    Code:
    /deleteattachedobjectfile FileName
    • FileName: The name of saved attached object file to delete excluding extension
Legend:
  • AttachedObjectIndex - Attached object slot index number, as sa-mp default: 0 to 9, in this editor use 10 for all (only works in some commands)
  • ObjectModelID - GTA:SA/SA-MP valid Object model ID number.
  • BoneName/ID - Attached object bone name or id, the id is a number from 1 to 18, you can also type the name as its listed on wiki, example "Right hand".
  • X/Y/Z - The axis, you have to specify only one of them, for instance "x".
  • OffsetValue, RotationValue, ScaleValue - The value of attached object data in float (decimal number), e.g: 1, -2.0, 0.3. This value is limited by the script, login as RCON admin to bypass.
  • MaterialColor - The attached object texture material color as integer or hexadecimal number in ARGB format, e.g. 0xFF00FFFF.
  • FileName - The attached object save file name, without extension, must be only A to Z, 0 to 9 and some allowed symbols (@$()_=[]), minimum 1 character and maximum 24 characters. The file then will be named as how AOE_FILE_NAME is defined in the script, by default it's named "name_pao.txt" located in scriptfiles folder.
Sample
You probably need the sample of attached objects made with this editor. Here we go i made it, free demo!

Just copy the code below then paste on notepad and save the file with name "Flashlight_pao.txt" in scriptfiles folder by default, then you can try it in game by using command: /loadattachedobjects Flashlight
Code:
// Created by Robo_N1X (Skin ID 188) on 05/12/2015 19:16:52 (server time)
SetPlayerAttachedObject(playerid, 0, 18641, 6, 0.08, 0.04, 0.05, 180.0, 0.0, 0.0);
SetPlayerAttachedObject(playerid, 1, 18656, 6, 0.08, 0.065, 0.1, 90.0, 0.0, 0.0, 0.03, 0.03, 0.03);
SetPlayerAttachedObject(playerid, 2, 19281, 6, 0.08, 0.045, 0.175);
You can also just paste the code above directly to your own script without this editor.

Changelog
Code:
0.4 - November, 2015 (28/11/2015)
- License is now MPL 2.0
- Added #define for non-formatted text messages, makes it easier to edit the text
- Added #define AOE_SMALLER_SAVE to toggle skip writing optional value in code, makes the save file smaller
- Added code to automatically delete attached object made with the filter-script on unload, except for RCON admin
- Added /resetattachedobjecteditor command to reset player editor state in case of bug (admin only)
- Added /setattachedobjectmc command to set one or both attached object material color
- Added slot dialog options to select all slot
- Added slot selection and replace confirmation dialog for /refreshattachedobject
- Added dialog for /deleteattachedobjectfile command
- Added confirmation dialog for overwrite file save and other dialog types
- Added input dialog for editing XYZ value and Material Color data
- Added "Statistics" options to main menu dialog to show total attached objects, it shows debugging variable for RCON Admin
- Added code to prevent edit/adjusting over limit and cancel invalid/broken edit
- Added support for 0.3.7 objects
- Added a public function AOE_GetPVar() to get the player editor variable to be called with CallRemoteFunction()
- Changed the dialog id enumerations to #define method
- Bone names are now constant (read only)
- Repeated methods now uses one same function instead
- This version has many changes to commands, colors, messages.
- Changed the PVar method from function to variable (EPV)
- Changed the menu dialogs, now more simple and categorized
- Almost everything is well sorted to make it easy
- Attached object properties now previews material color better
- Changed the set XYZ command:
-- /setattachedobjectoffset(x/y/z) is now /setattachedobjectoffset [slot] [x/y/z]
-- /setattachedobjectrot(x/y/z) is now /setattachedobjectrot [slot] [x/y/z]
-- /setattachedobjectscale(x/y/z) is now /setattachedobjectscale [slot] [x/y/z]
- Fixed the bug that allows editor to restore invalid attached object
- Fixed the issue with loading comment from saved file
- Fixed some bugs and optimized code more better
- Removed command /totalattachedobjects, see "Statistics" on main menu instead.
0.3 - March, 2014 (29/03/2014)
- Major Bug fixes
-- Fixed the dialog
-- Fixed file name & data parsing for saving & loading
-- Fixed the material color data and formatting (Hex and Integer)
-- Fixed the function for player attached object related
-- Fixed some message typo/grammar
-- Fixed the wrong defined limit
-- Fixed valid object model id that was locked on the script and were unable to be used
- Code improvements, lower and efficient memory, also faster
-- Changed the size of variables to necessary value
-- Removed unused and old function
-- Changed the color to the new style
-- Changed the style of the script, including the defines, and variables
-- Removed dcmd from the command processor
-- Removed dini from file saving/loading player attached object file
-- Removed the dialog alert on deleting one player attached object, you can just use /udso to restore last deleted one
- Commands are changed to ZCMD and sscanf
- File saving/loading now use the default file function with sscanf
- Defined "FILTERSCRIPT" to make it works fine with the library
- Now you can write your own comment with /saveattachedobject(s) command, otherwise it will include common information such as creator name and time created
- Now you can see another player's attached object stats by using /attachedobjectstats command
- Now you can see the exact material color data on /attachedobjectstats and sample color on the text
- Added command /refreshattachedobject to load another player's attached object
- Added command /deleteattachedobjectfile for RCON Admin to delete an existing player attached object file
- Removed the /converattachedobjectfile, the /saveattachedobject(s) will save the code directly
- Changed the /loadattachedobject(s) method, it will read the data with correct SetPlayerAttachedObject usage from file, not compatible with older editor version
- Changes of credits
-- Added Scott as h02's another name
-- Added Zeex for the zcmd
-- Added Y_Less for the sscanf
-- Removed DracoBlue (for current version)
0.2 - July, 2013 (29/07/2013)
- Bug fixes
-- Fixed the valid data showing on /attachedobjectstats
-- Fixed the hex color data showing on /attachedobjectstats
- Changed the create method order from model, bone, slot to slot, model, bone
- Improved the dialog interfaces
-- Enabled some dialog back button, which was unused in the previous version
-- Removed the /attachedobjectlist command as it works like /editattachedobject
-- Added the /setattachedobjectindex into the dialog menu
-- Added the /setattachedobjectmodel into the dialog menu
-- Added the /setattachedobjectbone into the dialog menu
-- Added dialog confirmation on saving attached object to replace an existing file (RCON Admin Only)
-- Added the create button on /editattachedobject menu if the attached object is not created in the selected slot
- Removed variable "valid" from the file saving/loading
- Code optimization (lower memory), removed unused codes
0.1b - February, 2013 (28/02/2013)
- Minor updates and fixes
0.1a - February, 2013 (17/02/2013)
- Improved the /aoe menu dialog command
- Added dialog confirmation on /lao command for replacing used slot
0.1 - February, 2013 (16/02/2013)
- First release
Known Bugs
  1. It's written up to 99 characters can be saved for comment while its limited to 63 characters.
  2. Custom comments are not written in saved file.
License
Version 0.4 is released under Mozilla Public License 2.0:
https://www.mozilla.org/en-US/MPL/2.0/
You may not remove any credits in the script, especially the author(s) and contributor(s) name.
Although it's with MPL, but you might not sell this script as it violates the rules.

Credits
Credits & thanks to:Also thanks to: Milestone
Since 29/11/2015 this thread has been viewed more than 23,000 times:
  • v0.3 reached 3300 total downloads/views
  • v0.2 reached 1400 views on pastebin
  • v0.1b reached 500 views on pastebin
  • v0.1a reached 100 views on pastebin
  • v0.1 reached 800 views on pastebin
Total downloads are 6100, means 25% of the views.

Thanks to everyone that has used this filter-script tool, if you liked this editor, please rate the topic or post a comment, any feedback is appreciated.

F.A.Q
Which file should i download?
The important file everyone would have to pick is the .AMX file of the latest version (0.4) also the requirements files which one is sscanf plugin. You are only required to download source code if you are going to edit or compile the filter-script by yourself.

Can i use this script on my public server?
Yes you can, but please notice that this is not an attachment/holding object/toy/clothes system. This is an editor script, therefore every player in your server will be able to create, edit, save, load, and use the editor commands on any attached object freely, even not made by the editor script. You should only use it if your server allows free thing like mapping stuff, or in your own private/local server. If you do so, you should have reviewed the source code and edit it for your server needs.

The filter-script dialog id is conflicting with other script that i have.
This filter-script uses 32 dialog id starting from number 400, you have to edit the source code then find and change the number on this define part:
Code:
#define AOE_D	400	// Main Menu ID
For instance, if you changed the number from 400 to 1000, then dialog id 1000 to 1031 will be reserved for the editor.

Why am i getting error in game message "Sorry, you can't use this command right now."?
This filter-script does not allow the player to use most of editor commands if the player is in state such as (1) died, (2) spectating, (3) adjusting with cursor. You need to re-spawn for the first two cases, and save/cancel edit for the last case. Otherwise, in case of bug, you can login as RCON Admin and then use the /resetattachedobjecteditor command.

* More will be posted later

Additional Notes
You may use this script as much as is proper on San Andreas MultiPlayer, in other case, the author is not responsible of the risk and damage caused by this filter-script fault (no warranty), especially unauthorized source or fake mirror.

Please note that the download link for AOE4-03e-500p is compiled with 0.3e server for 500 players and might not work correctly on some conditions. However you should still able to use it on sa-mp server version 0.3e or newer with 500 player slot. This is provided for compatibility and lower memory as it is using necessary API version.

If you have found bugs or have any questions regarding to this script, feel free to reply here or send me a private message.
And sorry for my bad english both in the script and this forum thread.

More details of this topic will be updated later, i'm still editing it.
Reply
#2

gooooddd :X keep up
Reply
#3

Very usefull.....+1 Rep for you work
Reply
#4

Great Rep +!
Reply
#5

nice I like it
Reply
#6

Thank you all for the comments and using/downloading this filterscript
There is new minor change/update available! version 0.1a, tested in 0.3x
i don't have time right now on making the full guide. Feel free to ask me the question in this topic or forum pm.
Let me know if anyone have an idea or suggestion on this.
Reply
#7

good
Reply
#8

Great release robo
Reply
#9

Cool
Reply
#10

Nice Job Robo +Rep
Reply
#11

When I change the color of an object ( for ex 371 ) to 5000 ( green ) it doesn't change, the object just dissapears, how to fix?
Reply
#12

Quote:
Originally Posted by Stefhan
Посмотреть сообщение
When I change the color of an object ( for ex 371 ) to 5000 ( green ) it doesn't change, the object just dissapears, how to fix?
Object 371 (parachute) has only single material. Therefore use the command /saomc1
Quote:

/setattachedobjectmc1
Alias: /saomc1
Change your attached object material color
Код:
/setattachedobjectoffset AttachedObjectIndex MaterialColor1
  • AttachedObjectIndex: The attached object slot number to change its material color
  • MaterialColor1: The new attached object #1 material color value
Also i'm not sure what you mean with 5000, perhaps try to use ARGB format instead, because you probably get used with integer that is equal with RGBA format, so if you want to make it green try FF00FF00.
Quote:

MaterialColor - The attached object texture material color as integer or hexadecimal number in ARGB format, e.g. 0xFF00FFFF.

Also please note that changing material colors doesn't support all indexes for holding objects, it's only limited to 2 by SA:MP so it may not work completely.
Reply
#13

Quote:
Originally Posted by RoboN1X
Посмотреть сообщение
Object 371 (parachute) has only single material. Therefore use the command /saomc1


Also i'm not sure what you mean with 5000, perhaps try to use ARGB format instead, because you probably get used with integer that is equal with RGBA format, so if you want to make it green try FF00FF00.

Also please note that changing material colors doesn't support all indexes for holding objects, it's only limited to 2 by SA:MP so it may not work completely.
Thanks, this worked, however I tried using code 0000000 to make something black but it became white.
Reply
#14

Quote:
Originally Posted by Stefhan
Посмотреть сообщение
Thanks, this worked, however I tried using code 0000000 to make something black but it became white.
FF000000
Reply
#15

For some reason whenever i'm done editing an attached object, the script will keep saying i have to finish the edit, even though i already pressed ESC.
The only solution to this is to reset the object editor, and when i do that i think the various offsets and values get reset to 0 so when i try to load saved objects i'll see the unedited version instead of the edited one.

Is there any solution to this?
Reply
#16

Awesome.
Reply
#17

Quote:
Originally Posted by Greggu
Посмотреть сообщение
For some reason whenever i'm done editing an attached object, the script will keep saying i have to finish the edit, even though i already pressed ESC.
The only solution to this is to reset the object editor, and when i do that i think the various offsets and values get reset to 0 so when i try to load saved objects i'll see the unedited version instead of the edited one.

Is there any solution to this?
I'm not sure why some people (still) facing this issue, i never able to find this, can anyone atleast explain the step what they are doing to produce this bug? I'd appreciate it.
When you save by clicking the disk icon, it should tell you that you have finished editing. Even if you pressed ESC it also notify you that object edit is canceled.
If it works for me correctly, it must be something from other script preventing the OnPlayerEditAttachedObject being called, because when i test it with a blank gamemode or grandlarc, with sscanf and with or without streamer plugins, nothing wrong.
Reply
#18

doesnt work
Reply
#19

Very nice
Reply
#20

its possible to put this FS in GM?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)