SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Archive

 
 
Thread Tools Display Modes
Old 02/01/2010, 01:36 PM   #1
Julian2574
Huge Clucker
 
Join Date: Aug 2009
Posts: 258
Reputation: 0
Default Någon här som kan MYSQL?

Sho , Ja undrar här om de finns nån svensk här som har lust o hjälpa mig gå igenom MYSQL medans man kodar om City Wide RP för en release till SA-MP spelare. Just nu har jag klarat recoda Login systemet & Connect . Problemet jag har just nu är "Ladda" upp info om bilar , Business & house.
Julian2574 is offline  
Old 02/01/2010, 02:41 PM   #2
Ozz
Big Clucker
 
Join Date: Mar 2008
Posts: 115
Reputation: 0
Default Re: Någon här som kan MYSQL?

Quote:
Originally Posted by »Julian™«
Sho , Ja undrar här om de finns nån svensk här som har lust o hjälpa mig gå igenom MYSQL medans man kodar om City Wide RP för en release till SA-MP spelare. Just nu har jag klarat recoda Login systemet & Connect . Problemet jag har just nu är "Ladda" upp info om bilar , Business & house.
nej

gör ett eget gm istället
Ozz is offline  
Old 02/01/2010, 03:19 PM   #3
Julian2574
Huge Clucker
 
Join Date: Aug 2009
Posts: 258
Reputation: 0
Default Re: Någon här som kan MYSQL?

Hehe skulle gärna om jag hade tid att studera mer .. fast måste nu studera till nationella provet o osv.. så man tar ngt simpelt ist.
Julian2574 is offline  
Old 02/01/2010, 03:39 PM   #4
Fj0rtizFredde
High-roller
 
Fj0rtizFredde's Avatar
 
Join Date: Jun 2008
Location: Sweden
Posts: 1,066
Reputation: 117
Default Re: Någon här som kan MYSQL?

Jag kan nog hjälpa på något sätt :P Om du säger vad du behöver hjälp med så fixar de sig nog
__________________
Latest crap I've made:
[Include]CleverBot - Never Be Alone Again!
Fj0rtizFredde is offline  
Old 02/01/2010, 03:41 PM   #5
Julian2574
Huge Clucker
 
Join Date: Aug 2009
Posts: 258
Reputation: 0
Default Re: Någon här som kan MYSQL?

Om du läser G-stylez topic så ser du jag har problem med att ladda upp bilarna från Mysql'n .. Fast i server_log så säger det att 236Car's have been loaded men IG så finns dom inte och när jag gör /gotocar 1 so hamnar jag mitten av blueberry inne i en hus...
EDIT: Här e koden av "Ladda" upp info från mysqln:
..
pawn Code:
//-[ Load cars info from SQL database ]-----------------------------------------------------------------
public LoadSQLVehicleInfo() {
    new sql[64], row[255];
    new f[32][32];
    format(sql, sizeof(sql), "SELECT COUNT(*) FROM vehicles");
    mysql_query(sql);
    //if (DEBUG) SQLLog(sql);
    mysql_store_result();
    mysql_fetch_row(row);
    totalvehicles = strval(row);
    mysql_free_result();
   
    for (new i=0; i<totalvehicles; i++)
    {
    format(sql, sizeof(sql), "SELECT * FROM vehicles WHERE id=%d", i);
    mysql_query(sql);
    //if (DEBUG) SQLLog(sql);
    mysql_store_result();
    mysql_fetch_row(row);
    split(row, f, '|');
    mysql_free_result();
    }
}
//-[ Load gps locations from database ]-----------------------------------------------------------------
public LoadSQLGPS()
{
    new sql[64], f[8][64], row[256];
    format(sql, sizeof(sql), "SELECT COUNT(*) FROM gps");
    mysql_query(sql);
    mysql_store_result();
    mysql_fetch_row(row);
    mysql_free_result();
    totalgps = strval(row);
    for (new i=0; i<totalgps; i++)
    {
      format(sql, sizeof(sql), "SELECT * FROM gps ORDER BY name LIMIT %d,1", i);
      mysql_query(sql);
      mysql_store_result();
      if (mysql_num_rows() > 0)
      {
          mysql_fetch_row(row);
          split(row, f, '|');
          mysql_free_result();
            strmid(GPSInfo[i][gpsName], f[0], 0, 32, 32);
            strmid(GPSInfo[i][gpsDesc], f[1], 0, 64, 64);
            GPSInfo[i][gpsx] = floatstr(f[2]);
            GPSInfo[i][gpsy] = floatstr(f[3]);
            GPSInfo[i][gpsz] = floatstr(f[4]);
            format(row, sizeof(row), "GPS:%d, Name:%s, Desc:%s, x:%f, y:%f, z:%f",
            i, GPSInfo[i][gpsName], GPSInfo[i][gpsDesc], GPSInfo[i][gpsx], GPSInfo[i][gpsy], GPSInfo[i][gpsz]);
            printf("%s", row);
      }
    }
}
//-[ Load cars from SQL database ]----------------------------------------------------------------------
public LoadSQLCars() {
    MySQLCheckConnection();
    new sql[64], fields[25][40], row[255];
    new Float:park_x, Float:park_y, Float:park_z, Float:park_a;
//  new owner[MAX_PLAYER_NAME];
    format(sql, sizeof(sql), "SELECT COUNT(*) FROM cars");
    mysql_query(sql);
    //if (DEBUG) SQLLog(sql);
    mysql_store_result();
    mysql_fetch_row(row);
    totalcars = strval(row);
    mysql_free_result();
    for (new i=1; i<=totalcars; i++)
    {
    format(sql, sizeof(sql), "SELECT * FROM cars WHERE id=%d", i);
    mysql_query(sql);
    //if (DEBUG) SQLLog(sql);
    mysql_store_result();
    mysql_fetch_row(row);
    split(row, fields, '|');
    mysql_free_result();
//  carid = strval(fields[0]);
    CarInfo[i][cModel] = strval(fields[1]);
    CarInfo[i][cLocationx] = floatstr(fields[2]);
    CarInfo[i][cLocationy] = floatstr(fields[3]);
    CarInfo[i][cLocationz] = floatstr(fields[4]);
    CarInfo[i][cAngle]   = floatstr(fields[5]);
    park_x = floatstr(fields[6]);
    park_y = floatstr(fields[7]);
    park_z = floatstr(fields[8]);
    park_a = floatstr(fields[9]);
   
    if (park_x != 0 && park_y != 0 && park_z != 0)
      {
    CarInfo[i][cLocationx] = park_x;
        CarInfo[i][cLocationy] = park_y;
        CarInfo[i][cLocationz] = park_z;
        CarInfo[i][cAngle] = park_a;
      }
   
    CarInfo[i][cColorOne] = strval(fields[10]);
    CarInfo[i][cColorTwo] = strval(fields[11]);
    CarInfo[i][cOwned] = strval(fields[12]);
    memcpy(CarInfo[i][cOwner], fields[13], 0, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4);
    memcpy(CarInfo[i][cDescription], fields[17], 0, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4);
    CarInfo[i][cValue] = strval(fields[18]);
    CarInfo[i][cFamily] = strval(fields[15]);
    CarInfo[i][cFaction] = strval(fields[14]);
    CarInfo[i][cType] = strval(fields[16]);
    CarInfo[i][cRespawnable] = strval(fields[19]);
    CarInfo[i][cRespawnTime] = 0;
    CarInfo[i][cLock] = strval(fields[20]); // Locked
    CarInfo[i][cHouse] = strval(fields[22]);
    if (carsreloaded==0) AddStaticVehicleEx(CarInfo[i][cModel], CarInfo[i][cLocationx], CarInfo[i][cLocationy], CarInfo[i][cLocationz]+0.25, CarInfo[i][cAngle], CarInfo[i][cColorOne], CarInfo[i][cColorTwo], CarInfo[i][cValue]);
        else CarRespawn(i);
//  printf("Car: %d, Model: %d, Owner: %s, Type: %d, Desc: %s", i, CarInfo[i][cModel], CarInfo[i][cOwner], CarInfo[i][cType], CarInfo[i][cDescription]);
    }
    carsreloaded++;
    format(row, sizeof(row), "LoadSQLCars(): %d cars loaded", totalcars);
    printf(row);
}
Julian2574 is offline  
Old 02/01/2010, 09:59 PM   #6
Balon
Big Clucker
 
Join Date: Oct 2007
Posts: 178
Reputation: 2
Default Re: Någon här som kan MYSQL?

Jag föreslår att du läser lite mer om SQL.

pawn Code:
new sql[64], row[255];
    new f[32][32];
    format(sql, sizeof(sql), "SELECT COUNT(*) FROM vehicles");
    mysql_query(sql);
    //if (DEBUG) SQLLog(sql);
    mysql_store_result();
    mysql_fetch_row(row);
    totalvehicles = strval(row);
    mysql_free_result();

Det är ingen mening med detta. Lika bra man gör

pawn Code:
new sql[128];
format(sql, sizeof(sql), "SELECT * FROM `vehicles`");
mysql_query(sql);
mysql_store_result();
if(mysql_num_rows() > 0) // antal fordon
{
  while(mysql_fetch_row_format(sql) == 1)
  {
    // nu har du allt du behöver om fordon i "sql"
  }
}
mysql_free_result();

Hoppas du förstår vad jag menar. Om du inte gör det så bättre att du läser lite mer om MySQL.
Balon is offline  
Old 02/01/2010, 10:14 PM   #7
Julian2574
Huge Clucker
 
Join Date: Aug 2009
Posts: 258
Reputation: 0
Default Re: Någon här som kan MYSQL?

Ja jag förstår :P Tackar
Julian2574 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Help][Mysql]Connecting to Mysql from the script.. Mowgli Help Archive 8 24/07/2011 03:44 PM
Kan någon hjälpa mig lite? Badness Archive 6 30/12/2009 08:20 PM
MySQL Tomejus Help Archive 6 24/12/2009 11:01 PM
Någon SAMP spelare som ska till DH? (: Joel_Krantz Archive 6 26/11/2009 06:18 PM
MYSQL Help! EverliteGaming Help Archive 10 26/09/2009 04:24 PM


All times are GMT. The time now is 08:21 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.