Car System
# support-forum
s
Hello, so im playing around with pawno, MySQL, and samp in general, creating a server, just for fun, and i just want to ask how can i make a car ownership and car spawning system for my server?
d
By coding it
s
Helps alot, the reason i am asking is, i've read through the docs already, i'm familiar with basics, the problem is mysql, i cant set it up to pull the model id from the DB to get used when spawning a vehicle, thats my problem, and thats why i asked
s
If you can't make it, pay to someone else.
s
The thing is i want to learn how to do these kinds of stuff, as i said this is just for fun, and to learn, i dont plan on making this server something
d
Glad it helps a lot! What's there to say, though? If you have scripting/programming experience, learn pawn (read pawn documentation and such). If you don't have any scripting experience yet you're maybe better off finding existing scripts, try to understand them, alter them or maybe attempt to remake them. (And also then, read docs). https://raw.githubusercontent.com/compuphase/pawn/master/doc/Pawn_Language_Guide.pdf We could tell you how to create a car ownership script and car spawning system but creating it your own is so much better for the sake of learning (and more fun).
s
"creating it your own is so much better for the sake of learning (and more fun)." This i completelyagree, just that i cant figure it out for the life of me, i have read a little bit of Pawn documentation, and i've been through a lot, and i mean a lot, of other scripts, i do understand most of the stuff in them, but never to the point of figuring out the system im aiming for.
d
Well, here's a few links to help you on the way then. https://github.com/pBlueG/SA-MP-MySQL/wiki - Wiki of the MySQL plugin for SA-MP. If you didn't download that plugin yet, you can fetch it from the releases page https://sampwiki.blast.hk/wiki/CreateVehicle - Function to spawn vehicles - see related functions as well) And in case you want some kind of example: https://pastebin.com/Xecfs975 - Some random vehicle dealership filterscript I found via Google. Few notes after a quick look: - Try not to use unthreaded queries like this script does (see:
mysql_tquery()
on mysql plugin wiki) - This script is intended as a filterscript. Therefor all functions declared with
stock
probably should not had been declared with
stock
. See pawn language guide if you have not idea what
stock
does - You might want to use y_commands instead of zcmd. You can grab the YSI library here: https://github.com/pawn-lang/YSI-Includes (which comes with many many many more benefits, such as support for inline functions for MySQL threaded queries, eg https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Coding/y_inline/features.md#login-dialog and hooking functions) - Player variable names (PVar functions) in this script are stupid. Also, you might want to use regular variables instead. If this doesn't help you in the proper direction... then I have no idea what will :-) Oh and also: https://www.open.mp/docs/scripting/language/Style
s
Thank you, will look through this the second i have some time