Показать сообщение отдельно
Старый 27.09.2011, 02:16   #17
Пользователь
 
Регистрация: 01.08.2010
Сообщений: 82
Сказал Спасибо: 49
Имеет 5 спасибок в 4 сообщенях
semiromid пока неопределено
По умолчанию

Код:
begin
  if FromServer and (pck[1]=#$39) then begin   //от сервера получен пакет $39 
    if ReadS(2) = 'Пиротехник' then               //проверяем от кого 
    buf:=Hstr('43 01 00 00 00');
    timer.enabled:=true;
    TimerStep:=1  
    else     
      buf:=hstr('43 00 00 00 00');             //Создаем пакет "Отказать в пати"
    pck :='';                                  //убиваем этот пакет
    SendToServer;                            //Отправляем его на сервер
  end;
Опять напротив else ошибку выдает(




Код:
const
name = 'AntBuf';  

var
    timer:TTimer;
    TimerStep:byte;
procedure Init; 
begin
    TimerStep:=1;
    timer:=TTimer.Create(nil);
    timer.OnTimer:=@OnTimer;
    timer.enabled:=false;
    timer.interval:=1000; //время задержки между отправкой пакетов.
end;

procedure Free;
begin
    timer.free;
end;

procedure OnTimer;
    begin
        case TimerStep of
        
                   
            1: 
                begin  
                    timer.interval:=1000;
                    buf:=Hstr('49 14 04 3E 04 31 04 40 04 3E 04 20 00 3F 04 3E 04 36 04 30 04 3B 04 3E 04 32 04 30 04 42 04 4C 04 20 00 3A 04 20 00 31 04 30 04 44 04 35 04 40 04 43 04 20 00 3A 04 3B 04 30 04 3D 04 30 04 20 00 22 00 1B 04 38 04 33 04 30 04 22 00 20 00 21 00 00 00 03 00 00 00');
                    SendToServerEx(name);
                    Inc(TimerStep);
                end;        
        
            2: 
                begin
                    timer.interval:=1000;
                    buf:=Hstr('39 93 03 00 00 00 00 00 00 00');
                    SendToServerEx(name);
                    Inc(TimerStep);
                end;
            3: 
                begin 
                    timer.interval:=2000;
                    buf:=Hstr('39 10 01 00 00 00 00 00 00 00');
                    SendToServerEx(name); 
                    Inc(TimerStep);                
                end; 
            4: 
                begin 
                    timer.interval:=2000;
                    buf:=Hstr('39 36 01 00 00 00 00 00 00 00');
                    SendToServerEx(name);
                    Inc(TimerStep);
                end;
            5: 
                begin 
                    timer.interval:=2000;
                    buf:=Hstr('39 0F 01 00 00 00 00 00 00 00');
                    SendToServerEx(name); 
                    Inc(TimerStep);                
                end; 
            6: 
                begin 
                    timer.interval:=2000;
                    buf:=Hstr('39 DD 03 00 00 00 00 00 00 00');
                    SendToServerEx(name);
                    Inc(TimerStep);
                end;

            7: 
                begin 
                    timer.interval:=1000;
                    buf:=Hstr('39 13 01 00 00 00 00 00 00 00');
                    SendToServerEx(name); 
                    Inc(TimerStep);                
                end; 
            8: 
                begin 
                    timer.interval:=1000;
                    buf:=Hstr('39 12 01 00 00 00 00 00 00 00');
                    SendToServerEx(name);
                    Inc(TimerStep);
                end;                                               
            9: 
                begin 
                    timer.interval:=2000;
                    buf:=Hstr('49 21 04 3F 04 30 04 41 04 38 04 31 04 3E 04 20 00 47 04 42 04 3E 04 20 00 32 04 3E 04 41 04 3F 04 3E 04 3B 04 4C 04 37 04 3E 04 32 04 30 04 3B 04 38 04 41 04 4C 04 20 00 48 04 42 04 30 04 42 04 3D 04 4B 04 3C 04 20 00 3A 04 3B 04 30 04 3D 04 20 00 31 04 30 04 44 04 35 04 40 04 3E 04 3C 04 21 00 1F 04 40 04 38 04 45 04 3E 04 34 04 38 04 42 04 35 04 20 00 35 04 49 04 35 04 20 00 3A 00 29 00 00 00 03 00 00 00');
                    SendToServerEx(name);
                    Inc(TimerStep);                       
                end;
            10: 
                begin 
                    buf:=Hstr('44');
                    SendToServerEx(name);              
                    timer.enabled:=false;     
                end;                            
        end;
    end;

begin
  if FromServer and (pck[1]=#$39) then begin   //от сервера получен пакет $39 
    if ReadS(2) = 'Пиротехник' then               //проверяем от кого 
    buf:=Hstr('43 01 00 00 00');
    timer.enabled:=true;
    TimerStep:=1  
    else     
      buf:=hstr('43 00 00 00 00');             //Создаем пакет "Отказать в пати"
    pck :='';                                  //убиваем этот пакет
    SendToServer;                            //Отправляем его на сервер
  end; 

end.

Последний раз редактировалось semiromid, 27.09.2011 в 02:20.
semiromid вне форума   Ответить с цитированием