[MYSQL HELP] Help me please
#1




every time I log in, the server always closed the connection
but it's in there already I turn on the server

NB: this is not my GM , thank's
i just try to use mysql , i using XAMP for windows
Reply
#2

Show us your full server log. And run the crashdetect plugin. And show us your OnPlayerConnect callback.
Reply
#3

this server log
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team

[19:04:16] 
[19:04:16] Server Plugins
[19:04:16] --------------
[19:04:16]  Loading plugin: audio.dll
[19:04:16]   Failed.
[19:04:16]  Loading plugin: sscanf.dll
[19:04:16] 

[19:04:16]  ===============================

[19:04:16]       sscanf plugin loaded.     

[19:04:16]    © 2009 Alex "******" Cole

[19:04:16]    0.3d-R2 500 Players "dnee"

[19:04:16]  ===============================

[19:04:16]   Loaded.
[19:04:16]  Loading plugin: streamer.dll
[19:04:16] 

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

[19:04:16]   Loaded.
[19:04:16]  Loading plugin: mysql.dll
[19:04:16] 

  > MySQL plugin R6-2 successfully loaded.

[19:04:16]   Loaded.
[19:04:16]  Loading plugin: crashdetect.dll
[19:04:16]   crashdetect v4.7.5 is OK.
[19:04:16]   Loaded.
[19:04:16]  Loaded 4 plugins.

[19:04:16] 
[19:04:16] Filterscripts
[19:04:16] ---------------
[19:04:16]   Loaded 0 filterscripts.

[19:04:16] Objects loaded from LoadObjects Database.
[19:04:16] 0 owned vehicles loaded from the MySQL Database.
[19:04:16] 0 vehicles loaded from the MySQL Database.
[19:04:16] 0 houses loaded from the MySQL Database.
[19:04:16] 0 businesses loaded from the MySQL Database.
[19:04:16] 0 factions loaded from the MySQL Database.
[19:04:16] Number of vehicle models: 3
this OnPlayerConnect
pawn Код:
public OnPlayerConnect(playerid)
{
    if(!IsARPName(playerid))
    {
        new string[256];
        format(string, sizeof(string), "{FF0000}[%s]{FFFFFF} The name that you have used is not valid on this Server.", pName(playerid));
        SendClientMessage(playerid, WHITE, string);
        SendClientMessage(playerid, WHITE, "Please make sure that you use a '_' and no numbers or '[' or ']'.");
        SendClientMessage(playerid, WHITE, " ");
        SendClientMessage(playerid, RED, "You have been kicked as a result.");
        format(string, sizeof(string), "AdmWrn: %s has been kicked for using a NON-RP name.", pName(playerid));
        SendToAdmins(RED, string, 0);
        SendToAdmins(RED, string, 1);
        Kick(playerid);
    }
    new Query[256];
    format(Query, sizeof(Query), "SELECT * FROM Accounts WHERE Username = '%s' AND Banned = '1'", pName(playerid));
    mysql_query(Query);
    mysql_store_result();
    if(mysql_num_rows() == 0)
    {
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerInterior(playerid, 0);
        TogglePlayerSpectating(playerid, true);
        SetTimerEx("FirstCam", 999, 0, "i", playerid);
        for(new i=0;i<47;i++) Weapon[playerid][i] = false;
        PickupsTimer[playerid] = SetTimerEx("PickupMessages", 1500, true, "i", playerid);
        new string[128];
        OnPhone[playerid] = 0;
        MaskOn[playerid] = 0;
        SetWorldTime(Hour);
        CalledPolice[playerid] = 0;
        InBusiness[playerid] = -1;
        CheckReady[playerid] = 0;
        ClothesSelected[playerid] = 0;
        CalledMedics[playerid] = 0;
        MaskNumber[playerid] = -1;
        ToggedDOOC[playerid] = 0;
        Spectating[playerid] = 0;
        VehicleSell[playerid] = -1;
        ClickStop[playerid] = 0;
        HouseSell[playerid] = -1;
        Fishing[playerid] = 0;
        nMuted[playerid] = 0;
        KillTimer(NewbieTimer[playerid]);
        Fined[playerid] = -1;
        masklabel[playerid] = Create3DTextLabel(" ", GREY, -1.0, -1.0, -1.0, -1.0, 0);
        Attach3DTextLabelToPlayer(masklabel[playerid], playerid, 0.0, 0.0, 0.7);
        FinePrice[playerid] = 0;
        CocaineSell[playerid] = -1;
        CocaineSellPrice[playerid] = -1;
        CocaineSellAmount[playerid] = -1;
        MethSell[playerid] = -1;
        MethSellPrice[playerid] = -1;
        MethSellAmount[playerid] = -1;
        WeedSell[playerid] = -1;
        WeedSellPrice[playerid] = -1;
        WeedSellAmount[playerid] = -1;
        WeaponSell[playerid] = 0;
        WeaponTo[playerid] = -1;
        WeaponPrice[playerid] = -1;
        WeaponAmmo[playerid] = -1;
        WeaponGun[playerid] = 0;
        HouseSellPrice[playerid] = -1;
        VehicleSellPrice[playerid] = -1;
        ToggedNewbie[playerid] = 0;
        PlayerCuffed[playerid] = 0;
        WeedPlanted[playerid] = 0;
        DrugCount[playerid] = 0;
        WeedReady[playerid] = 0;
        CanSweep[playerid] = 0;
        CanPizza[playerid] = 0;
        CanCoal[playerid] = 0;
        WeedPlantX[playerid] = -1.0;
        WeedPlantY[playerid] = -1.0;
        WeedPlantZ[playerid] = -1.0;
        KillTimer(ArrestTimer[playerid]);
        KillTimer(DrugTimer[playerid]);
        KillTimer(AJailTimer[playerid]);
        GoldON[playerid] = 0;
        ToggedOOC[playerid] = 0;
        ShakeRequested[playerid] = -1;
        aDuty[playerid] = 0;
        pDuty[playerid] = 0;
        DraggedBy[playerid] = -1;
        Dragging[playerid] = -1;
        mDuty[playerid] = 0;
        mPager[playerid] = 0;
        InAnimation[playerid] = 0;
        gPlayerAnimLibsPreloaded[playerid] = 0;
        CoalMining[playerid] = 0;
        Pizza[playerid] = 0;
        Sweeping[playerid] = 0;
        NumberCalled[playerid] = -1;
        Calling[playerid] = -1;
        pTazer[playerid] = 0;
        IStartedNews[playerid] = 0;
        pTazed[playerid] = 0;
        PoliceStep[playerid] = 0;
        WaitingTime[playerid] = 0;
        InvitedTo[playerid] = 0;
        Hospitalized[playerid] = 0;
        format(SQL_Query,sizeof(SQL_Query),"SELECT Username FROM `Accounts` WHERE `Username` = '%s'",pName(playerid));
        mysql_query(SQL_Query);
        mysql_store_result();
        SetPlayerColor(playerid, TRANSPARENT);
        if(mysql_num_rows() != 0)
        {
            format(string,sizeof(string),"{FFFFFF}Good Day! Welcome back to RCRP {FFA200}%s\n{FFFFFF}Please login with your password below:", RemoveUnderScore(playerid));
            ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login",string, "Login", "Exit");
        }
        else
        {
            format(string,sizeof(string),"{FFFFFF}Hello, it's your first time here, we hope you enjoy your stay {FFA200}%s\n{FFFFFF}\nPlease register with a password below:", RemoveUnderScore(playerid));
            ShowPlayerDialog(playerid, 0, DIALOG_STYLE_PASSWORD, "Register", string, "Register","Exit");
        }
        mysql_free_result();
        TextDrawShowForPlayer(playerid, JoinText);
        FirstSpawn[playerid] = 1;
        AFKStat[playerid] = 0;
        format(AFKReason[playerid], 128, "None");
        ChangingSkin[playerid] = -1;
        DMVCarSection[playerid] = -1;
        AssistanceNeeded[playerid] = -0;
        AccessingTrunk[playerid] = 0;
        Assisting[playerid] = -1;
       
        CreatePlayerTextdraws(playerid);
        OldCar[playerid] = -1;
        SetPlayerMapIcon(playerid, 1, 627.9313,-571.6613,17.4696, 30, 0, MAPICON_LOCAL);
        SetPlayerMapIcon(playerid, 2, 2110.3589,-99.1120,2.0120, 56, 0, MAPICON_LOCAL);
        SetPlayerMapIcon(playerid, 3, 396.8403,235.5118,1.2638, 56, 0, MAPICON_LOCAL);
        SetPlayerMapIcon(playerid, 4, 2269.3821,-75.3405,26.7724, 35, 0, MAPICON_LOCAL);

        RemoveObjects(playerid);
    }
    else
    {
        new string[256];
        format(string, sizeof(string), "{CC0000}BANNED:{FFFFFF} The account %s has been banned from this Server.", pName(playerid));
        SendClientMessage(playerid, WHITE, string);
        format(string, sizeof(string), "Visit "FORUMS" if you think your ban is incorrect or want an appeal.");
        SendClientMessage(playerid, WHITE, string);
        Kick(playerid);
    }
    mysql_free_result();
    return 1;
}
Reply
#4

instead of Kick() function you should use a public function to kick player so that messages can be displayed before kicking
like this
pawn Код:
forward KickPlayer(playerid);// this on top under includes and defines
public KickPlayer(playerid)
{
Kick(playerid);
return 1;
}


//now replace your Kick(playerid) under OnPlayerConnect with SetTimerEx("KickPlayer",500,false,"i",playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)