[Pedido] Agendar
#1

Ola pessoal, eu estou aqui precisando de um comando de agendar cadeia, se alguйm tiver passe-me por favor obrigado pela atenзгo.
Reply
#2

Edit:
Код:
Coloque isto com as includes
#include                <  DOF2  >

Coloque junto com as new
enum pAInfo{
cMotivoAgendou[128],
cAdminAgendou[64],};
new AgendouInfo[MAX_PLAYERS][pAInfo];

coloque isto na Public OnGameModeExit
	DOF2_Exit();

Coloque isto na public OnCommandText
	if(strcmp(cmd, "/agendarcadeia",true) == 0 || strcmp(cmd, "/agendar",true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new tmpo[20];
            if(PlayerInfo[playerid][pAdmin] < 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк nгo esta autorizado para usar este comando!");
                return true;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /agendarcadeia [NOME_CORRETO] [Tempo] [Motivo]");
                return true;
            }
            tmpo = strtok(cmdtext, idx);
            if(!strlen(tmpo))
            {
                SendClientMessage(playerid, COLOR_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(playerid, COLOR_GRAD2, "USE: /agendarcadeia [NOME_CORRETO] [Tempo] [Motivo]");
				return true;
			}
            GetPlayerName(playerid, sendername, sizeof(sendername));
           	new arquivo[128];
			format(arquivo, sizeof(arquivo), "Contas/%s.ini",tmp);
			if(!DOF2_FileExists(arquivo))
			{
			    SendClientMessage(playerid, COLOR_WHITE, "[ERRO] Este nick nгo estб registrado no Brasil PlayHappy!");
			    return true;
			}
   			format(string, sizeof(string), "O Admin %s agendou o nick %s para %d minutos de cadeia, Motivo: %s",PlayerName(playerid), tmp, tempo2, (result));
            SendClientMessageToAll(COLOR_LIGHTRED, string);
            AgendarLog(string);
			DOF2_SetInt(arquivo,"Jailed",9);
			DOF2_SetInt(arquivo,"JailTime",tempo2 * 60);
		    strmid(AgendouInfo[playerid][cAdminAgendou], sendername, 0, strlen(sendername), MAX_PLAYER_NAME);
			DOF2_SetString(arquivo,"AdminAgendou",sendername);
 		    strmid(AgendouInfo[playerid][cMotivoAgendou], result, 0, strlen(result), MAX_PLAYER_NAME);
			DOF2_SetString(arquivo,"MotivoAgendou",result);
			DOF2_SetInt(arquivo,"Agendado",1);
			DOF2_SetInt(arquivo,"TempoAgendado",tempo2);
			DOF2_SaveFile();
        }
        return true;
    }

Coloque isto junto com as stocks
stock AgendarLog(string[])
{
	new entry[128];
	format(entry, sizeof(entry), "%s\n",string);
	new File:hFile;
	hFile = fopen("AgendarCadeia.log", io_append);
	fwrite(hFile, entry);
	fclose(hFile);
}
Reply
#3

Meu GM e em dini e da um erro no DOF2_SaveFile(); quando substituo por Dini_SaveFile();
Reply
#4

PHP код:
//Coloque isto com as includes
#include                <  Dini  >
//Coloque junto com as new
enum pAInfo{
cMotivoAgendou[128],
cAdminAgendou[64],};
new 
AgendouInfo[MAX_PLAYERS][pAInfo];
//Coloque isto na public OnCommandText
    
if(strcmp(cmd"/agendarcadeia",true) == || strcmp(cmd"/agendar",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 no Brasil PlayHappy!");
                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",9);
            
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;
    }
//Coloque isto junto com as stocks
stock AgendarLog(string[])
{
    new 
entry[128];
    
format(entrysizeof(entry), "%s\n",string);
    new 
File:hFile;
    
hFile fopen("AgendarCadeia.log"io_append);
    
fwrite(hFileentry);
    
fclose(hFile);

Converti com meu APP: SAMP Tool Maker
Reply
#5

e o local do spawn da cadeia para quando o player logar ?
Reply
#6

agenda tudo normal mas nгo prende e nao aparece nada quando entra com a conta que foi agendada.
Reply
#7

Alguem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)