SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 16/04/2016, 12:07 PM   #1
Ax3l123
Big Clucker
 
Join Date: Jan 2013
Posts: 71
Reputation: 0
Default server crash

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

PHP Code:
#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(01958.37831343.157215.3746269.1425000000);
    
    return 
1;
}

public 
OnGameModeExit()
{
    return 
1;
}

public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.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(playeridreason)
{
    return 
1;
}

public 
OnPlayerSpawn(playerid)
{
    return 
1;
}

public 
OnPlayerDeath(playeridkilleridreason)
{
    return 
1;
}

public 
OnVehicleSpawn(vehicleid)
{
    return 
1;
}

public 
OnVehicleDeath(vehicleidkillerid)
{
    return 
1;
}

public 
OnPlayerText(playeridtext[])
{
    return 
1;
}

public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/mycommand"cmdtexttrue10) == 0)
    {
        
// Do something here
        
return 1;
    }
    return 
0;
}

public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    return 
1;
}

public 
OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;
}

public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    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(playeridobjectid)
{
    return 
1;
}

public 
OnPlayerPickUpPickup(playeridpickupid)
{
    return 
1;
}

public 
OnVehicleMod(playeridvehicleidcomponentid)
{
    return 
1;
}

public 
OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
    return 
1;
}

public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
    return 
1;
}

public 
OnPlayerSelectedMenuRow(playeridrow)
{
    return 
1;
}

public 
OnPlayerExitedMenu(playerid)
{
    return 
1;
}

public 
OnPlayerInteriorChange(playeridnewinterioridoldinteriorid)
{
    return 
1;
}

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    return 
1;
}

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

public 
OnPlayerUpdate(playerid)
{
    return 
1;
}

public 
OnPlayerStreamIn(playeridforplayerid)
{
    return 
1;
}

public 
OnPlayerStreamOut(playeridforplayerid)
{
    return 
1;
}

public 
OnVehicleStreamIn(vehicleidforplayerid)
{
    return 
1;
}

public 
OnVehicleStreamOut(vehicleidforplayerid)
{
    return 
1;
}

public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    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(playeridclickedplayeridsource)
{
    return 
1;
}
stock GetName(playerid)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    return 
name;

Ax3l123 is offline   Reply With Quote
Old 16/04/2016, 12:27 PM   #2
Xabi
Big Clucker
 
Xabi's Avatar
 
Join Date: Nov 2012
Posts: 145
Reputation: 6
Default Respuesta: server crash

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)
Xabi is offline   Reply With Quote
Old 16/04/2016, 01:07 PM   #3
Ax3l123
Big Clucker
 
Join Date: Jan 2013
Posts: 71
Reputation: 0
Default Re: server crash

FIXED
solve:
Code:
From this :
SQL = mysql_connect("localhost", "root", "db", "");
TO
SQL = mysql_connect("localhost", "root", "", "db");
Ax3l123 is offline   Reply With Quote
Reply

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
RP Server crash every payday (Hour) Help Crash detect. shaquill Scripting Help 11 24/07/2015 02:36 AM
Crash detect , server crash Debug. whats wrong? MarwanCartman Server Support 4 10/05/2015 11:14 AM
[HELP]Server Crash - Located crash line with CrashDETECT - Guest4390857394857 Server Support 4 05/09/2014 04:37 AM
setplayername server crash helpme [crash detect] bigtigerbeee Scripting Help 4 28/11/2013 12:23 AM
Fatal Game crash, Not client or server crash SourceCode Scripting Help 3 11/10/2011 05:13 PM


All times are GMT. The time now is 07:54 AM.


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