Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842
PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165
PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165
PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165
PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588
PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612
PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1
PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1
PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1
PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1
PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6 Loot
Hello, It's me again.
I back to my project for tibia 7.6;p
Now I wanna create Looter option, so i have problem here too ;p
So... Anybody can review this code? I think problem is in the near end function
[code=delphi]procedure lotter;
var
CurrentBP, Count_:Integer;
CurrentItem: Integer;
CurrentSlot,bpnr,lbp,lbpa,tbp: Integer;
BpAmmount: Byte;
s:integer;
a: integer; //do paietu
packetbuffer:array[0..255] of byte; //do pakietu
label start;
label s2;
begin
sleep(300);
start:
for CurrentBP := 0 to BP_max - 1 do
begin
if MemoryReadByte(Backpack_Start+(CurrentBP*Bp_size)+ BP_dist_open)=1 then begin
if is_corp(ReadMemstring(BackPack_start+(CurrentBP*BP _size)+BP_Dist_name)) then begin
stop;
BpAmmount := memoryReadByte(BackPack_start+(CurrentBP*BP_size)+ BP_dist_item_amount);
// BPItemCount:= memory.readbyte(addresses.Container_Start+(Current BP*addresses.Container_StepContainer)+addresses.Co ntainer_DistanceVolume);
for CurrentSlot := 0 to BPAMMOUNT -1 do begin
bpnr:= CurrentBP;
if (Form1.slistbox1.Items.Strings[s])=(pchar(inttostr( CurrentItem))) then begin
Count_ :=MemoryReadInt((Backpack_Start+(bpnr*Bp_size))+(C urrentSlot*Bp_item_size)+64);
for lbpa:=0 to BP_max do begin
if MemoryReadByte(BackPack_Start+(tbp*BP_Size)+BP_Dis t_Open)=1 then
s2:
lbp:= memoryreadbyte(BackPack_Start+(tbp*Bp_size)+BP_dis t_item_amount);
lbp:= memoryreadbyte(Backpack_Start+(tbp*Bp_size)+Bp_dis t_size);
if ( lbpa = lbp) then begin
tbp:= tbp+1;
if memoryreadbyte(BackPack_Start+(tbp*Bp_size)+Bp_dis t_open)=1 then begin
end else begin
exit;
end;
end;
begin
Randomize;
for a := 0 to 255 do
Begin
packetbuffer[a]:= Random(255);
End;
begin
packetBuffer[0]:= $0F;
packetBuffer[1]:= $00;
packetBuffer[2] := $78;
packetBuffer[3] := $FF;
packetBuffer[4] := $FF;
packetBuffer[5] := $40; // what here? + ? is_corp?
packetBuffer[6] := $00;
packetBuffer[7] := item.slot;
packetBuffer[8] := smallinttobyte(CurrentItem, 1);
packetBuffer[9] := smallinttobyte(CurrentItem, 2);
packetBuffer[10] := item.slot;
packetBuffer[11] := $FF;
packetBuffer[12] := $FF;
packetBuffer[13] := lbp; // slotto
packetBuffer[14] := $00;
packetBuffer[15] := lbp; //slotto too ;p
packetBuffer[16] := Count_; //count
SendPacket(pID, @PacketBuffer);
end;
sleep(300);
goto start;
end;
end;
end;
end;
end;
end;
end;
end;
end;[/code]
Please answer in this thread, or on private message.
Thanks with up!
;]
You just need split your code in more functions and put its to work togerther in a logical way.
I really recommend this book,its will help you a lot in the ways of programming.
1. The code is atrocious, please reindent it. As it is now, nobody has any idea if it's even syntactically correct.
2. Wtf do you need labels and gotos for? Almost all uses of goto are better handled with break / continue.
3. Some variable names are ok, others are too cryptic. tbp? lbp? lbpa?
4. for lbpa:=0 to BP_max do begin -- are you sure you didn't want BP_max-1 as the upper bound?
5. Right after that, lbp variable is written to twice.