Page 1 of 2
Random koordinatės
Posted: 2011 Feb 15 16:44
by xFrostas
Dariau pluginą su random kordinatėm ir tekstais. Bet kažką netaip padariau ir dabar kai yra
Code: Select all
new const Float: HudMsg_Coords[][] = { {-1.0, 0.3}, {-1.0, 0.25}, {-1.0, 0.2}, {-1.0, 0.15}, {-1.0, 0.1}, {-1.0, 0.5}} new g_PlayerPos[32 + 1] new iPos = ++g_PlayerPos[id] set_dhudmessage(255, 255, 0, Float: HudMsg_Coords[iPos][0], Float: HudMsg_Coords[iPos][1], 1, 6.0, 2.0)show_dhudmessage(id, "vTest TEXT")
Rodo tik šešias žinutes o paskui jų neberodo o kaip padaryt, kad kai parodo visas šešias vėl kartotu?
Re: Random koordinatės
Posted: 2011 Feb 15 16:59
by newb
Jeigu tau reikia kad rodytu visas is eiles galima taip
Code: Select all
static cord = 0 set_hudmessage(255, 0, 0, HudMsg_Coords[cord][0], HudMsg_Coords[cord][1], 0, 6.0, 12.0)show_hudmessage(id, "test") if(cord++ == charsmax(HudMsg_Coords)) cord = 0
Re: Random koordinatės
Posted: 2011 Feb 15 17:06
by xFrostas
Aha dėkui, pats nė nepastebėjau, kad praleidau tą restinimą.
-- 2011 Vas 15 18:15 --
O dar greit norėjau paklaust ką reiškia šitas ir kodėl neberodo hudmsg kai jį įterpiu?
Code: Select all
if ((1 <= attacker <= g_MaxPlayers)){// ........}
Re: Random koordinatės
Posted: 2011 Feb 15 19:03
by aaarnas
Šitas patikrina ar attacker yra tarp 1 ir 32. Čia naudojama įsitikinti ar tas id yra žaidėjo, o ne kokio kito entity.
Re: Random koordinatės
Posted: 2011 Feb 15 19:56
by xFrostas
o kodėl kai įterpiu šitą, neberodo msg?
Re: Random koordinatės
Posted: 2011 Feb 15 20:44
by aaarnas
Žiūrint kur tu ką įterpi.
Re: Random koordinatės
Posted: 2011 Feb 15 21:03
by xFrostas
Code: Select all
if ((1 <= attacker <= g_MaxPlayers)){if (victim != attacker){set_dhudmessage(255, 255, 0, Float: HudMsg_Coords[iPos][0], Float: HudMsg_Coords[iPos][1], 1, 6.0, 2.0)show_dhudmessage(id, "vTest TEXT")}}
Re: Random koordinatės
Posted: 2011 Feb 15 22:57
by aaarnas
Kame čia logika? Visą funkciją parodyk.
Re: Random koordinatės
Posted: 2011 Feb 15 23:05
by xFrostas
Visą tai visą.
Code: Select all
public Ev_DeathMsg(){ new attacker = read_data(1) new victim = read_data(2) if ((1 <= attacker <= g_MaxPlayers)) { if (victim != attacker) { if (PlayerLevel[attacker] < MaxLevel-1) { PlayerXP[attacker] += get_cvar_num("XP_Kill") set_dhudmessage(255, 255, 0, -1.0, 0.3, 1, 6.0, 2.0) show_dhudmessage(attacker, "+%d XP For Killing!", get_cvar_num("XP_Kill")) } } }}
Re: Random koordinatės
Posted: 2011 Feb 17 16:40
by aaarnas
Pradžioje vienaip rodei, po to kitaip. Šitam paskutiniam kode klaidų nematau, tik geriau naudot pcvar, nebent šie cvarai sukuriame ne pačiame plugine.