PDA

View Full Version : server crash


Ax3l123
16/04/2016, 12:07 PM
The server is not loading the gamemode
CrashDetect:
[15:08:57] [debug] Server crashed while executing GM.amx
[15:08:57] [debug] AMX backtrace:
[15:08:57] [debug] #0 native mysql_connect () [709adf10] from mysql.dll
[15:08:57] [debug] #1 0000780c in public SSCANF_OnGameModeInit () from GM.amx
[15:08:57] [debug] #2 00001b80 in public Itter_OnGameModeInit () from GM.amx
[15:08:57] [debug] #3 native CallLocalFunction () [004743b0] from samp-server.exe
[15:08:57] [debug] #4 00001120 in public ScriptInit_OnGameModeInit () from GM.amx
[15:08:57] [debug] #5 0000092c in public zcmd_OnGameModeInit () from GM.amx
[15:08:57] [debug] #6 native CallLocalFunction () [004743b0] from samp-server.exe
[15:08:57] [debug] #7 00000158 in public OnGameModeInit () from GM.amx
http://pastebin.com/Gne02Sx1

#include <a_samp>
#include <zcmd>
#include <a_mysql>
#include <foreach>
#include <sscanf2>
//Defines
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_LOGIN2 3

new SQL = -1;
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by Eclipse");
print("----------------------------------\n");
}

public OnGameModeInit()
{
SQL = mysql_connect("localhost", "root", "db", "");

SetGameModeText("RPG");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);

return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerConnect(playerid)
{
new string[128];
format(string,sizeof(string),"SELECT * FROM `users` WHERE nume='%s'",GetName(playerid));
mysql_query(SQL,string);
mysql_store_result();
if(mysql_num_rows() > 0)
{
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login","Bine ai revenit pe server","Login","Quit");
}
else
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Register","Bine ai venit pe server,Introdu o parola pentru a te inregistra ","Login","Register");
}
mysql_free_result();
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
return 1;
}

public OnPlayerSpawn(playerid)
{
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
if(dialogid == 1)
{
new qry[128];
format(qry,sizeof(qry),"INSERT INTO `users` ('nume','password') VALUES (%s,%s)",GetName(playerid),inputtext);
mysql_query(SQL,qry);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login","Bine ai revenit pe server","Login","Quit");
}
if(dialogid == 2)
{
new qry[128];
format(qry,sizeof(qry),"SELECT * FROM `user` WHERE nume='%s' AND password='%s'",GetName(playerid),inputtext);
mysql_query(SQL,qry);
mysql_store_result();
if(mysql_num_rows() > 0)
{
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Login","Parola gresita , introdu parola corecta","Login","Quit");
}
}
}
else
{
Kick(playerid);
}
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
return name;
}

Xabi
16/04/2016, 12:27 PM
It's not connecting propertly to database. Are you sure you're using the correct credentials? Also try using the IP instead of localhost (127.0.0.1 if local)

Ax3l123
16/04/2016, 01:07 PM
FIXED
solve:

From this :
SQL = mysql_connect("localhost", "root", "db", "");
TO
SQL = mysql_connect("localhost", "root", "", "db");