Get String MySql to Spawn Vehicle
#1

Hi Guys,
I have problem, I don't know how I can try a method to get a string from my db and to use the information received from the string.
This is an example.

Thi is my db (test=>playervehicles)
I want to spawn all vehicle in my db.
How Can I do it?
Reply
#2

I want to Spawn all vehicle in the list, I think isn't difficult!
Reply
#3

Please Help me!
Reply
#4

Are you using the R7 mysql plugin or the R6 mysql plugin? You also should be saving the floats in the database as floats / strings rather than ints because those positions that you have don't exist without a '.' in the middle .
Reply
#5

I use R5 version, for the float i fix them now
Reply
#6

Please help me!
Reply
#7

UP!!!
Reply
#8

You can use a select statement to get all information about the vehicle:
SELECT * FROM playervehicles

Then you can retrieve the info like this:
new ret = mysql_query("SELECT * FROM playervehicles");
new row;
while(row = mysql_fetch_array(ret)) {
CreateVehicle(pvModel, pvPosX, pvPosY, pvPosZ, pvPosZAngle, pvColor1, pvColor2);
}

If you want to save the owner etc as well then you'd have to set your variables in the enum for the vehicle info.

Disclaimer: This post contains no actual working code. You'd have to edit this code for it to work as this is only an example. My mysql plugin version is R7 so it works differently. I'd recommend you update your plugin to R7 as well as it is way faster
Reply
#9

I use R5
Reply
#10

That is very nice of you. I gave you an example, it is your job to finish the code We aren't here to give you copy -paste code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)