Script won't load to much mysql data.
#1

Hey,

I wanted to test my script and when I join it takes really long so I thought there must be something wrong.
Then after a few minutes it sais Server Lost Connection and then I noticed that my console closed...

The LOG doesn't show anything.

Код:
SA-MP Dedicated Server
----------------------
v0.3x, ©2005-2013 SA-MP Team

[10:45:33] filterscripts = ""  (string)
[10:45:33] 
[10:45:33] Server Plugins
[10:45:33] --------------
[10:45:33]  Loading plugin: mysql
[10:45:33] 

  > MySQL plugin R7 successfully loaded.

[10:45:33]   Loaded.
[10:45:33]  Loading plugin: Whirlpool
[10:45:33]  
[10:45:33]  ==================
[10:45:33]  
[10:45:33]   Whirlpool loaded
[10:45:33]  
[10:45:33]  ==================
[10:45:33]  
[10:45:33]   Loaded.
[10:45:33]  Loading plugin: streamer
[10:45:33] 

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[10:45:33]   Loaded.
[10:45:33]  Loaded 3 plugins.

[10:45:34] 
[10:45:34] Filterscripts
[10:45:34] ---------------
[10:45:34]   Loaded 0 filterscripts.

[10:45:34]  
[10:45:34]  
[10:45:34]  
[10:45:34]  ======================================= 
[10:45:34]  |                                     | 
[10:45:34]  |        YSI version 1.06.0002        | 
[10:45:34]  |        By Alex "******" Cole        | 
[10:45:34]  |                                     | 
[10:45:34]  ======================================= 
[10:45:34]  
[10:45:34]  
[10:45:34]  
[10:45:34]  * Connecting to MySQL: Success
[10:45:35]  
[10:45:35]  
[10:45:35] -----------------------GAMEMODE LOADING-----------------------
[10:45:35] ------------- Gamemode created by: Stefantjuh97 --------------
[10:45:35] --------------- Email: Stefantjuh97@gmail.com ----------------
[10:45:35] -----------------------GAMEMODE  LOADED-----------------------
[10:45:35]  
[10:45:35]  
[10:45:35] Number of vehicle models: 0
[10:45:35] [System] Faction 1 with faction name: Los Santos Police Department spawned.
[10:45:35] [System] Faction 2 with faction name: Los Santos Emergency Services spawned.
[10:45:35] [System] Faction 3 with faction name: Federal Bureau of Investigations spawned.
[10:45:35] [System] Faction 4 with faction name: Cable News Network spawned.
[10:45:35] [System] Faction 5 with faction name: Taxi Company spawned.
[10:45:37] Incoming connection: 25.137.80.58:53059
[10:45:37] [join] Danny_Williams has joined the server (0:25.137.80.58)
I started ******ing and I saw a topic that it could be the mysql data so I checked my log and it turns out that it has something to do with this.

pawn Код:
stock InitFactions()
{
    new query[400];
    for(new id; id < MAX_FACTIONS; id++) // Goes through all the slots, looking for the data
    {
        format(query, sizeof(query), "SELECT * FROM `Factions` WHERE `FactionID` = %d", id); // Selects all the information from the table
        mysql_function_query(connectionHandle, query, true, "LoadFactionsCallback", "d", id);
    }
    return 1;
}

stock InitVehicles()
{
    new query[400];
    for(new id; id < MAX_VEHICLES; id++) // Goes through all the slots, looking for the data
    {
        format(query, sizeof(query), "SELECT * FROM `Vehicles` WHERE `CarFileID` = %d", id); // Selects all the information from the table
        mysql_function_query(connectionHandle, query, true, "LoadVehiclesCallback", "d", id);
    }
    return 1;
}

stock InitHouses()
{
    new query[400];
    for(new id; id < MAX_HOUSES; id++) // Goes through all the slots, looking for the data
    {
        format(query, sizeof(query), "SELECT * FROM `Houses` WHERE `HouseID` = %d", id); // Selects all the information from the table
        mysql_function_query(connectionHandle, query, true, "LoadHousesCallback", "d", id);
    }
    return 1;
}
I think it is that because when I check MYSQL log it is FULL of Spam of these things.

Look at this:

Код:
[10:51:42] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 0 | d
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Query was successful. (SELECT * FROM `Vehicles` WHERE `CarFileID` = 0)
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Data caching enabled.
[10:51:42] CMySQLHandler::StoreResult() - Result was stored.
[10:51:42] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:51:42] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:51:42] LoadVehiclesCallback(d) - Threaded function called.
[10:51:42] >> cache_get_data( Connection handle: 1 )
[10:51:42] ProcessTick() - The cache has been cleared.
[10:51:42] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 1 | d
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Query was successful. (SELECT * FROM `Vehicles` WHERE `CarFileID` = 1)
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Data caching enabled.
[10:51:42] CMySQLHandler::StoreResult() - Result was stored.
[10:51:42] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:51:42] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:51:42] LoadVehiclesCallback(d) - Threaded function called.
[10:51:42] >> cache_get_data( Connection handle: 1 )
[10:51:42] ProcessTick() - The cache has been cleared.
[10:51:42] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 2 | d
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Query was successful. (SELECT * FROM `Vehicles` WHERE `CarFileID` = 2)
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Data caching enabled.
[10:51:42] CMySQLHandler::StoreResult() - Result was stored.
[10:51:42] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:51:42] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:51:42] LoadVehiclesCallback(d) - Threaded function called.
[10:51:42] >> cache_get_data( Connection handle: 1 )
[10:51:42] ProcessTick() - The cache has been cleared.
[10:51:42] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 3 | d
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Query was successful. (SELECT * FROM `Vehicles` WHERE `CarFileID` = 3)
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Data caching enabled.
[10:51:42] CMySQLHandler::StoreResult() - Result was stored.
[10:51:42] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:51:42] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:51:42] LoadVehiclesCallback(d) - Threaded function called.
[10:51:42] >> cache_get_data( Connection handle: 1 )
[10:51:42] ProcessTick() - The cache has been cleared.
[10:51:42] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 4 | d
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Query was successful. (SELECT * FROM `Vehicles` WHERE `CarFileID` = 4)
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Data caching enabled.
[10:51:42] CMySQLHandler::StoreResult() - Result was stored.
[10:51:42] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:51:42] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:51:42] LoadVehiclesCallback(d) - Threaded function called.
[10:51:42] >> cache_get_data( Connection handle: 1 )
[10:51:42] ProcessTick() - The cache has been cleared.
[10:51:42] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 5 | d
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Query was successful. (SELECT * FROM `Vehicles` WHERE `CarFileID` = 5)
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Data caching enabled.
[10:51:42] CMySQLHandler::StoreResult() - Result was stored.
[10:51:42] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:51:42] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:51:42] LoadVehiclesCallback(d) - Threaded function called.
[10:51:42] >> cache_get_data( Connection handle: 1 )
[10:51:42] ProcessTick() - The cache has been cleared.
[10:51:42] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 6 | d
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Query was successful. (SELECT * FROM `Vehicles` WHERE `CarFileID` = 6)
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Data caching enabled.
[10:51:42] CMySQLHandler::StoreResult() - Result was stored.
[10:51:42] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:51:42] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:51:42] LoadVehiclesCallback(d) - Threaded function called.
[10:51:42] >> cache_get_data( Connection handle: 1 )
[10:51:42] ProcessTick() - The cache has been cleared.
[10:51:42] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 7 | d
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Query was successful. (SELECT * FROM `Vehicles` WHERE `CarFileID` = 7)
[10:51:42] ProcessQueryThread(LoadVehiclesCallback) - Data caching enabled.
[10:51:42] CMySQLHandler::StoreResult() - Result was stored.
[10:51:42] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:51:42] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:51:42] LoadVehiclesCallback(d) - Threaded function called.
[10:51:42] >> cache_get_data( Connection handle: 1 )
[10:51:42] ProcessTick() - The cache has been cleared.
up to the 2000...

and

Код:
[10:52:04] ProcessTick() - The cache has been cleared.
[10:52:04] Passing query SELECT * FROM `Houses` WHERE `HouseID` = 1 | d
[10:52:04] ProcessQueryThread(LoadHousesCallback) - Query was successful. (SELECT * FROM `Houses` WHERE `HouseID` = 1)
[10:52:04] ProcessQueryThread(LoadHousesCallback) - Data caching enabled.
[10:52:04] CMySQLHandler::StoreResult() - Result was stored.
[10:52:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:52:04] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:52:04] LoadHousesCallback(d) - Threaded function called.
[10:52:04] >> cache_get_data( Connection handle: 1 )
[10:52:04] ProcessTick() - The cache has been cleared.
[10:52:04] Passing query SELECT * FROM `Houses` WHERE `HouseID` = 2 | d
[10:52:04] ProcessQueryThread(LoadHousesCallback) - Query was successful. (SELECT * FROM `Houses` WHERE `HouseID` = 2)
[10:52:04] ProcessQueryThread(LoadHousesCallback) - Data caching enabled.
[10:52:04] CMySQLHandler::StoreResult() - Result was stored.
[10:52:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:52:04] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:52:04] LoadHousesCallback(d) - Threaded function called.
[10:52:04] >> cache_get_data( Connection handle: 1 )
[10:52:04] ProcessTick() - The cache has been cleared.
[10:52:04] Passing query SELECT * FROM `Houses` WHERE `HouseID` = 3 | d
[10:52:04] ProcessQueryThread(LoadHousesCallback) - Query was successful. (SELECT * FROM `Houses` WHERE `HouseID` = 3)
[10:52:04] ProcessQueryThread(LoadHousesCallback) - Data caching enabled.
[10:52:04] CMySQLHandler::StoreResult() - Result was stored.
[10:52:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:52:04] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:52:04] LoadHousesCallback(d) - Threaded function called.
[10:52:04] >> cache_get_data( Connection handle: 1 )
[10:52:04] ProcessTick() - The cache has been cleared.
[10:52:04] Passing query SELECT * FROM `Houses` WHERE `HouseID` = 4 | d
[10:52:04] ProcessQueryThread(LoadHousesCallback) - Query was successful. (SELECT * FROM `Houses` WHERE `HouseID` = 4)
[10:52:04] ProcessQueryThread(LoadHousesCallback) - Data caching enabled.
[10:52:04] CMySQLHandler::StoreResult() - Result was stored.
[10:52:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:52:04] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:52:04] LoadHousesCallback(d) - Threaded function called.
[10:52:04] >> cache_get_data( Connection handle: 1 )
[10:52:04] ProcessTick() - The cache has been cleared.
[10:52:04] Passing query SELECT * FROM `Houses` WHERE `HouseID` = 5 | d
[10:52:04] ProcessQueryThread(LoadHousesCallback) - Query was successful. (SELECT * FROM `Houses` WHERE `HouseID` = 5)
[10:52:04] ProcessQueryThread(LoadHousesCallback) - Data caching enabled.
[10:52:04] CMySQLHandler::StoreResult() - Result was stored.
[10:52:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:52:04] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:52:04] LoadHousesCallback(d) - Threaded function called.
[10:52:04] >> cache_get_data( Connection handle: 1 )
[10:52:04] ProcessTick() - The cache has been cleared.
[10:52:04] Passing query SELECT * FROM `Houses` WHERE `HouseID` = 6 | d
[10:52:04] ProcessQueryThread(LoadHousesCallback) - Query was successful. (SELECT * FROM `Houses` WHERE `HouseID` = 6)
[10:52:04] ProcessQueryThread(LoadHousesCallback) - Data caching enabled.
[10:52:04] CMySQLHandler::StoreResult() - Result was stored.
[10:52:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:52:04] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[10:52:04] LoadHousesCallback(d) - Threaded function called.
[10:52:04] >> cache_get_data( Conne
up to the 1000...

and maybe like a thousand times

Код:
[10:51:41] >> mysql_query_callback( Connection handle: 1 )
at the beginning
Reply
#2

That's what you get when you enable debugging. Show us OnPlayerConnect. Maybe something else is the problem.
Reply
#3

pawn Код:
public OnPlayerConnect(playerid)
{
    FadePlayerConnect(playerid);
    pTeleporting[playerid]= 0;
    //=================SPEEDO================
    speed[playerid] = TextDrawCreate(460.000000, 370.000000, "_");
    TextDrawBackgroundColor(speed[playerid], 255);
    TextDrawFont(speed[playerid], 1);
    TextDrawLetterSize(speed[playerid], 0.469999, 1.500000);
    TextDrawColor(speed[playerid], -1);
    TextDrawSetOutline(speed[playerid], 1);
    TextDrawSetProportional(speed[playerid], 1);

    td_fuel[playerid] = TextDrawCreate(459.000000, 385.000000, "_");
    TextDrawBackgroundColor(td_fuel[playerid], 255);
    TextDrawFont(td_fuel[playerid], 1);
    TextDrawLetterSize(td_fuel[playerid], 0.469900, 1.500000);
    TextDrawColor(td_fuel[playerid], -1);
    TextDrawSetOutline(td_fuel[playerid], 1);
    TextDrawSetProportional(td_fuel[playerid], 1);

    td_vhealth[playerid] = TextDrawCreate(460.000000, 400.000000, "_");
    TextDrawBackgroundColor(td_vhealth[playerid], 255);
    TextDrawFont(td_vhealth[playerid], 1);
    TextDrawLetterSize(td_vhealth[playerid], 0.469900, 1.500000);
    TextDrawColor(td_vhealth[playerid], -1);
    TextDrawSetOutline(td_vhealth[playerid], 1);
    TextDrawSetProportional(td_vhealth[playerid], 1);
    //=================SCORE================
    TName[playerid] = TextDrawCreate(190.000000, 129.000000, "");
    TextDrawBackgroundColor(TName[playerid], 255);
    TextDrawFont(TName[playerid], 1);
    TextDrawLetterSize(TName[playerid], 0.529999, 2.200000);
    TextDrawColor(TName[playerid], 65535);
    TextDrawSetOutline(TName[playerid], 1);
    TextDrawSetProportional(TName[playerid], 1);
   
    Good[playerid] = TextDrawCreate(190.000000, 175.000000, "");
    TextDrawBackgroundColor(Good[playerid], 255);
    TextDrawFont(Good[playerid], 1);
    TextDrawLetterSize(Good[playerid], 0.529900, 2.200000);
    TextDrawColor(Good[playerid], 16711935);
    TextDrawSetOutline(Good[playerid], 1);
    TextDrawSetProportional(Good[playerid], 1);

    Wrong[playerid] = TextDrawCreate(190.000000, 206.000000, "");
    TextDrawBackgroundColor(Wrong[playerid], 255);
    TextDrawFont(Wrong[playerid], 1);
    TextDrawLetterSize(Wrong[playerid], 0.529900, 2.200000);
    TextDrawColor(Wrong[playerid], -16776961);
    TextDrawSetOutline(Wrong[playerid], 1);
    TextDrawSetProportional(Wrong[playerid], 1);
   
    TextDrawShowForPlayer(playerid, Text:BGBox);
    TextDrawShowForPlayer(playerid, Text:Titleline);
    TextDrawShowForPlayer(playerid, Text:Servertitle);
    TextDrawShowForPlayer(playerid, Text:LLine);
    TextDrawShowForPlayer(playerid, Text:LLine1);
    TextDrawShowForPlayer(playerid, Text:LLine2);
    TextDrawShowForPlayer(playerid, Text:Copyright);
    TextDrawShowForPlayer(playerid, Text:TDVersion);
    TextDrawShowForPlayer(playerid, Text:Loading);
   
    SetPlayerColor(playerid, GREY);
    SetPlayerCamera(playerid, 1415.0320, -1749.1689, 29.9612, 1415.7621, -1748.4803, 29.7203, false);
    TogglePlayerSpectating(playerid, true);

    GetPlayerIp(playerid, PlayerIP[playerid], 16);
   
    new query[2000];
    format(query, sizeof(query), "SELECT * FROM `Bans` WHERE `Username` = '%s' OR `Ipaddress` = '%s'", GetName(playerid), PlayerIP[playerid]);
    mysql_function_query(connectionHandle, query, true, "BansCallback", "d", playerid);
   
    //TextDrawShowForPlayer(playerid, Text:Loading);
    PlayerPlaySound(playerid, 1062, 0.0, 0.0, 0.0);
   
    //ASGH carpark
    RemoveBuildingForPlayer(playerid, 780, -209.1641, 1005.5625, 18.1797, 0.25);
    RemoveBuildingForPlayer(playerid, 5929, 1230.8906, -1337.9844, 12.5391, 0.25);
    RemoveBuildingForPlayer(playerid, 739, 1231.1406, -1341.8516, 12.7344, 0.25);
    RemoveBuildingForPlayer(playerid, 739, 1231.1406, -1328.0938, 12.7344, 0.25);
    RemoveBuildingForPlayer(playerid, 739, 1231.1406, -1356.2109, 12.7344, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1222.6641, -1374.6094, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1222.6641, -1356.5547, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 1297, 1231.6406, -1389.8672, 15.6719, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1240.9219, -1374.6094, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1240.9219, -1356.5547, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1222.6641, -1335.0547, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1222.6641, -1317.7422, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 5812, 1230.8906, -1337.9844, 12.5391, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1240.9219, -1335.0547, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1240.9219, -1317.7422, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1222.6641, -1300.9219, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1240.9219, -1300.9219, 12.2969, 0.25);

    //PD
    RemoveBuildingForPlayer(playerid, 1266, 1538.5234, -1609.8047, 19.8438, 0.25);
    RemoveBuildingForPlayer(playerid, 4229, 1597.9063, -1699.7500, 30.2109, 0.25);
    RemoveBuildingForPlayer(playerid, 4230, 1597.9063, -1699.7500, 30.2109, 0.25);
    RemoveBuildingForPlayer(playerid, 1260, 1538.5234, -1609.8047, 19.8438, 0.25);
    Reset(playerid);

    return 1;
}
So you suggest I turn off Debugging?
Reply
#4

No. Keep debugging but you can clear file let's say each day. It's good if server crashes to know cause if MySQL is problem. And for this I would really say you don't need 2000 cell string for that small query.

pawn Код:
new query[128];
    format(query, sizeof(query), "SELECT * FROM `Bans` WHERE `Username` = '%s' OR `Ipaddress` = '%s'", GetName(playerid), PlayerIP[playerid]);
    mysql_function_query(connectionHandle, query, true, "BansCallback", "d", playerid);
And try to comment our MySQL part and start server. If it still crashes means MySQL isn't problem. Post here results.
Reply
#5

Do not call for loop mysql_function_query!

Try:
pawn Код:
stock InitFactions()
{
    mysql_function_query(connectionHandle, "SELECT * FROM `Factions`", true, "LoadFactionsCallback", "d", id); // Select all data in Factions table
}

forward LoadFactionsCallback(); public LoadFactionsCallback()
{
    new
        rows,
        fields;
    cache_get_data(rows, fields); // Get mysql data rows
   
    if(rows == 0) return print("Error -> empty database!");
    if(rows > MAX_FACTIONS) return print("Error -> too many data row!");
   
    for(new id; id < MAX_FACTIONS; id++)
    {      
        blabla[id][FactionID] = cache_get_row_int(id, 0);
        blabla[id][bla2] = cache_get_row_int(id, 1);
        blabla[id][bla3] = cache_get_row_float(id, 2);
        blabla[id][bla4] = cache_get_row_float(id, 3);
    }
    return 0;
}
Reply
#6

I don't think factions are problem.



Factions are obviously loaded. Server crashed on player connect.
Reply
#7

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
Factions are obviously loaded. Server crashed on player connect.
Yeah. Hence, you should debug (with some prints) your OnPlayerConnect to see where the crash comes from. Here you go, run this OnPlayerConnect and tell us what will be printed in server logs:

pawn Код:
public OnPlayerConnect(playerid)
{
    FadePlayerConnect(playerid);
    print("Faded Player");
    pTeleporting[playerid]= 0;
    //=================SPEEDO================
    speed[playerid] = TextDrawCreate(460.000000, 370.000000, "_");
    TextDrawBackgroundColor(speed[playerid], 255);
    TextDrawFont(speed[playerid], 1);
    TextDrawLetterSize(speed[playerid], 0.469999, 1.500000);
    TextDrawColor(speed[playerid], -1);
    TextDrawSetOutline(speed[playerid], 1);
    TextDrawSetProportional(speed[playerid], 1);

    td_fuel[playerid] = TextDrawCreate(459.000000, 385.000000, "_");
    TextDrawBackgroundColor(td_fuel[playerid], 255);
    TextDrawFont(td_fuel[playerid], 1);
    TextDrawLetterSize(td_fuel[playerid], 0.469900, 1.500000);
    TextDrawColor(td_fuel[playerid], -1);
    TextDrawSetOutline(td_fuel[playerid], 1);
    TextDrawSetProportional(td_fuel[playerid], 1);

    td_vhealth[playerid] = TextDrawCreate(460.000000, 400.000000, "_");
    TextDrawBackgroundColor(td_vhealth[playerid], 255);
    TextDrawFont(td_vhealth[playerid], 1);
    TextDrawLetterSize(td_vhealth[playerid], 0.469900, 1.500000);
    TextDrawColor(td_vhealth[playerid], -1);
    TextDrawSetOutline(td_vhealth[playerid], 1);
    TextDrawSetProportional(td_vhealth[playerid], 1);
    //=================SCORE================
    TName[playerid] = TextDrawCreate(190.000000, 129.000000, "");
    TextDrawBackgroundColor(TName[playerid], 255);
    TextDrawFont(TName[playerid], 1);
    TextDrawLetterSize(TName[playerid], 0.529999, 2.200000);
    TextDrawColor(TName[playerid], 65535);
    TextDrawSetOutline(TName[playerid], 1);
    TextDrawSetProportional(TName[playerid], 1);

    Good[playerid] = TextDrawCreate(190.000000, 175.000000, "");
    TextDrawBackgroundColor(Good[playerid], 255);
    TextDrawFont(Good[playerid], 1);
    TextDrawLetterSize(Good[playerid], 0.529900, 2.200000);
    TextDrawColor(Good[playerid], 16711935);
    TextDrawSetOutline(Good[playerid], 1);
    TextDrawSetProportional(Good[playerid], 1);

    Wrong[playerid] = TextDrawCreate(190.000000, 206.000000, "");
    TextDrawBackgroundColor(Wrong[playerid], 255);
    TextDrawFont(Wrong[playerid], 1);
    TextDrawLetterSize(Wrong[playerid], 0.529900, 2.200000);
    TextDrawColor(Wrong[playerid], -16776961);
    TextDrawSetOutline(Wrong[playerid], 1);
    TextDrawSetProportional(Wrong[playerid], 1);

    print("Created textdraws successfully. Now showing them");

    TextDrawShowForPlayer(playerid, Text:BGBox);
    TextDrawShowForPlayer(playerid, Text:Titleline);
    TextDrawShowForPlayer(playerid, Text:Servertitle);
    TextDrawShowForPlayer(playerid, Text:LLine);
    TextDrawShowForPlayer(playerid, Text:LLine1);
    TextDrawShowForPlayer(playerid, Text:LLine2);
    TextDrawShowForPlayer(playerid, Text:Copyright);
    TextDrawShowForPlayer(playerid, Text:TDVersion);
    TextDrawShowForPlayer(playerid, Text:Loading);
   
    print("Showed textdraws successfully");

    SetPlayerColor(playerid, GREY);
    SetPlayerCamera(playerid, 1415.0320, -1749.1689, 29.9612, 1415.7621, -1748.4803, 29.7203, false);
    TogglePlayerSpectating(playerid, true);
   
    print("Set player colour and camera, and toggled spectating");

    GetPlayerIp(playerid, PlayerIP[playerid], 16);
   
    print("Stored player IP in PlayerIP variable. Now preparing a query");

    new query[128];
    format(query, sizeof(query), "SELECT * FROM `Bans` WHERE `Username` = '%s' OR `Ipaddress` = '%s'", GetName(playerid), PlayerIP[playerid]);

    print("Formatted query successfully");

    mysql_function_query(connectionHandle, query, true, "BansCallback", "d", playerid);
   
    print("mysql_function_query has been done");

    //TextDrawShowForPlayer(playerid, Text:Loading);
    PlayerPlaySound(playerid, 1062, 0.0, 0.0, 0.0);

    //ASGH carpark
    RemoveBuildingForPlayer(playerid, 780, -209.1641, 1005.5625, 18.1797, 0.25);
    RemoveBuildingForPlayer(playerid, 5929, 1230.8906, -1337.9844, 12.5391, 0.25);
    RemoveBuildingForPlayer(playerid, 739, 1231.1406, -1341.8516, 12.7344, 0.25);
    RemoveBuildingForPlayer(playerid, 739, 1231.1406, -1328.0938, 12.7344, 0.25);
    RemoveBuildingForPlayer(playerid, 739, 1231.1406, -1356.2109, 12.7344, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1222.6641, -1374.6094, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1222.6641, -1356.5547, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 1297, 1231.6406, -1389.8672, 15.6719, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1240.9219, -1374.6094, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1240.9219, -1356.5547, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1222.6641, -1335.0547, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1222.6641, -1317.7422, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 5812, 1230.8906, -1337.9844, 12.5391, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1240.9219, -1335.0547, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1240.9219, -1317.7422, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1222.6641, -1300.9219, 12.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 620, 1240.9219, -1300.9219, 12.2969, 0.25);

    //PD
    RemoveBuildingForPlayer(playerid, 1266, 1538.5234, -1609.8047, 19.8438, 0.25);
    RemoveBuildingForPlayer(playerid, 4229, 1597.9063, -1699.7500, 30.2109, 0.25);
    RemoveBuildingForPlayer(playerid, 4230, 1597.9063, -1699.7500, 30.2109, 0.25);
    RemoveBuildingForPlayer(playerid, 1260, 1538.5234, -1609.8047, 19.8438, 0.25);
    print("Removed some buildings for player");
    Reset(playerid);
    printf("End of OnPlayerConnect(%d)", playerid);
    return 1;
}
Reply
#8

Quote:
Originally Posted by smeti
Посмотреть сообщение
Do not call for loop mysql_function_query!

Try:
pawn Код:
stock InitFactions()
{
    mysql_function_query(connectionHandle, "SELECT * FROM `Factions`", true, "LoadFactionsCallback", "d", id); // Select all data in Factions table
}

forward LoadFactionsCallback(); public LoadFactionsCallback()
{
    new
        rows,
        fields;
    cache_get_data(rows, fields); // Get mysql data rows
   
    if(rows == 0) return print("Error -> empty database!");
    if(rows > MAX_FACTIONS) return print("Error -> too many data row!");
   
    for(new id; id < MAX_FACTIONS; id++)
    {      
        blabla[id][FactionID] = cache_get_row_int(id, 0);
        blabla[id][bla2] = cache_get_row_int(id, 1);
        blabla[id][bla3] = cache_get_row_float(id, 2);
        blabla[id][bla4] = cache_get_row_float(id, 3);
    }
    return 0;
}
Still getting crashes...
Reply
#9

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
I don't think factions are problem.



Factions are obviously loaded. Server crashed on player connect.
It goes through this aswel when someone connects.

pawn Код:
public LoadCallback(playerid)
{
    //TextDrawHideForPlayer(playerid, Text:BGBox);
    //TextDrawHideForPlayer(playerid, Text:Loading);
    new
        rows,
        fields;

    cache_get_data(rows, fields);
    if(rows == 1)
    {
        new temp[100];
        cache_get_row(0, 0, temp); // #0 = #1 in the DB
        Player[playerid][UserID] = strval(temp);
        cache_get_row(0, 2, Player[playerid][Password]);
        cache_get_row(0, 3, Player[playerid][LastIP]);
        cache_get_row(0, 4, temp);
        Player[playerid][Adminlevel] = strval(temp);
        cache_get_row(0, 5, temp);
        Player[playerid][Money] = strval(temp);
        cache_get_row(0, 6, temp);
        Player[playerid][RegTime] = strval(temp);
        cache_get_row(0, 7, temp);
        Player[playerid][LastOn] = strval(temp);
        cache_get_row(0, 8, temp);
        Player[playerid][Level] = strval(temp);
        cache_get_row(0, 9, temp);
        Player[playerid][Gender] = strval(temp);
        cache_get_row(0, 10, temp);
        Player[playerid][Age] = strval(temp);
        cache_get_row(0, 11, temp);
        Player[playerid][Health] = floatstr(temp);
        cache_get_row(0, 12, temp);
        Player[playerid][Armour] = floatstr(temp);
        cache_get_row(0, 13, temp);
        Player[playerid][Skin] = strval(temp);
        cache_get_row(0, 14, Player[playerid][Country]);
        cache_get_row(0, 15, temp);
        Player[playerid][Test] = strval(temp);
        cache_get_row(0, 16, temp);
        Player[playerid][Faction] = strval(temp);
        cache_get_row(0, 17, temp);
        Player[playerid][FactionRank] = strval(temp);
        cache_get_row(0, 18, Player[playerid][FactionRankName]);
        cache_get_row(0, 19, temp);
        Player[playerid][PrisonSelect] = strval(temp);
        cache_get_row(0, 20, temp);
        Player[playerid][PrisonTime] = strval(temp);
        cache_get_row(0, 21, temp);
        Player[playerid][AdminPrisonCount] = strval(temp);
        cache_get_row(0, 22, temp);
        Player[playerid][SecondsLoggedIn] = strval(temp);
        cache_get_row(0, 23, temp);
        Player[playerid][PlayingHours] = strval(temp);
        cache_get_row(0, 24, temp);
        Player[playerid][AdminCode] = strval(temp);
        cache_get_row(0, 25, temp);
        Player[playerid][PhoneN] = strval(temp);
        cache_get_row(0, 26, temp);
        Player[playerid][PhoneCredit] = strval(temp);
        cache_get_row(0, 27, temp);
        Player[playerid][PhoneBook] = strval(temp);
        cache_get_row(0, 28, temp);
        Player[playerid][House] = strval(temp);
       
        clearPlayerChat(playerid);
        SPD(playerid, DIALOG_AUTHENTICATION);
        TextDrawHideForPlayer(playerid, Text:BGBox);
        TextDrawHideForPlayer(playerid, Text:Loading);
    }
    else if(rows == 0)
    {
        clearPlayerChat(playerid);
        new playernamesplit[3][MAX_PLAYER_NAME], Name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Name, sizeof(Name));
        split(Name, playernamesplit, '_');

        if (!strlen(playernamesplit[0]) || !strlen(playernamesplit[1]))
        {
            KickWithMessage(playerid, COLOR_WHITE, "Unfortunately, your name is not in the proper format! Please use the format of "#COL_EMB_LIGHTBLUE"\"Firstname_Lastname\""#COL_EMB_WHITE".");
        }
        else
        {
            SPD(playerid, DIALOG_REGISTER);
        }
    }
    else
    {
        clearPlayerChat(playerid);
        KickWithMessage(playerid, COLOR_WHITE, "There was a "#COL_EMB_RED"fatal error "#COL_EMB_WHITE"during registration! Please contact a developer.");
    }
    return 1;
}
Any errors here?
Reply
#10

Quote:
Originally Posted by Stefand
Посмотреть сообщение
Still getting crashes...
Sorry.
Crash invalid row ID call cache_get_row_int and cache_get_row and cache_get_row_float.

Try:
pawn Код:
stock InitFactions()
{
    mysql_function_query(connectionHandle, "SELECT * FROM `Factions`", true, "LoadFactionsCallback", "d", id); // Select all data in Factions table
}

forward LoadFactionsCallback(); public LoadFactionsCallback()
{
    new
        rows,
        fields;
    cache_get_data(rows, fields); // Get mysql data rows
   
    if(rows == 0) return print("Error -> empty database!");
    if(rows > MAX_FACTIONS) return print("Error -> too many data row!");
   
    for(new id; id < MAX_FACTIONS && id < rows; id++)
    {      
        blabla[id][FactionID] = cache_get_row_int(id, 0);
        blabla[id][bla2] = cache_get_row_int(id, 1);
        blabla[id][bla3] = cache_get_row_float(id, 2);
        blabla[id][bla4] = cache_get_row_float(id, 3);
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)