[Ajuda] Agendar Prisгo
#1

Olб! adaptei um sistema de prisгo em minha gm,coloquei o comando e no OnPlayerConnect,porem quando eu agendo a prisгo de um determinado jogador,na hora do mesmo logar,aparece isso:

https://imgur.com/b1nDwa3

Comando:

PHP код:
 if( !strcmp( cmd, "/cadeiaoff", true ))
    {
    if(
pAdmin[playerid] == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5 || guardiao[playerid]){
    {
    
tmp2 = strtok( cmdtext, idx );
    if( !
strlen( tmp2 ))
    {
    
SendClientMessage( playerid, Vermelho, "| ERRO | Digite: /CadeiaOff [Nick] [Tempo] [Motivo]" );
    return 
1;
    }
    
format(file, sizeof(file ), "Contas/%s.ini", tmp2 );
    if( !
fexist( file ))
    {
    
SendClientMessage( playerid, Vermelho, "| ERRO | Nгo existe nenhuma conta com esse nick !" );
    return 
1;
    }
    
tmp = strtok( cmdtext, idx );
    if( ! 
strlen( tmp ))
    {
    
SendClientMessage( playerid, Vermelho, "| ERRO | Digite: /CadeiaOff [Nick] [Tempo] [Motivo]" );
    return 
1;
    }
    new
    
iTempo = strval( tmp )
    ;
    if( 
iTempo < 0 || iTempo > 600 )
    {
    
SendClientMessage( playerid, Vermelho, "| 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( playerid, Vermelho, "| ERRO | Digite: /CadeiaOff [Nick] [Tempo] [Motivo]" );
    return 
1;
    }
    new 
sistemacadeia[200];
    
format(sistemacadeia, sizeof(sistemacadeia), "| BFC-Admin | O(A) %s %s agendou a prisгo do(a) jogador(a) %s por %d minutos ( Motivo: %s )", CargoAdmin(playerid), PlayerName(playerid), tmp2, iTempo, result);
    
SendClientMessageToAll(0xB0FF30AA, sistemacadeia);
    
dini_Set(file, "MotivoPrisao", result);
    
dini_IntSet( file, "Abuser", 1 );
    
dini_IntSet( file, "pPreso", iTempo*60 );
    }
    }
    return 
1;
    } 
OnPlayerConnect:

PHP код:
     if(PlayerInfo[playerid][Abuser] == 1 ){
    
LiberarPrisao(playerid);
    new 
CadeiaMotivo[128];
    new 
msg[128];
    
format(CadeiaMotivo, sizeof(CadeiaMotivo), "%s", dini_Get(file, "MotivoPrisao"));
    
SendClientMessage(playerid, 0x1875CCAA,"=================================== Preso ===================================");
    
SendClientMessage(playerid, 0xFFFFFFAA,"» Vocк recebeu uma puniзгo de cadeia estando online / offline  por um admin!");
    
format(msg, 128, "» Prisгo ( Motivo: %s )", CadeiaMotivo);
    
SendClientMessage(playerid, 0xFFFFFFAA, msg);
    
SendClientMessage(playerid, 0x1875CCAA,"=================================== Preso ===================================");
    
SetPlayerPos(playerid, 223.0951,109.5349,999.0156);
    
SetPlayerInterior( playerid,9);
    } 
Forward LiberarPrisгo:
PHP код:
forward LiberarPrisao( playerid );
public 
LiberarPrisao( playerid )
{
if(
PlayerInfo[ playerid ][pPreso ] <= 0 )
{
KillTimer( T_Preso[ playerid ] );
TextDrawHideForPlayer( playerid, p_TextPreso[ playerid ] );
SendClientMessage( playerid, 0xA9C4E4AA, "| INFO | Vocк cumpriu sua pena e estб livre novamente!" );
SetPlayerPos( playerid, 1551.6987,-1675.3806,15.9631);
SetPlayerInterior( playerid, 0 );
SetPlayerWantedLevel( playerid, 0 );
PlayerInfo[ playerid ][ pPreso ] = 0;
PlayerInfo[ playerid ][ Abuser ] = 0;
SetPlayerHealth( playerid, 100.0 );
GameTextForPlayer( playerid, "~w~SOLTO!", 3000, 0 );
format(file, sizeof(file ), "Contas/%s.ini", PlayerName( playerid ));
dini_IntSet(file, "Abuser", 0 );
TextDrawShowForPlayer(playerid,UPRelogio[playerid]);
return 
1;
}
if(
PlayerInfo [ playerid ][ pPreso ] >= 1 )
{
TextDrawHideForPlayer(playerid,UPRelogio[playerid]);
PlayerInfo[ playerid ][ pPreso ] --;
T_Preso[ playerid ] = SetTimerEx( "LiberarPrisao", 1000, false, "d", playerid );
new
d_Horas1,
d_Minut1,
d_Segun1
;
formatSeconds( PlayerInfo[ playerid ][ pPreso ], d_Horas1, d_Minut1, d_Segun1 );
if( 
d_Horas1 > 0 )
{
format( gstring, sizeof( gstring ), "~r~~h~Tempo de Prisao~n~~g~~h~Hora(s): %d~n~~p~~h~Minutos: ~w~%d~n~~b~~h~Segundos: ~w~%d", d_Horas1, d_Minut1, d_Segun1 );
TextDrawSetString( p_TextPreso[ playerid ], gstring );
}
else if( 
d_Horas1 <= 0 && d_Minut1 > 0 )
{
format( gStr, sizeof( gStr ), "~r~~h~Tempo de Prisao~n~~n~~p~~h~Minutos: ~w~%d~n~~b~~h~Segundos: ~w~%d", d_Minut1, d_Segun1 );
TextDrawSetString( p_TextPreso[ playerid ], gStr );
}
else if( 
d_Horas1 <= 0 && d_Minut1 <= 0 && d_Segun1 > 0 )
{
format( gStr, sizeof( gStr ), "~r~~h~Tempo de Prisao~n~~n~~b~~h~Segundos: ~w~%d", d_Segun1 );
TextDrawSetString( p_TextPreso[ playerid ], gStr );
}
TextDrawShowForPlayer( playerid, p_TextPreso[ playerid ] );
}
return 
1;
} 
Ja adicionei o "Abuser" nos dados das contas etc. Grato a quem ajudar!
Reply
#2

Formate a string file e tente.

PHP код:
format(file, sizeof(file ), "Contas/%s.ini", nomePlayer ); 
Coloque isso antes do format(Motivo...).

E tambйm veja qual o motivo que estб salvo na conta.
Reply
#3

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
Formate a string file e tente.

PHP код:
format(file, sizeof(file ), "Contas/%s.ini", nomePlayer ); 
Coloque isso antes do format(Motivo...).

E tambйm veja qual o motivo que estб salvo na conta.
da msm forma nao funcionou men
Reply
#4

Cara, vou te dar um conselho que irб resolver teus problemas.

Vocк estб utilizando uma tecnologia de 2013.
Estamos em 2019...

Hб formar melhores, mais rбpidas e eficazes de fazer isso.
Um exemplo clбssico й substituir strtok por sscanf.
Reduziria mais da metade dos seus cуdigos e й mais fбcil pra vocк, visto que nгo demanda muito tempo para aprender desta nova tecnologia (ferramenta).

Refaзa o sistema.

Vocк chegou a olhar o que estб salvo na conta do jogador?

@edit
Vocк nгo especificou o que estб acontecendo de fato, por isso, deduzi que fosse o motivo.
Porйm, o que й mesmo?
Seja mais claro.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)