Dynamic Actors System Creation [MySQL]
The server i'm developing will have at least 50 actors, and creating one per one would be a pain in the ass.
To avoid creating them manually, i started searching how to create them dynamically but found only old threads with inefficient saving methods (dini and similar), then i said, if the mountain won't come to Muhammad, then Muhammad must go to the mountain.
So i decided to create this, a dynamic actors system where you can create how many actors as you wish. You don't have to worry about anything, script will do all the work.
Includes/plugins required:
MySQL R41-4: https://github.com/pBlueG/SA-MP-MySQL/releases
Sscanf: https://github.com/maddinat0r/sscanf/releases
Streamer: https://github.com/samp-incognito/sa...lugin/releases
I-ZCMD: https://github.com/YashasSamaga/I-ZC...ster/izcmd.inc
Installation
Download both .amx and .pwn files provided at the end of this topic.
Place .amx (and even .pwn file if you wish), in filterscripts folder.
Now open server.cfg and add dynamic_actors near the filterscripts line.
That's all, run the server and enjoy!
Commands
The system comes with 5 different commands that allows you to manage your created actors.
/actorhelp: Returns a list of all available commands.
/createactor [skin ID]: Creates an actor at your position with the selected skin ID. (From 0 to 311).
/removeactor [actor ID]: Removes an actor based on their ID.
/removeallactors: Removes ALL actors created, deleting them permanently from the database too.
/locatenearactors: Allows you to locate the closest actor in a range defined with MAX_ACTORS_RANGE. (Default is 50 meters, you can change it in the script - Look for #define MAX_ACTORS_RANGE 50.0)
Screens
Now some screens.
Creating actors:
https://image.ibb.co/fCQ8i0/sa-mp-024.jpg
Using /locatenearactors
https://image.ibb.co/nqZ130/locate-nearest-actor.jpg
Removing all actors with /removeallactors
https://image.ibb.co/mVj130/remove-all-actors.jpg
Bugs
Tested for like 1.5 hours and no bugs have been found. If you find any, please report them in this topic.
Download
You need to create "actors" table, here is the .SQL file:
https://pastebin.com/3ma89iDF
Or if you're lazy, run this query:
Code:
CREATE TABLE IF NOT EXISTS `actors`
(
`dynamicActorID` int(3) NOT NULL AUTO_INCREMENT,
`dynamicActorX` float NOT NULL,
`dynamicActorY` float NOT NULL,
`dynamicActorZ` float NOT NULL,
`dynamicActorA` float NOT NULL,
`dynamicActorVW` int(3) NOT NULL,
`dynamicActorSkin` int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
I don't have GitHub, i'll probably open an account and put .amx file there, until then, if you want the .amx you can download it here:
https://www70.zippyshare.com/v/1BbQNN01/file.html
Last but not least...
If you have any comment or tip on how to optimize this system, feel free to post it, thank you!