SA-MP Forums Archive
[Ajuda] Sistema de Agendar Cadeia - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Sistema de Agendar Cadeia (/showthread.php?tid=404499)



Sistema de Agendar Cadeia - Humildade - 03.01.2013

Seguinte, tava tentando fazer uma agendar cadeia, mas ta osso aki,
eu dou agendar cadeia em mim, mas quando eu relogo nгo vou pra cadeia.

Alguem pode me ajudar?

Comando Agendar Cadeia
PHP код:
 if(strcmp(cmd"/agendarcadeia",true) == || strcmp(cmd"/agendarnome",true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            new 
tmpo[20];
            if(
PlayerInfo[playerid][pAdmin] < 1)
            {
                
SendClientMessage(playeridCOLOR_GREY"   Vocк nгo esta autorizado para usar este comando!");
                return 
true;
            }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USE: /agendarcadeia [NOME_CORRETO] [Tempo] [Motivo]");
                return 
true;
            }
            
tmpo strtok(cmdtextidx);
            if(!
strlen(tmpo))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USE: /agendarcadeia [NOME_CORRETO] [Tempo] [Motivo]");
                return 
true;
            }
            new 
tempo2 strval(tmpo);
            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(playeridCOLOR_GRAD2"USE: /agendarcadeia [NOME_CORRETO] [Tempo] [Motivo]");
                return 
true;
            }
            
GetPlayerName(playeridsendernamesizeof(sendername));
               new 
arquivo[128];
            
format(arquivosizeof(arquivo), "Contas/%s.ini",tmp);
            if(!
dini_Exists(arquivo))
            {
                
SendClientMessage(playeridCOLOR_WHITE"[ERRO] Este nick nгo estб registrado!");
                return 
true;
            }
               
format(stringsizeof(string), "O Admin %s agendou o nick %s para %d minutos de cadeia, Motivo: %s",PlayerName(playerid), tmptempo2, (result));
            
SendClientMessageToAll(COLOR_LIGHTREDstring);
            
AgendarLog(string);
            
dini_IntSet(arquivo,"Jailed",11);
            
dini_IntSet(arquivo,"JailTime",tempo2 60);
            
strmid(AgendouInfo[playerid][cAdminAgendou], sendername0strlen(sendername), MAX_PLAYER_NAME);
            
dini_Set(arquivo,"AdminAgendou",sendername);
             
strmid(AgendouInfo[playerid][cMotivoAgendou], result0strlen(result), MAX_PLAYER_NAME);
            
dini_Set(arquivo,"MotivoAgendou",result);
            
dini_IntSet(arquivo,"Agendado",1);
            
dini_IntSet(arquivo,"TempoAgendado",tempo2);
        }
        return 
true;
    } 
PHP код:
enum pInfo
{
 
pAgendado,pTempoAgendado,pAdminAgendou[64],pMotivoAgendou[128]
}; 
Public SetPlayerSpawn
PHP код:
if(PlayerInfo[playerid][pJailed] == 11)
        {
            if(
PlayerInfo[playerid][pAgendado] == 1)
            {
                   new 
motivoagendou[128];
                
strmid(motivoagendouPlayerInfo[playerid][pMotivoAgendou], 0strlen(PlayerInfo[playerid][pMotivoAgendou]), 255);
                   new 
adminagendou[64];
                
strmid(adminagendouPlayerInfo[playerid][pAdminAgendou], 0strlen(PlayerInfo[playerid][pAdminAgendou]), 255);
                
format(stringagendousizeof(stringagendou), "O Admin %s agendou vocк para %d minutos de cadeia, Motivo: %s"adminagendouPlayerInfo[playerid][pTempoAgendado], motivoagendou);
                
SendClientMessage(playeridCOLOR_LIGHTREDstringagendou);
                  
PlayerInfo[playerid][pAgendado] = 0;
            }
            
XXAirBreak[playerid] += 3;
            
SetPlayerInterior(playerid18);
            
XXAirBreak[playerid] += 3;
            
SetPlayerPos(playerid1302.519897,-1.787510,1001.028259);//XXAirBreak[playerid] += 3;SetPlayerPos(playerid,1175.6014,-1179.9524,87.0427);
            //SetPlayerWorldBounds(playerid, 337.5694,101.5826,1940.9759,1798.7453); //285.3481,96.9720,1940.9755,1799.0811
            
SendClientMessage(playeridCOLOR_LIGHTRED"Sentenзa incompleta,Vocк voltou para Cadeia!");
            return 
true;
        } 
public OnPlayerLogin
PHP код:
if( strcmpkey "AdminAgendou" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAdminAgendou] = strvalval ); }
                    if( 
strcmpkey "MotivoAgendou" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pMotivoAgendou] = strvalval ); }
                    if( 
strcmpkey "Agendado" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAgendado] = strvalval ); }
                    if( 
strcmpkey "TempoAgendado" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pTempoAgendado] = strvalval ); } 
public OnPlayerUpdate
PHP код:
format(var, 32"AdminAgendou=%d\n",PlayerInfo[playerid][pAdminAgendou]);fwrite(hFile, var);
                
format(var, 32"MotivoAgendou=%d\n",PlayerInfo[playerid][pMotivoAgendou]);fwrite(hFile, var);
                
format(var, 32"Agendado=%d\n",PlayerInfo[playerid][pAgendado]);fwrite(hFile, var);
                
format(var, 32"TempoAgendado=%d\n",PlayerInfo[playerid][pTempoAgendado]);fwrite(hFile, var); 
Public OnPlayerSave
PHP код:
format(var, 32"AdminAgendou=%d\n",PlayerInfo[playerid][pAdminAgendou]);fwrite(hFile, var);
                
format(var, 32"MotivoAgendou=%d\n",PlayerInfo[playerid][pMotivoAgendou]);fwrite(hFile, var);
                
format(var, 32"Agendado=%d\n",PlayerInfo[playerid][pAgendado]);fwrite(hFile, var);
                
format(var, 32"TempoAgendado=%d\n",PlayerInfo[playerid][pTempoAgendado]);fwrite(hFile, var); 



Re: Sistema de Agendar Cadeia - TugaBR - 03.01.2013

O que acontece? Vocк nгo vai pra cadeia? Chega a aparecer alguma SendClientMessage ou Textdraw? Se nгo, й algum problema no carregamento/salvamento dos arquivos. Vou tentar achar o erro aqui e dou @edit.


Re: Sistema de Agendar Cadeia - paulor - 03.01.2013

Veja se estб salvando corretamente o arquivo, pois vocк estб salvando errado, vocк deveria pular as linhas usando \r\n e nгo somente \n, Poste tudo completo para identificar o erro!


Re: Sistema de Agendar Cadeia - Humildade - 03.01.2013

Nгo Estб Salvando.
Tipo eu fiz isso um teste,
fui na scriptfiles,
lб tava
Admin Agendou= Humildade_Staff
Motivo Agendou= Anti RPG
Tempo Agendado= 350
Agendado = 1

Ai Quando eu Loguei eu fui preso,
й o salvamento que ta ruim. '-'


Re: Sistema de Agendar Cadeia - tonisantolia - 03.01.2013

Tem certeza que esta carregando corretamente?


Re: Sistema de Agendar Cadeia - paulor - 03.01.2013

Quote:
Originally Posted by Humildade
Посмотреть сообщение
Nгo Estб Salvando.
Tipo eu fiz isso um teste,
fui na scriptfiles,
lб tava
Admin Agendou= Humildade_Staff
Motivo Agendou= Anti RPG
Tempo Agendado= 350
Agendado = 1

Ai Quando eu Loguei eu fui preso,
й o salvamento que ta ruim. '-'
Faзa o que eu postei acima, invйs de \n use \r\n que й o correto para salvamento em arquivos.


Re: Sistema de Agendar Cadeia - TugaBR - 03.01.2013

Tente mudar o conteъdo da public OnPlayerSave pra OnPlayerDisconnect e poste o que aconteceu...


Re: Sistema de Agendar Cadeia - Humildade - 03.01.2013

Coloquei o \r\n e nem funfo '-'

Tipo no Comando Era DOF2, ai
Tava DOF2_SaveFile();
Como eu passo pra Dini?


Re: Sistema de Agendar Cadeia - tonisantolia - 03.01.2013

Quote:
Originally Posted by Fox.CZL
Посмотреть сообщение
up up pros fodфes ver
Ridiculo oque fazem para ganhar posts.. u.u

@topic
Use-o em dof2 e veja se da certo se der.. Poste ele aqui para eu poder fazer a conversгo certa