[AJUDA] Server crashando
#1

Boa tarde galera, estava um tempo sem mexer com pawn, mas decidi voltar. A ultima vez que eu estava mexendo no meu servidor, ele estava com um problema, toda vez que eu entrava nele, aparecia o loginbox, ai eu colocava a minha senha e entao ele travava todo, eu n spawnava, relogio parava e o server log tambйm travava, pois quando eu saiu dele, ele continua com 1 player online (EU), mas com o meu GTA fechado, e tambйm nao aparece no server log que eu sai. Este problema comeзou depois que eu coloquei o plugin sscanf nele, que esta na 0.3d R2 (EU BAIXEI A VERSAO DO SSCANF PARA O 0.3d R2, MAS MESMO ASSIM NAO FUNCIONA), pois eu estava tentando criar um comando /prender para admin, e um membro aqui do forum consertou o que eu havia criado (O QUE EU HAVIA CRIADO NAO ESTAVA FUNCIONANDO), mas fez uma modificaзгo nele que precisa do SSCANF para funcionar. Como eu havia parado de mexer com pawn neste momento e voltei agora, o problema continua, e eu estava tentando consertar mas nгo consegui, se alguem me ajudar, eu ficaria muito grato!

Este e o comando prender que o foi modificado para funcionar com o SSCANF:

pawn Код:
new params[100 char];
    new id;
    unformat(cmdtext, "s[50]S( )[100]",cmd,params);
    if(strcmp(cmd, "/prender", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, -1, "Vocк nгo й admin!");
        new tempo, motivo[100];
        if(sscanf(params, "dds[100]", id, tempo, motivo)) return SendClientMessage(playerid, -1, "USE: /prender [id] [tempo(minutos)] [motivo]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "ID INVБLIDO!");
        if(GetDistanceBetweenPlayers(playerid, id) < 15)
        {
            format(string, sizeof(string), "* Vocк Prendeu %s !", PlayerName(id));
            MSGPLAYER(playerid, COLOR_LIGHTBLUE, string);
            //GivePlayerMoney(id, -moneys);
            format(string, sizeof(string), "Preso por %s", PlayerName(playerid));
            GameTextForPlayer(id, string, 5000, 5);
            ResetPlayerWeaponsEx(id);
            format(string, sizeof(string), "[PRESO] O Admin %s prendeu o player %s | Motivo: %s", PlayerName(playerid), PlayerName(id), motivo);
            OOCNews(0xFF8000AA, string);
            SetPlayerInterior(id, 6);
            SetPlayerPos(id,264.6288,77.5742,1001.0391);
            PlayerInfo[id][pJailTime] = tempo * 60;
            PlayerInfo[id][pJailed] = 1;
            SetPlayerFree(id,playerid, "Foi Preso");
            PlayerInfo[id][pMuted] = 0;
            Controle(id, 1);
            PlayerCuffed[id] = 0;
            return 1;
         }
    }
Ai depois decidi criar este daqui para prender o player no carandiru:

pawn Код:
new params2[100 char];
    new id2;
    unformat(cmdtext, "s[50]S( )[100]",cmd,params2);
    if(strcmp(cmd, "/carandiru", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, -1, "Vocк nгo й admin!");
        new tempo2, motivo[100];
        if(sscanf(params2, "dds[100]", id2, tempo2, motivo)) return SendClientMessage(playerid, -1, "USE: /carandiru [id] [tempo(minutos)] [motivo]");
        if(!IsPlayerConnected(id2)) return SendClientMessage(playerid, -1, "ID INVБLIDO!");
        if(GetDistanceBetweenPlayers(playerid, id2) < 15)
            {
                format(string, sizeof(string), "* Vocк Prendeu %s !", PlayerName(id2));
                MSGPLAYER(playerid, COLOR_LIGHTBLUE, string);
                //GivePlayerMoney(id, -moneys);
                format(string, sizeof(string), "%s te mandou para o Carandiru", PlayerName(playerid));
                GameTextForPlayer(id2, string, 5000, 5);
                ResetPlayerWeaponsEx(id2);
                format(string, sizeof(string), "[CARANDIRU] O Admin %s prendeu o player %s | Motivo: %s", PlayerName(playerid), PlayerName(id2), motivo);
                OOCNews(0xFF8000AA, string);
                SetPlayerInterior(id2, 0);
                SetPlayerPos(id2, 107.2300,1920.6311,18.5208);
                SetPlayerWorldBounds(id2, 337.5694,101.5826,1940.9759,1798.7453);
                PlayerInfo[id2][pJailTime] = tempo2 * 60;
                PlayerInfo[id2][pJailed] = 2;
                SetPlayerFree(id2,playerid, "Vocк foi para o Carandiru!");
                PlayerInfo[id2][pMuted] = 0;
                Controle(id2, 1);
                PlayerCuffed[id2] = 0;
                return 1;
            }
    }
Este e o Server Log da ultima vez que eu abri o sv:

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

SA-MP Dedicated Server
----------------------
v0.3d, ©2005-2011 SA-MP Team

[17:11:36] filterscripts = ""  (string)
[17:11:36] 
[17:11:36] Server Plugins
[17:11:36] --------------
[17:11:36]  Loading plugin: sscanf
[17:11:36] 

[17:11:36]  ===============================

[17:11:36]       sscanf plugin loaded.     

[17:11:36]    © 2009 Alex "******" Cole

[17:11:36]    0.3d-R2 500 Players "dnee"

[17:11:36]  ===============================

[17:11:36]   Loaded.
[17:11:36]  Loaded 1 plugins.

[17:11:37] 
[17:11:37] Filterscripts
[17:11:37] ---------------
[17:11:37]   Loaded 0 filterscripts.

[17:11:37] 
---------------------------------------------------------
[17:11:37] Server Ligado: [03/01/2012 17:11:37]
[17:11:37] ---------------------------------------------------------

[17:11:37] ------------------------------------------
[17:11:37] *** GM - BPR by: Marcelo_Play Iniciado ***
[17:11:37] ------------------------------------------
[17:11:37] [BPR]: 28 Orgs Carregadas
[17:11:37] [BPR]: 241 Casas Carregadas
[17:11:37] [BPR]: 6 Empresas Carregadas
[17:11:37] [BPR]: 25 Empresas Especiais Carregadas
[17:11:37] [BPR]: 60 Carros Carregados
[17:11:37]  Brasil Play Roleplay ® 
[17:11:37] ====================================|
[17:11:37] |Dono/Scripter = Marcelo_Play|
[17:11:37]  BPR v1.0c ®
[17:11:37]  
[17:11:37] Number of vehicle models: 109
[17:12:40] Incoming connection: 127.0.0.1:51407
[17:12:40] [join] Marcelo_Play has joined the server (0:127.0.0.1)
[17:12:50] Marcelo_Play has logged in.
Reply
#2

LOL, usando sscanf com stcmp, creio que problema seja este.
Reply
#3

Mas teria como vocк me ajudar a criar um comando que nгo use sscanf??
Reply
#4

Tente:

pawn Код:
if(strcmp(cmd, "/carandiru", true) == 0)
    {
        new tempo2, motivo[100];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, -1,"USE: /carandiru [id] [tempo(minutos)] [motivo]");
            return 1;
        }
        id2 = strval(tmp);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, -1,"USE: /carandiru [id] [tempo(minutos)] [motivo]");
            return 1;
        }
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, -1,"USE: /carandiru [id] [tempo(minutos)] [motivo]");
            return 1;
        }
        tempo2 = strval(tmp);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, -1,"USE: /carandiru [id] [tempo(minutos)] [motivo]");
            return 1;
        }
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        while ((idx < length) && ((idx - offset) < (sizeof(motivo) - 1)))
        {
            motivo[idx - offset] = cmdtext[idx];
            idx++;
        }
        motivo[idx - offset] = EOS;
        if(IsPlayerConnected(id2))
        {
            if(GetDistanceBetweenPlayers(playerid, id2) < 15)
            {
                format(string, sizeof(string), "* Vocк Prendeu %s !", PlayerName(id2));
                MSGPLAYER(playerid, COLOR_LIGHTBLUE, string);
                //GivePlayerMoney(id, -moneys);
                format(string, sizeof(string), "%s te mandou para o Carandiru", PlayerName(playerid));
                GameTextForPlayer(id2, string, 5000, 5);
                ResetPlayerWeaponsEx(id2);
                format(string, sizeof(string), "[CARANDIRU] O Admin %s prendeu o player %s | Motivo: %s", PlayerName(playerid), PlayerName(id2), motivo);
                OOCNews(0xFF8000AA, string);
                SetPlayerInterior(id2, 0);
                SetPlayerPos(id2, 107.2300,1920.6311,18.5208);
                SetPlayerWorldBounds(id2, 337.5694,101.5826,1940.9759,1798.7453);
                PlayerInfo[id2][pJailTime] = tempo2 * 60;
                PlayerInfo[id2][pJailed] = 2;
                SetPlayerFree(id2,playerid, "Vocк foi para o Carandiru!");
                PlayerInfo[id2][pMuted] = 0;
                Controle(id2, 1);
                PlayerCuffed[id2] = 0;
                return 1;
            }
        }
        else
        {
            format(string, sizeof(string), "* ID %d invбlido.", id2);
            SendClientMessage(playerid, -1, string);
        }
        return 1;
    }
Reply
#5

Nem colocando este script e tirando todos os que usam sscanf, e tirando o mesmo dos #include e do plugins no server.cfg, a minha GM voltou a funcionar, estou comeзando a acreditar que isso bugou toda a minha scriptfiles, ja que o sv trava somente depois do loginbox.
Reply
#6

Mande o sistema de Login, mais explicativo a dialog de login
Reply
#7

Amigo, consegui resolver o problema, eu tinha um backup da minha GM que havia feito antes de comeзar a acontecer isso, peguei o backup, coloquei na pasta gamemodes, apaguei o plugin da pasta plugins e tambйm do server.cfg, refiz toda a scriptfiles e coloquei o codigo que voce havia me mandado e funcionou de primeira, ja fiz varios testes e esta funcionando muito bem agora! Cara, vlw pela ajuda e pela atenзгo, ja te dei reputation, se eu puder lhe ajudar em algo e so dizer, VLW!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)