AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Simple Pointbased RankStats (https://forums.alliedmods.net/showthread.php?t=93399)

Pinatz 05-28-2009 10:19

Simple Pointbased RankStats
 
Hey,
Actually I have no idea if I'm supposed to put the thread in here or in the suggestions forum.

I know this from a sourcemod and hlstatsx(which you have to rent actually..)
Players who are new to the server get specific points e.g. 2000
For killing another person he gets 2 Points + 1 point for each 100´s the other player has more than him.The other person who got killed gets those points abstracted.
Then there should be a command for /top15 and /rank

No need for more stats. The plan is to get the code as simple as possible.
I´ve had a look in some stats plugins but they're so overfilled with code that you can't see what is really important.
The things I have no idea of are,
- how to save them into a file
- how to sort them efficiently
- how to show a top15 and the rank

best would be with sql to view the rankings on a http-site but this is optional.

I think I will use the XP Mod Tutorial to begin at first. So I can save the XP as points.
Does the saved file has to be sorted for a top15 and ranks? When they´re saved in the XP mod tutorial they are not sorted by points :>

I need help :D

Xellath 05-28-2009 12:04

Re: Simple Pointbased RankStats
 
Use the XP mod tutorial, inplent SQL support to it?

And what about "the xp mod doesn't save as points" - it saves a value. You can just rename the XP thing to points.

Pinatz 05-28-2009 20:02

Re: Simple Pointbased RankStats
 
yup I started to implement my code after the guide by flyeni6 -
PHP Code:

new experience
                experience 
= ((PlayerEP[pTouched]-PlayerEP[pToucher])/100)
                if (
experience <= 1)
                    
experience 2
                
if (PlayerEP[pTouched] <= 1000)
                    
experience 1
                
if (PlayerEP[pTouched] <= 0)
                    
experience 0
                PlayerEP
[pToucher] += experience
                PlayerEP
[pTouched] -= experience
                
if (PlayerEP[pTouched] <= 0) {
                    
PlayerEP[pTouched] = 0
                
}
                
cs_set_user_money(pToucherPlayerEP[pToucher],1); 

I save the stats with
PHP Code:

public SaveData(id

    
// get the players steam id. We need this because we are saving by steam id 
    
new AuthID[35]
    
get_user_authid(id,AuthID,34
    new 
vaultkey[64],vaultdata[256
    
// format what is going to be in the catchmod vault file 
    
format(vaultkey,63,"%s-Mod",AuthID
    
format(vaultdata,255,"%i#",PlayerEP[id]) 
    
// save the data 
    
nvault_set(g_vault,vaultkey,vaultdata
    return 
PLUGIN_CONTINUE 


But what I don't know is how to format a MOTD message with the top15
and how to do rankings.


All times are GMT -4. The time now is 01:35.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.