[Ajuda] Agendar Cadeia.
#1

olб! peguei um sistema de agendar prisгo,porem quando agendo a prisгo do jogador e o mesmo loga o jogador nгo vai preso. Alguem pode ajudar? Obrigado!!


CMD:

PHP код:
if(!strcmp(cmd"/aprenderoff"true))
    {
        if(
aInfo[playerid][Admin] == 1)
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOR_ERRO"Uso vбlido: correto /aPrenderOFF [Nick] [Tempo] [Motivo]");
                return 
1;
            }
            
format(gFilesizeof(gFile), "Contas/%s.ini"tmp);
              if(!
fexist(gFile))
            {
                
SendClientMessage(playeridCOR_ERRO"Nгo existe nenhuma conta com esse nick!");
                return 
1;
            }
            
tmp strtok(cmdtextidx);
              if(! 
strlen(tmp))
               {
                
SendClientMessage(playeridCOR_ERRO"Uso vбlido: /aPrenderOFF [Nick] [Tempo] [Motivo]");
                return 
1;
               }
               new
                   
iTempo strval(tmp)
               ;
               if(
iTempo || iTempo 600)
               {
                
SendClientMessage(playeridCOR_ERRO"Tempo somente de 1 а 600 minutos ! ");
                return 
1;
               }
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[64];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
              if(!
strlen(result))
            {
                
SendClientMessage(playeridCOR_ERRO"Uso vбlido: /aPrenderOFF [Nick] [Tempo] [Motivo]");
                  return 
1;
            }
            
SendClientMessage(playerid0x33CCFFAA"(PuniзгoOff) Conta punida com sucesso!");
            
WE_SetInt(gFile"Abuser"1);
            
WE_SetInt(gFile"Preso"iTempo*60);
        }
        else
        {
            
SendClientMessage(playeridCOR_ERRO"Vocк nгo tem permissгo!");
        }
        return 
1;
    } 
PS: esse cmd й da GM "[WE] World Evolution RPG [WE]" eu a peguei para estuda-la.
Reply
#2

Quote:
Originally Posted by CSSDean
Посмотреть сообщение
olб! peguei um sistema de agendar prisгo,porem quando agendo a prisгo do jogador e o mesmo loga o jogador nгo vai preso. Alguem pode ajudar? Obrigado!!


CMD:

PHP код:
if(!strcmp(cmd"/aprenderoff"true))
    {
        if(
aInfo[playerid][Admin] == 1)
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOR_ERRO"Uso vбlido: correto /aPrenderOFF [Nick] [Tempo] [Motivo]");
                return 
1;
            }
            
format(gFilesizeof(gFile), "Contas/%s.ini"tmp);
              if(!
fexist(gFile))
            {
                
SendClientMessage(playeridCOR_ERRO"Nгo existe nenhuma conta com esse nick!");
                return 
1;
            }
            
tmp strtok(cmdtextidx);
              if(! 
strlen(tmp))
               {
                
SendClientMessage(playeridCOR_ERRO"Uso vбlido: /aPrenderOFF [Nick] [Tempo] [Motivo]");
                return 
1;
               }
               new
                   
iTempo strval(tmp)
               ;
               if(
iTempo || iTempo 600)
               {
                
SendClientMessage(playeridCOR_ERRO"Tempo somente de 1 а 600 minutos ! ");
                return 
1;
               }
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[64];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
              if(!
strlen(result))
            {
                
SendClientMessage(playeridCOR_ERRO"Uso vбlido: /aPrenderOFF [Nick] [Tempo] [Motivo]");
                  return 
1;
            }
            
SendClientMessage(playerid0x33CCFFAA"(PuniзгoOff) Conta punida com sucesso!");
            
WE_SetInt(gFile"Abuser"1);
            
WE_SetInt(gFile"Preso"iTempo*60);
        }
        else
        {
            
SendClientMessage(playeridCOR_ERRO"Vocк nгo tem permissгo!");
        }
        return 
1;
    } 
PS: esse cmd й da GM "[WE] World Evolution RPG [WE]" eu a peguei para estuda-la.
Tente colocar uma funзгo em:
PHP код:
public OnPlayerSpawn(playerid
checando assim que o o player spawnar se ele estб preso ou nгo.
Reply
#3

Quote:
Originally Posted by Gguiz
Посмотреть сообщение
Tente colocar uma funзгo em:
PHP код:
public OnPlayerSpawn(playerid
checando assim que o o player spawnar se ele estб preso ou nгo.
Obrigado!! mais eu fiz algo diferente,eu criei um cmd que atй deu "funcionou" sу que nгo consigo achar o parametro do player para agendar a prisгo: exemplo: "/aprenderoff [CSS]Fulano Teste" dai a mensagem aparece assim: "| BvD-Admin | O(A) Staff %s agendou a prisгo do jogador(a) por %d Minutos Pelo ( Motivo: teste )" e o nick do jogador nгo aparece.

PHP код:
 if(!strcmp(cmd"/aprenderoff"true))
    {
        if(
aInfo[playerid][Admin] == || aInfo[playerid][AdminL] == 1)
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOR_ERRO"| ERRO | Digite: correto /aPrenderOFF [Nick] [Tempo] [Motivo]");
                return 
1;
            }
            
format(gFilesizeof(gFile), "Contas/%s.ini"tmp);
              if(!
fexist(gFile))
            {
                
SendClientMessage(playeridCOR_ERRO"Nгo existe nenhuma conta com esse nick!");
                return 
1;
            }
            
tmp strtok(cmdtextidx);
              if(! 
strlen(tmp))
               {
                
SendClientMessage(playeridCOR_ERRO"| ERRO | Digite: /aPrenderOFF [Nick] [Tempo] [Motivo]");
                return 
1;
               }
               new
                   
iTempo strval(tmp)
               ;
               if(
iTempo || iTempo 600)
               {
                
SendClientMessage(playeridCOR_ERRO"Tempo somente de 1 а 600 minutos ! ");
                return 
1;
               }
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[1000];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
              if(!
strlen(result))
            {
                
SendClientMessage(playeridCOR_ERRO"| ERRO | Digite: /aPrenderOFF [Nick] [Tempo] [Motivo]");
                  return 
1;
            }
            
SendClientMessage(playerid0x33CCFFAA"(PuniзгoOff) Conta punida com sucesso!");
            
SendClientFormatAll(0xADFF2FFF"| BvD-Admin | O(A) Staff %s agendou a prisгo do jogador(a) %s por %d Minutos Pelo ( Motivo: %s )"PlayerName(playerid),PlayerName(idx),iTempo,result);
            
SetPrisao(PlayerName(idx));
            
WE_SetInt(gFile"Abuser"1);
            
WE_SetInt(gFile"Preso"iTempo*60);
        }
        else
        {
            
SendClientMessage(playeridCOR_ERRO"Vocк nгo tem permissгo!");
        }
        return 
1;
    } 
poderia me ajudar a achar o parametro do nick do jogador? Grato!!
Reply
#4

Quote:
Originally Posted by CSSDean
Посмотреть сообщение
Obrigado!! mais eu fiz algo diferente,eu criei um cmd que atй deu "funcionou" sу que nгo consigo achar o parametro do player para agendar a prisгo: exemplo: "/aprenderoff [CSS]Fulano Teste" dai a mensagem aparece assim: "| BvD-Admin | O(A) Staff %s agendou a prisгo do jogador(a) por %d Minutos Pelo ( Motivo: teste )" e o nick do jogador nгo aparece.

PHP код:
 if(!strcmp(cmd"/aprenderoff"true))
    {
        if(
aInfo[playerid][Admin] == || aInfo[playerid][AdminL] == 1)
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOR_ERRO"| ERRO | Digite: correto /aPrenderOFF [Nick] [Tempo] [Motivo]");
                return 
1;
            }
            
format(gFilesizeof(gFile), "Contas/%s.ini"tmp);
              if(!
fexist(gFile))
            {
                
SendClientMessage(playeridCOR_ERRO"Nгo existe nenhuma conta com esse nick!");
                return 
1;
            }
            
tmp strtok(cmdtextidx);
              if(! 
strlen(tmp))
               {
                
SendClientMessage(playeridCOR_ERRO"| ERRO | Digite: /aPrenderOFF [Nick] [Tempo] [Motivo]");
                return 
1;
               }
               new
                   
iTempo strval(tmp)
               ;
               if(
iTempo || iTempo 600)
               {
                
SendClientMessage(playeridCOR_ERRO"Tempo somente de 1 а 600 minutos ! ");
                return 
1;
               }
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[1000];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
              if(!
strlen(result))
            {
                
SendClientMessage(playeridCOR_ERRO"| ERRO | Digite: /aPrenderOFF [Nick] [Tempo] [Motivo]");
                  return 
1;
            }
            
SendClientMessage(playerid0x33CCFFAA"(PuniзгoOff) Conta punida com sucesso!");
            
SendClientFormatAll(0xADFF2FFF"| BvD-Admin | O(A) Staff %s agendou a prisгo do jogador(a) %s por %d Minutos Pelo ( Motivo: %s )"PlayerName(playerid),PlayerName(idx),iTempo,result);
            
SetPrisao(PlayerName(idx));
            
WE_SetInt(gFile"Abuser"1);
            
WE_SetInt(gFile"Preso"iTempo*60);
        }
        else
        {
            
SendClientMessage(playeridCOR_ERRO"Vocк nгo tem permissгo!");
        }
        return 
1;
    } 
poderia me ajudar a achar o parametro do nick do jogador? Grato!!
Por esses e varios outros motivo й recomendavel usar sscanf2.
https://sampwiki.blast.hk/wiki/GetPlayerName
Reply
#5

O GameMode do World Evolution RPG jб й obsoleto comparado a evoluзгo atual do SA:MP atravйs de processadores de comando.
Nгo й errado aprender desta maneira de programaзгo (usando strcmp, dini), porйm, na atual evoluзгo, aconselho que vб acompanhando utilizando zcmd, sscanf e algum sistema de salvamento sql.
Alйm de ser mais prбtico, й mais fбcil de aprender e й mais rбpido a leitura/processamento.


Fui um dos desenvolvedores do WE e sei o que estou falando.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)