MySQL Gamemodes - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL Gamemodes (
/showthread.php?tid=71053)
MySQL Gamemodes -
darkrider366 - 29.03.2009
I am writing a new gamemode and i want to make the car spawns in a MySQL database.
like i have a mysql database and when the gamemode starts the SQL db starts and the cars load.
Can someone show me or tell me how to do this. thanks, Me
Re: MySQL Gamemodes -
hamptonin - 29.03.2009
Look at scripts like Modernitopia
Re: MySQL Gamemodes -
Marcel - 29.03.2009
Here, I've created a function that loads vehicles from a MySQL database.
pawn Код:
public LoadVehicles( )
{
new line[ 1024 ] ;
samp_mysql_query( "SELECT * FROM Vehicles" );
samp_mysql_store_result( );
while( samp_mysql_fetch_row( line ) )
{
new ID , Modelid , Float:Spawn_X , Float:Spawn_Y , Float:Spawn_Z , Float:Angle , Color1 , Color2 , Respawn_delay;
sscanf( line , "p|iiffffiii" , ID , Modelid , Spawn_X , Spawn_Y , Spawn_Z , Angle , Color1 , Color2 , Respawn_delay );
CreateVehicle( Modelid , Spawn_X , Spawn_Y , Spawn_Z , Angle , Color1 , Color2 , Respawn_delay );
}
return 1;
}
Re: MySQL Gamemodes -
darkrider366 - 29.03.2009
Quote:
Originally Posted by Marcel
Here, I've created a function that loads vehicles from a MySQL database.
pawn Код:
public LoadVehicles( ) { new line[ 1024 ] ; samp_mysql_query( "SELECT * FROM Vehicles" ); samp_mysql_store_result( );
while( samp_mysql_fetch_row( line ) ) { new ID , Modelid , Float:Spawn_X , Float:Spawn_Y , Float:Spawn_Z , Float:Angle , Color1 , Color2 , Respawn_delay; sscanf( line , "p|iiffffiii" , ID , Modelid , Spawn_X , Spawn_Y , Spawn_Z , Angle , Color1 , Color2 , Respawn_delay ); CreateVehicle( Modelid , Spawn_X , Spawn_Y , Spawn_Z , Angle , Color1 , Color2 , Respawn_delay ); } return 1; }
|
ok, thanks, now can you show me how i put a vehicle line inside a db.
Re: MySQL Gamemodes -
Think - 29.03.2009
get a function /savecar let that save all the stuff in the database
Re: MySQL Gamemodes -
darkrider366 - 29.03.2009
Quote:
Originally Posted by Pandabeer1337
get a function /savecar let that save all the stuff in the database
|
do i do this ??
Код:
-- phpMyAdmin SQL Dump
-- version 3.1.2
-- http://www.phpmyadmin.net
--
-- Machine: localhost
-- Genereertijd: 28 Mar 2009 om 02:03
-- Serverversie: 5.0.67
-- PHP-Versie: 5.2.8
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `deb16598_samp`
--
-- --------------------------------------------------------
CreateVehicle(457,450.9315,-1800.9541,5.1737,181.0410,-1,-1,30000);
CreateVehicle(457,446.4844,-1800.9568,5.1737,179.4999,-1,-1,30000);
Re: MySQL Gamemodes -
darkrider366 - 29.03.2009
cmon, what do i put in the SQL file