Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Top 3
Author Message
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #1
Top 3
Could some1 give me working function that check top 3 killers in server by kills and wrote them in serv log ?
Thanks! Veryhappy
07-12-2012 10:21 PM
Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #2
RE: Top 3
PHP Code:
[function allplayers]
for 
i 0 <eval <serv.accounts>-1>
    for 
x 0 <eval <serv.account.<local.i>.chars> - 1>
        
ref1=<serv.account.<local.i>.char.<local.x>>
        if (<
ref1>)
            
ref1.<args>
        endif    
    endfor
endfor    

[function 
top3_pk]
allplayers m_top3_pk
for 1 3
    ref1
=<var.kills_<dlocal._for>_uid>
    
serv.log <dlocal._for>. <ref1.name> <ref1.kills>
    var.
kills_<dlocal._for>_uid=
    var.
kills_<dlocal._for>=
endfor



[function 
m_top3_pk]
for 
1 3
    
if (<kills> >= <var.kills_<dlocal._for>>)
        var.
kills_<dlocal._for>=<kills
        var.
kills_<dlocal._for>_uid=<uid>
        return 
1
    
endif
endfor 

not tested, also its not a fastest one. for best performance you can store kills of all players in mysql. you can't call that function from players, for example you can't use this method for top 10 gumps because it will create lag on your server. maybe you can run this function in every world save etc.
(This post was last modified: 07-13-2012 02:03 AM by Shaklaban.)
07-13-2012 02:02 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #3
RE: Top 3
All is working but getting error
Undefined symbol ' '
for this line
if (<kills> >= <var.kills_<dlocal._for>>)
But cuild kills be stored as tag.ffaeventpoint ? becouse i needed this funtion for event to know with player have more tag.ffaeventpoint and could use only for players who have event e_ffa_tournament , but was hard to explane .. Confused
(This post was last modified: 07-13-2012 02:58 AM by Alias.)
07-13-2012 02:52 AM
Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #4
RE: Top 3
you can use var0 on the line which gives error. you can store them on a tag of a item.
07-13-2012 03:30 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #5
RE: Top 3
Ok i made with tag but it dont check all players becouse my account have 530 points but i am not in the top 3 even i should be in ...
07-13-2012 04:15 AM
Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #6
RE: Top 3
Firt of all sorry for double posting.
But i found funtion with dialog with works just the way i need it to work, but could some1 give me function for these funtion that when write that funtion it found first 3 places and do following 1 place get f_first, 2 place get f_second and 3 place get f_third
Thanks here functions

[FUNCTION status]
IF (<ISEVENT.E_ffa_event>) || (<ISGM>)
REGION.ALLCLIENTS Calc_TopPoints
CALL Sort_Players
DIALOGCLOSE d_point
DIALOG d_point
RETURN 0
ENDIF
SYSMESSAGE @50 You cant use this command here

[FUNCTION Calc_TopPoints]
IF <ISGM>
RETURN 0
ENDIF
IF (0<ACCOUNT.PLEVEL> > 1) && (0<ACCOUNT.PLEVEL> <4)
RETURN 0
ENDIF
SRC.TAG0.Players +=1
TRY SRC.TAG.PUID_<EVAL <SRC.TAG0.Players>>=<UID>
TRY SRC.TAG.P_<EVAL <SRC.TAG0.Players>>=<tag.qpoint> //ćåķåščšóåņ ī÷źč źšóņīńņč ļī ńóģģå ńźčėīā


[FUNCTION Sort_Players]
LOCAL.Top=<SRC.TAG0.Players>
FOR i 1 <EVAL <LOCAL.Top>>
FOR j <EVAL <LOCAL.i>> <EVAL <LOCAL.Top>>
IF (<TAG0.P_<EVAL <LOCAL.i>>><<TAG0.P_<EVAL <LOCAL.j>>>)
LOCAL.Temp=<TAG0.P_<EVAL <LOCAL.i>>>
TRY TAG.P_<EVAL <LOCAL.i>>=<TAG0.P_<EVAL <LOCAL.j>>>
TRY TAG.P_<EVAL <LOCAL.j>>=<LOCAL.Temp>
LOCAL.Temp1=<TAG0.PUID_<EVAL <LOCAL.i>>>
TRY TAG.PUID_<EVAL <LOCAL.i>>=<TAG0.PUID_<EVAL <LOCAL.j>>>
TRY TAG.PUID_<EVAL <LOCAL.j>>=<LOCAL.Temp1>
ENDIF
ENDFOR
ENDFOR

[DIALOG d_point]
0,0
resizepic 0 0 3600 280 <EVAL (100+(20*<SRC.TAG0.Players>))>
FOR i 1 <EVAL <SRC.TAG0.Players>>
dtext "+40 *20 100 <EVAL <LOCAL.i>>. <UID.<SRC.TAG0.PUID_<EVAL <LOCAL.i>>>.NAME>"
serv.log <EVAL <LOCAL.i>>. <UID.<SRC.TAG0.PUID_<EVAL <LOCAL.i>>>.NAME>
dtext "+200 +0 80 <EVAL <SRC.TAG0.P_<EVAL <LOCAL.i>>>>"
SRC.TRY TAG.PUID_<EVAL <LOCAL.i>>= //óįčšąåģ ēą ńīįīé
SRC.TRY TAG.P_<EVAL <LOCAL.i>>= //óįčšąåģ ēą ńīįīé
ENDFOR
dtext +50 +50 100 Total Points:
dtext +150 +50 80 <EVAL <VAR.QPOINT>>
SRC.TAG.Players=
07-13-2012 10:34 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)