[AJUDA] Comando fecha o Server.
#1

Galera, й o seguinte... meu server tem sistema de Gold (uma moeda secundбria). Para o Admin dar Gold para o player, ele digita /dargold. Mas quando /dargold й digitado, o server fecha (ele nгo crasha, ele fecha mesmo). O que faзo?

COMANDO /dargold:

PHP код:
dcmd_dargold(playeridparams[])
        {
            if(
Player[playerid][pAdmin] < 7)
                return 
SendClientMessage(playeridCOLOR_RED"[ERRO] Vocк nгo tem permissгo para usar este comando!");
               new 
tmp[24], idxtmp strtok(paramsidx);
            if(!
strlen(tmp))
                return 
SendClientMessage(playeridCOLOR_GREY"[USO] /dargold [id/nick] [quantidade]");
            new 
giveid;
            new 
gold;
            
giveid ReturnUser(tmp);
            
tmp strtok(paramsidx);
            
gold strval(tmp);
            if(
IsPlayerConnected(giveid))
            {
                if(
giveid != INVALID_PLAYER_ID)
                {
                    new 
yearmonth,day;
                    
getdate(yearmonthday);
                    new 
hour,minuite,second;
                    
gettime(hour,minuite,second);
                    
Player[giveid][pGold] += gold;
                    if(
gold 0)
                    {
                        
SendClientMessage(giveidCOLOR_GREY"[GOLD] O Admin %s lhe deu %dG.",playerid,gold);
                        
format(thestringsizeof(thestring), "-OperServ- %s deu %dG a %s"Player[playerid][pName], goldPlayer[giveid][pName]);
                        
ABroadCast(COLOR_YELLOW,thestring,1);
                    }
                    else
                        
SendClientMessage(playeridCOLOR_RED"[ERRO] Nгo й possivar dar 0G ou menos a um player.");
                    
WriteLog("admins"thestring);
                }
            }
            return 
1;
        } 
Reply
#2

passa para sscanf que com certeza para de dar crash

use strtok so quando for strcmp
Reply
#3

Quote:

passa para sscanf que com certeza para de dar crash

use strtok so quando for strcmp

Esse й o meu sistema no GM inteiro, o GM ta com quase 60 mil linhas, e й completamente assim. E acho que vocк nгo entendeu. Ele nгo da Crash. O Server simplesmente fecha, sem dar Crash.
Reply
#4

Faзa um debug no comando, para verificar em qual das funзхes estб o erro.
Reply
#5

Vini, pode me monstrar como, por favor?
Reply
#6

Ninguйm?
Reply
#7

Tenta aк:

pawn Код:
dcmd_dargold(playerid, params[])
        {
            if(Player[playerid][pAdmin] < 7)
                return SendClientMessage(playerid, COLOR_RED, "[ERRO] Vocк nгo tem permissгo para usar este comando!");

               new tmp[256], idx; tmp = strtok(params, idx);
            if(!strlen(tmp))
                return SendClientMessage(playerid, COLOR_GREY, "[USO] /dargold [id/nick] [quantidade]");

            new giveid;
            new gold;
            giveid = ReturnUser(tmp);
            tmp = strtok(params, idx);
            gold = strval(tmp);
            if(IsPlayerConnected(giveid))
            {
                if(giveid != INVALID_PLAYER_ID)
                {
                    new year, month,day;
                    getdate(year, month, day);
                    new hour,minuite,second;
                    gettime(hour,minuite,second);
                    Player[giveid][pGold] += gold;
                    if(gold > 0)
                    {
                        SendClientMessage(giveid, COLOR_GREY, "[GOLD] O Admin %s lhe deu %dG.",playerid,gold);
                        format(thestring, sizeof(thestring), "-OperServ- %s deu %dG a %s", Player[playerid][pName], gold, Player[giveid][pName]);
                        ABroadCast(COLOR_YELLOW,thestring,1);
                    }
                    else
                        SendClientMessage(playerid, COLOR_RED, "[ERRO] Nгo й possivar dar 0G ou menos a um player.");

                    WriteLog("admins", thestring);
                }
            }
            return 1;
        }
Reply
#8

Deu nгo vйi... mas vocк mudou algo? KKKKKK'
Reply
#9

Basta espalhar mensagens (printf ou SendClientMessageToAll, dependendo da sua necessidade) pelo cуdigo, e ver atй qual mensagem foi executada.
Reply
#10

ah, ok! Vou tentar, e lhe aviso. Vlw!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)