Переменная 0@ ведь отвечает за форматирование всего текста?Ошибка собственно у тебя в get_weapon_name_by_id . 20@ поменяй на 0@ . В 20@ у тебя 0, ибо параметров всего 1.
Переменные в функции никак не зависят от основного тела и начинают считаться с 0@, используй функцию так как ее тебе дали,Переменная 0@ ведь отвечает за форматирование всего текста?
//call @get_weapon_name_by_id1 id 20@to21@
:get_weapon_name_by_id
0AC6: 1@ = label @weapons offset
0@ *= 19
005A: 1@ += 0@ // (int)
ret 1 1@
:weapons
hex
"Duke" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 0 }
"Brass Knuckles" 00 00 00 00 00 { 1 }
"Golf Club" 00 00 00 00 00 00 00 00 00 00 { 2 }
"Nite Stick" 00 00 00 00 00 00 00 00 00 { 3 }
"Knife" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 4 }
"Baseball" 00 00 00 00 00 00 00 00 00 00 00 { 5 }
"Shovel" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 6 }
"Pool Cue" 00 00 00 00 00 00 00 00 00 00 00 { 7 }
"Katana" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 8 }
"Chainsaw" 00 00 00 00 00 00 00 00 00 00 00 { 9 }
"Dildo" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 10 }
"Dildo" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 11 }
"Dildo" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 12 }
"Dildo" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 13 }
"Flowers" 00 00 00 00 00 00 00 00 00 00 00 00 { 14 }
"Cane" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 15 }
"Grenade" 00 00 00 00 00 00 00 00 00 00 00 00 { 16 }
"Tear Gas" 00 00 00 00 00 00 00 00 00 00 00 { 17 }
"Molotov" 00 00 00 00 00 00 00 00 00 00 00 00 { 18 }
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 19 }
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 20 }
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 21 }
"Pistol" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 22 }
"Silencer" 00 00 00 00 00 00 00 00 00 00 00 { 23 }
"Deagle" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 24 }
"Shotgun" 00 00 00 00 00 00 00 00 00 00 00 00 { 25 }
"SawnOff" 00 00 00 00 00 00 00 00 00 00 00 00 { 26 }
"Spas12" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 27 }
"Tec9" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 28 }
"MP5" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 29 }
"AK47" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 30 }
"M4" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 31 }
"Mac10" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 32 }
"Rifle" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 33 }
"Sniper" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 34 }
"Rocket Launcher" 00 00 00 00 { 35 }
"HS Rocket Launcher" 00 { 36 }
"Flamethrower" 00 00 00 00 00 00 00 { 37 }
"Minigun" 00 00 00 00 00 00 00 00 00 00 00 00 { 38 }
"C4" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 39 }
"Detonator" 00 00 00 00 00 00 00 00 00 00 { 40 }
"Spray" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 41 }
"Fire Extinguisher" 00 00 { 42 }
"Camera" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 43 }
"Nightvision" 00 00 00 00 00 00 00 00 { 44 }
"Infrared Vision" 00 00 00 00 { 45 }
"Parachute" 00 00 00 00 00 00 00 00 00 00 { 46 }
end
Спасибо, завтра чекнуПеременные в функции никак не зависят от основного тела и начинают считаться с 0@, используй функцию так как ее тебе дали,
Код://call @get_weapon_name_by_id1 id 20@to21@ :get_weapon_name_by_id 0AC6: 1@ = label @weapons offset 0@ *= 19 005A: 1@ += 0@ // (int) ret 1 1@ :weapons hex "Duke" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 0 } "Brass Knuckles" 00 00 00 00 00 { 1 } "Golf Club" 00 00 00 00 00 00 00 00 00 00 { 2 } "Nite Stick" 00 00 00 00 00 00 00 00 00 { 3 } "Knife" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 4 } "Baseball" 00 00 00 00 00 00 00 00 00 00 00 { 5 } "Shovel" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 6 } "Pool Cue" 00 00 00 00 00 00 00 00 00 00 00 { 7 } "Katana" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 8 } "Chainsaw" 00 00 00 00 00 00 00 00 00 00 00 { 9 } "Dildo" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 10 } "Dildo" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 11 } "Dildo" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 12 } "Dildo" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 13 } "Flowers" 00 00 00 00 00 00 00 00 00 00 00 00 { 14 } "Cane" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 15 } "Grenade" 00 00 00 00 00 00 00 00 00 00 00 00 { 16 } "Tear Gas" 00 00 00 00 00 00 00 00 00 00 00 { 17 } "Molotov" 00 00 00 00 00 00 00 00 00 00 00 00 { 18 } 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 19 } 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 20 } 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 21 } "Pistol" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 22 } "Silencer" 00 00 00 00 00 00 00 00 00 00 00 { 23 } "Deagle" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 24 } "Shotgun" 00 00 00 00 00 00 00 00 00 00 00 00 { 25 } "SawnOff" 00 00 00 00 00 00 00 00 00 00 00 00 { 26 } "Spas12" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 27 } "Tec9" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 28 } "MP5" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 29 } "AK47" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 30 } "M4" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 31 } "Mac10" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 32 } "Rifle" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 33 } "Sniper" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 34 } "Rocket Launcher" 00 00 00 00 { 35 } "HS Rocket Launcher" 00 { 36 } "Flamethrower" 00 00 00 00 00 00 00 { 37 } "Minigun" 00 00 00 00 00 00 00 00 00 00 00 00 { 38 } "C4" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 39 } "Detonator" 00 00 00 00 00 00 00 00 00 00 { 40 } "Spray" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 41 } "Fire Extinguisher" 00 00 { 42 } "Camera" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 43 } "Nightvision" 00 00 00 00 00 00 00 00 { 44 } "Infrared Vision" 00 00 00 00 { 45 } "Parachute" 00 00 00 00 00 00 00 00 00 00 { 46 } end
Как вариант - возвращай переменной, отвечающей за положение текста по Y(как я понял, у тебя это 13@), ее первоначальное значение после после полностью пройденного цикла с поиском игроков.Использую такой опкод - 0B6F.
Идёт проверка на подключение определенных игроков, всё работает, но если таковых игроков больше 1, то скрипт всё в 1 место пишет, я использовал 000A: 13@ += 15, но т.к стоит бесконечный цикл, скрипт всё быстро прибавляет, в итоге ничего нет. Как бы это исправить?
{$CLEO}
0000:
:Samp
0afa: s
wait 100
jf @Samp
0AC8: 4@ = allocate_memory_size 256
0B6D: render 5@ = create_font "Comic Sans MS" height 8 flags 5
while true
wait 0
13@ = 250
for 0@ = 0 to 999
if 0B23: samp is_player_connected 0@
then
0B36: samp 1@ = get_player_nickname 0@
if 0A9A: 2@ = openfile "cleo/test/test.txt" mode "r"
then
0AC8: 3@ = allocate_memory_size 548
0C11: memset destination 3@ value 0 size 548
repeat
if 0AD7: read_string_from_file 2@ to 3@ size 548
then
if 0C18: 0 = stricmp string1 1@ string2 3@
then
0AD3: 4@ = format "%s [ID: %d]" 1@ 0@
000A: 13@ += 15
0B6F: render font 5@ draw_text 4@ pos 20 13@ color -1
end
end
until 0AD6: end_of_file 2@ reached
end
0A9B: closefile 2@
end
end
end
{$CLEO}
0000:
:Samp
0afa: s
wait 100
jf @Samp
if 0A9A: 2@ = openfile "cleo/test/test.txt" mode "r"
then
alloc 3@ 548
alloc 6@ 900
0C11: memset destination 3@ value 0 size 548
repeat
if 0AD7: read_string_from_file 2@ to 3@ size 548
then
for 7@ = 0 to 30
0C20: string_array 6@ element 7@ size 30 = 3@
end
end
until 0AD6: end_of_file 2@ reached
end
0A9B: closefile 2@
0AC8: 4@ = allocate_memory_size 256
0B6D: render 5@ = create_font "Comic Sans MS" height 8 flags 5
while true
wait 0
alloc 6@ 900
13@ = 250
0B6F: render font 5@ draw_text "Admin's online:" pos 40 13@ color -1
for 0@ = 0 to 999
if 0B23: samp is_player_connected 0@
then
0B36: samp 1@ = get_player_nickname 0@
0C1F: 8@ = string_array 6@ element 7@ size 30
if 0C18: 0 = stricmp string1 1@ string2 8@
then
0AD3: 4@ = format "%s [ID: %d]" 1@ 0@
000A: 13@ += 15
0B6F: render font 5@ draw_text 4@ pos 40 13@ color -1
end
end
end
end
зачем ты каждую строку файла записываешь во все элементы массива? и эт, под чтение строки у тебя 548 байт, хотя в массив записываешь 30, к чему тогда эти 548? и длина ника вообще 20 байт, и цикл фор тут не нуженАаа, массивы, никогда не работал с ними.
Исправьте, пожалуйста.
CLEO:{$CLEO} 0000: :Samp 0afa: s wait 100 jf @Samp if 0A9A: 2@ = openfile "cleo/test/test.txt" mode "r" then alloc 3@ 548 alloc 6@ 900 0C11: memset destination 3@ value 0 size 548 repeat if 0AD7: read_string_from_file 2@ to 3@ size 548 then for 7@ = 0 to 30 0C20: string_array 6@ element 7@ size 30 = 3@ end end until 0AD6: end_of_file 2@ reached end 0A9B: closefile 2@ 0AC8: 4@ = allocate_memory_size 256 0B6D: render 5@ = create_font "Comic Sans MS" height 8 flags 5 while true wait 0 alloc 6@ 900 13@ = 250 0B6F: render font 5@ draw_text "Admin's online:" pos 40 13@ color -1 for 0@ = 0 to 999 if 0B23: samp is_player_connected 0@ then 0B36: samp 1@ = get_player_nickname 0@ 0C1F: 8@ = string_array 6@ element 7@ size 30 if 0C18: 0 = stricmp string1 1@ string2 8@ then 0AD3: 4@ = format "%s [ID: %d]" 1@ 0@ 000A: 13@ += 15 0B6F: render font 5@ draw_text 4@ pos 40 13@ color -1 end end end end
0AD3 maybe?Как присвоить одной переменной значение другой? Вроде бы элементарно, но 14@ = 13@ не работает.
нет, не format нужен0AD3 maybe?