SA-MP Forums Archive
Vechicle system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vechicle system (/showthread.php?tid=447392)



Vechicle system - cristip - 29.06.2013

Hi, how i extract diffrent spawn positions for vehicles with mysql and spawn the vehicles?


Re: Vechicle system - Vince - 29.06.2013

What have you tried so far? There are plenty of MySQL tutorials to be found around here.


Re: Vechicle system - cristip - 29.06.2013

i have searched but no luck, a question, how spawn vehicles with coodonates from database? and each to have different pos coodonates


Re: Vechicle system - Firewire - 29.06.2013

You set the co-ordinates yourself through a command that will 'INSERT' or 'UPDATE' existing rows in a table.

I suggest looking at this if you have absolutely no clue what to do.
https://sampforum.blast.hk/showthread.php?tid=186495

- Firewire


Re: Vechicle system - cristip - 29.06.2013

Quote:
Originally Posted by Firewire
Посмотреть сообщение
You set the co-ordinates yourself through a command that will 'INSERT' or 'UPDATE' existing rows in a table.

I suggest looking at this if you have absolutely no clue what to do.
https://sampforum.blast.hk/showthread.php?tid=186495

- Firewire
My question how to made that Query wich Selects the vehicles? to have each different pos


Re: Vechicle system - Firewire - 29.06.2013

Go back over and re-read the post, it tells you how the data is selected through the function and assigned by the SSCANF 'e' enum parameter.

This is what you're looking for back in the post, this is how the data is selected and assigned.
PHP код:
stock LoadVehicles() // You might want to make this an public so you could call it on an timer.
{
    new 
Query[255], id;
    
format(Querysizeof(Query), "SELECT * FROM vehicles"); // Formats the query for "mysql_query"
    
mysql_query(Query); // Querys the "Query" Variable.
    
mysql_store_result(); // Stores the result from Query
    
while(mysql_fetch_row(Query,"|")) // Splits the row
    
{
        
id LoadedInfo[Vehicles];
        
sscanf(Query"p<|>e<is[25]iiffff>"VehicleInfo[id]); // Pretty neat ehh? [ ID, OWNER, MODEL, PRICE, POS X, POS Y, POS Z, POS A ]
        
new Color1 random(126); new Color2 random(126);
        
CreateVehicle(VehicleInfo[id][Model],VehicleInfo[id][Pos][X],VehicleInfo[id][Pos][Y],VehicleInfo[id][Pos][Z],VehicleInfo[id][Pos][R],Color1,Color260*10000);
        
LoadedInfo[Vehicles] = LoadedInfo[Vehicles] + 1;
    }

- Firewire


Re: Vechicle system - cristip - 29.06.2013

instead of this while(mysql_fetch_row(Query,"|")) with mysql r7 how i do?


Re: Vechicle system - Firewire - 29.06.2013

You can use mysql_fetch_row_format simply because when it is used the row pointer is automatically increased so you don't have to use a loop or a variable(commonly 'i++') to increase the row.

- Firewire


Re: Vechicle system - cristip - 29.06.2013

Quote:
Originally Posted by Firewire
Посмотреть сообщение
You can use mysql_fetch_row_format simply because when it is used the row pointer is automatically increased so you don't have to use a loop or a variable(commonly 'i++') to increase the row.

- Firewire
This?

Код:
 while(mysql_fetch_row_format(Query,"|"))
I use Mysql R7