Page 1 of 1
errors
Posted: 2011 Feb 23 22:09
by aurimasko
Code: Select all
new kill[33] public touch(toucher, touched){ if(kill[toucher] && kill[touched]) { static team_touched, team_toucher team_touched = get_user_team(touched) team_toucher = get_user_team(toucher) if(team_touched == 2 && team_toucher == 1) { ima[toucher] = true cs_set_weapon_ammo(give_item(toucher, "weapon_m4a1"), 30) set_user_health(toucher, 100) } }}
Viskas veikia, bet į konsolę errorina kaip pasiutęs..

Ant šitos eilutės if(kill[toucher] && kill[touched])
Code: Select all
public event_new_round(){ new players[32], num, id get_players(players, num, "aehc", "CT") if(num) id = players[random(num)] new nickas[32] get_user_name(id, nickas, 31) set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), -1.0, 0.3, 2, 0.5, 5.0) ShowSyncHudMsg(0, hudmessage3, "= Sianden dienas ves %s! =", nickas)}
Taip pat viskas veikia, bet kodėl rašo kartais vietoj kažkurio CT nicko serverio pavadinimą?
Re: errors
Posted: 2011 Feb 23 22:58
by aaarnas
Su kokiom entity klasėm registruojamas touch? Netikrini ar žaidėjas, dėl to spėju errorina index out of bound. Parodyk kas iškviečia touch.
Jei serverio pavadinimą, tai id vadinasi yra 0. Pasižiūrėk apskritai num kintamąjį, ar apskritai žaidėjų randa, ir naudok random_num(nuo, iki)
Re: errors
Posted: 2011 Feb 23 23:28
by aurimasko
register_forward(FM_Touch,"touch")
Kartais parašo CT nicką, o kartais ir serverio pavadinimą.
Re: errors
Posted: 2011 Feb 24 13:39
by newb
aurimasko wrote:Code: Select all
public event_new_round(){ new players[32], num, id get_players(players, num, "aehc", "CT") if(num) id = players[random(num)] new nickas[32] get_user_name(id, nickas, 31) set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), -1.0, 0.3, 2, 0.5, 5.0) ShowSyncHudMsg(0, hudmessage3, "= Sianden dienas ves %s! =", nickas)}
Code: Select all
get_players(players, num, "aehc", "CT")
Cia seip nereikalingas "h" flagas ir "c" irgi tikriausei.
Jeigu num bus 0, tai ir id bus 0, o tai reiskia ims serverio pavadinima.
Re: errors
Posted: 2011 Feb 24 16:43
by aaarnas
Geriau registruok su engine, o ne fakemeta, nes fakemeta tikrina absoliučiai bet kokio entity prisilietimą. Labai nepraktiška. Geriau engine:
Code: Select all
register_touch("player", "player", "touch")
Re: errors
Posted: 2011 Feb 24 19:34
by aurimasko
o tai kaip padaryt kad num nebūtų 0?
-- 2011 Vas 24 20:34 --
o tai kaip padaryt kad num nebūtų 0?
Re: errors
Posted: 2011 Feb 24 19:35
by newb
num tai gi zaideju skaicius......
Re: errors
Posted: 2011 Feb 24 19:54
by aurimasko
Tai ir nebūna 0..
Re: errors
Posted: 2011 Feb 24 20:13
by newb
Nu tada jie tai keicia teamus ar da ka. Naudok tada ta fixa kur idejau, gal pades.