SA-MP Forums Archive
Server Closed Connection - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Server Closed Connection (/showthread.php?tid=612330)



Server Closed Connection - Sna1L - 16.07.2016

hi ,
I once entered the game , but again I can not, Unless the server to close and re- open.

Connect code:
PHP код:
public OnPlayerConnect(playerid)
{
    new 
pname[MAX_PLAYER_NAME], path[200],str[200];
    
GetPlayerName(playeridpnamesizeof(pname));
    
format(pathsizeof(path), "/Users/%s.ini"pname);
    
FilesCount();
    if(
strfind(pname"kir"true) != -|| strfind(pname"kun"true) != -|| strfind(pname"kos"true) != -|| strfind(pname"hack"true) != -|| strfind(pname"kick"true) != -|| strfind(pname"kick"true) != -1)
    {
        
SendClientMessage(playerid,0x88AA62FF,""RED"UserName daraye * kalamate * zesht mibashad.");
        
SetTimerEx("KickTimer",3000,false,"i",playerid);
    }
    
PlayAudioStreamForPlayer(playerid"http://rozup.ir/download/1681919/6055103291.mp3");
    for(new 
050i++) SendClientMessage(playerid,0xFFFFFFF,""SEFID" ");
    
SendClientMessage(playerid,0x88AA62FF,"Play LIG_Welcome.mp3");
    if(!
dini_Exists(path))
    {
    
ShowPlayerDialog(playeridDIALOG_REGINFODIALOG_STYLE_MSGBOX""SEFID"Register"""SEFID"Shoma Bayad Gavanin va Raveshe Bazi dar Server ra Ebteda Khunda\nva dar Surati ke Ghabul darid Gozine Ghabul ra Entekhab Karde!\n\nWeb Address:http://www.ciwenar.xzn\n\nva Be Ozviyate Khod Edame Dahid!\nDeghat Konid: Mitavanid Nakhande ham Edame Dahid zira Helperhaye Server \ndar Surate Dashtane Soal dar Khedmate Shoma Hastand!"""SEFID"Ghabul"""RED"Cancel");
    
TextDrawShowForPlayer(playeridWelcome[0]);
    
TextDrawShowForPlayer(playeridWelcome[1]);
    
TextDrawShowForPlayer(playeridWelcome[5]);
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    
format(str,sizeof(str),"~y~~h~Akharin User: ~w~%s",name);
    
TextDrawSetString(Welcome[4],str);
    
TextDrawShowForPlayer(playeridWelcome[4]);
    
GivePlayerMoney(playerid,25);
    }
    else
    {
    
SendClientMessage(playerid,0xA9C4E4FF,"Gablan sabtenam kardid! login konid.");
    
ShowPlayerDialog(playeridDIALOG_LOGIN1DIALOG_STYLE_INPUT""SEFID"Login"""RED"Ramze "SEFID"Accounte Khod ra Vared Konid:"""SEFID"OK"""RED"Cancel");
    
TextDrawShowForPlayer(playeridWelcome[0]);
    
TextDrawShowForPlayer(playeridWelcome[1]);
    
TextDrawShowForPlayer(playeridWelcome[5]);
    
TextDrawShowForPlayer(playeridWelcome[4]);
    }
    
RemoveBuildingForPlayer(playerid1226623.9531, -1288.812518.81250.25);
    
RemoveBuildingForPlayer(playerid1285622.8594, -1281.234416.03910.25);
    
RemoveBuildingForPlayer(playerid1286622.7813, -1280.210916.09380.25);
    
RemoveBuildingForPlayer(playerid1287622.6953, -1279.257816.15630.25);
    
SetTimerEx("setscorexp",4000,true,"i",playerid);
return 
1;

__________________________________________________ _____________
Disconnect code:
PHP код:
public OnPlayerDisconnect(playeridreason)
{
    new 
pname[MAX_PLAYER_NAME], path[200];
    
GetPlayerName(playeridpnamesizeof(pname));
    
format(pathsizeof(path), "/Users/%s.ini"pname);
    
TextDrawHideForPlayer(playeridCount[playerid][5]), TextDrawHideForPlayer(playeridCount[playerid][4]);
    
    if(
pInfo[playerid][logged] == 1)
    {
    
dini_IntSet(path"skin"pInfo[playerid][skin]);
    
dini_IntSet(path"govahi"pInfo[playerid][govahi]);
    
dini_IntSet(path"XP"pInfo[playerid][XP]);
    
dini_IntSet(path"cash"GetPlayerMoney(playerid));
    
dini_IntSet(path"score"GetPlayerScore(playerid));
    }
    
pInfo[playerid][logged] = 0;
    
RaceCheckpoint[playerid] = 0;
    
bar[playerid] = 0;
    
InJob[playerid] = 0;
    
cpin[playerid] = 0;
    
KillTimer(timer[1]);
    
KillTimer(timer[3]);
    return  
1;

__________________________________________________ _____________________
Login Dialog:
PHP код:
       case DIALOG_LOGIN1:
       {
          if(!
response)
          {
             
Kick(playerid);
          }
          else
          {
             new 
pwlength strlen(inputtext);
             if(
pwlength 3)
             {
                new 
pw[200];
                
format(pw,sizeof(pw),"%s",dini_Get(path,"password"));
                if(
strcmp(inputtextpw) == 0)
                {
                  
pInfo[playerid][skin] = dini_Int(path"skin");
                   
pInfo[playerid][govahi] = dini_Int(path"govahi");
                   
pInfo[playerid][XP] = dini_Int(path"XP");
                   
pInfo[playerid][cash] = dini_Int(path"cash");
                   
pInfo[playerid][score] = dini_Int(path"score");
                   
pInfo[playerid][email] = dini_Int(path"email");
                   
pInfo[playerid][moaref] = dini_Int(path"moaref");
                   
pInfo[playerid][logged] = 1;
                
SetTimerEx("loginspawn",100,false,"i",playerid);
                }
                else
                {
                   
ShowPlayerDialog(playeridDIALOG_WRONGPWDIALOG_STYLE_MSGBOX""SEFID"Login"""RED"Ramz Eshtebah Ast!"""SEFID"OK"""RED"Cancel");
                }
             }
             else
             {
                
ShowPlayerDialog(playeridDIALOG_NOPW2DIALOG_STYLE_MSGBOX,  ""SEFID"Login"""RED"Ramz Bishtar az 4 Ragam Mibashad!"""SEFID"OK"""RED"Cancel");
             }
          }
       } 
__________________________________________________ ________________________
PHP код:
Game Log:
[
23:38:29] [connection127.0.0.1:54588 requests connection cookie.
[
23:38:30] [connectionincoming connection127.0.0.1:54588 id0
[23:38:30] [joinPlayer has joined the server (0:127.0.0.1)
[
23:38:42] [partPlayer has left the server (0:1)
[
23:39:13] [connection127.0.0.1:54589 requests connection cookie.
[
23:39:14] [connectionincoming connection127.0.0.1:54589 id0
[23:40:05] [connection127.0.0.1:64326 requests connection cookie.
[
23:40:06] [connectionincoming connection127.0.0.1:64326 id
----------------------------------------------------------------------------------------------------
PLZ Help ME


Re: Server Closed Connection - ColdGamePlay - 17.07.2016

The problem is either here
FilesCount();

or in that part, I'm not so sure
Код:
    if(strfind(pname, "kir", true) != -1 || strfind(pname, "kun", true) != -1 || strfind(pname, "kos", true) != -1 || strfind(pname, "hack", true) != -1 || strfind(pname, "kick", true) != -1 || strfind(pname, "kick", true) != -1) 
    { 
        SendClientMessage(playerid,0x88AA62FF,""RED"UserName daraye * kalamate * zesht mibashad."); 
        SetTimerEx("KickTimer",3000,false,"i",playerid); 
    }



Re: Server Closed Connection - Sna1L - 17.07.2016

tnQ sir , Problem Fixed