MySQL Gamemodes
#1

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
Reply
#2

Look at scripts like Modernitopia
Reply
#3

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;
}
Reply
#4

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.
Reply
#5

get a function /savecar let that save all the stuff in the database
Reply
#6

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);
Reply
#7

cmon, what do i put in the SQL file
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)