AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   in 10 minutes get 150 Frags auto ban (https://forums.alliedmods.net/showthread.php?t=154545)

sb123 04-10-2011 06:04

in 10 minutes get 150 Frags auto ban
 
hi guys

if the player in 10 minutes get 150 Frags

how can auto ban?

10 minutes get 150 Frags server auto ban

20 minutes get 250 Frags server auto ban

30 minutes get 350 Frags server auto ban

we need you help

buddy

matsi 04-10-2011 06:32

Re: in 10 minutes get 150 Frags auto ban
 
Quote:

Originally Posted by sb123 (Post 1446928)
hi guys

if the player in 10 minutes get 150 Frags

how can auto ban?

10 minutes get 150 Frags server auto ban

20 minutes get 250 Frags server auto ban

30 minutes get 350 Frags server auto ban

we need you help

buddy

That doesn't make any sense. You wouldn't get 250 frags if you get 150 frags in 10 minutes and get banned. :shock:

hleV 04-10-2011 06:34

Re: in 10 minutes get 150 Frags auto ban
 
Quote:

Originally Posted by matsi (Post 1446940)
That doesn't make any sense. You wouldn't get 250 frags if you get 150 frags in 10 minutes and get banned. :shock:

You can get 140 frags in 10 minutes and then another 110 (which makes 250 in total) in another 10 minutes.

sb123 04-10-2011 06:36

Re: in 10 minutes get 150 Frags auto ban
 
Quote:

Originally Posted by matsi (Post 1446940)
That doesn't make any sense. You wouldn't get 250 frags if you get 150 frags in 10 minutes and get banned. :shock:

oh sorry my misstep

now only need get 150 frags in 10 minutes inside get banned

we need you help

ConnorMcLeod 04-10-2011 06:38

Re: in 10 minutes get 150 Frags auto ban
 
Try this :

PHP Code:

#define LOGBANS

#include <amxmodx>

#define VERSION "0.0.1"
#define PLUGIN "HighScores AutoBan"

new g_pCvarBanTime

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
g_pCvarBanTime register_cvar("amx_highscore_bantime""0")

    
register_event("ScoreInfo""Event_ScoreInfo""a")
}

public 
Event_ScoreInfo()
{
    new 
id read_data(1)
    if( !
is_user_connected(id) )
    {
        return
    }
    new 
iTime get_user_time(id)
    if( 
iTime 600 )
    {
        return
    }
    new 
iFrags read_data(2) - 50
    
if( iFrags / (iTime 600) >= 10 )
    {
        new 
szSteamId[32]
        
get_user_authid(idszSteamIdcharsmax(szSteamId))
    
#if defined LOGBANS
        
new szName[32], szIp[22]
        
get_user_name(idszNamecharsmax(szName))
        
get_user_ip(idszIpcharsmax(szIp))
        
LogToFile("%s<%s><%s> was banned for high score (Time %d, Frags %d)"szNameszSteamIdszIpiTimeiFrags)
    
#endif
        
server_cmd("kick #%d ^"HighScore^";wait;banid %d %s;wait;writeid"get_user_userid(id), get_pcvar_num(g_pCvarBanTime), szSteamId)
    }
}

#if defined LOGBANS
LogToFile(const fmt[], any:...)
{
    static 
szLogFile[64]
    static 
date[22]
    if( !
szLogFile[0] )
    {
        
get_localinfo("amxx_logs"szLogFilecharsmax(szLogFile))
        
format(szLogFilecharsmax(szLogFile), "%s/HighScoresBans_%s.log"szLogFiledate)
    }

    new 
szLog[256]
    
vformat(szLogcharsmax(szLog), fmt2)

    
get_time("%m/%d/%Y - %H:%M:%S"datecharsmax(date))

    new 
fp fopen(szLogFile"at")
    
fprintf(fp"L %s: %s^n"dateszLog)
    
fclose(fp)
}
#endif 


sb123 04-10-2011 06:47

Re: in 10 minutes get 150 Frags auto ban
 
thanks you ConnorMcLeod

any Cvar i can set?

amx_highscore_bantime 10 (baned 10 min)

but the Frags and user time?

ConnorMcLeod 04-10-2011 06:48

Re: in 10 minutes get 150 Frags auto ban
 
Too late, you came with a request, i made the request, next time comme with a more detailled one ;)

sb123 04-10-2011 06:51

Re: in 10 minutes get 150 Frags auto ban
 
hi ConnorMcLeod

i just have some code Don't understand

don't need you edit new plugins

PHP Code:

    new iFrags read_data(2) - 50
    
if( iFrags / (iTime 600) >= 10 

can you explain this ?

ConnorMcLeod 04-10-2011 07:09

Re: in 10 minutes get 150 Frags auto ban
 
That's maths...

divide player time by 600 sec (10min)
lower the score by 50 so then you can match what you asked 150, 250, 350, 450 : becomes 100, 200, 300, 400

Then check if score is 10 time bigger than amount of 10 minutes the player has played.

sb123 04-10-2011 07:15

Re: in 10 minutes get 150 Frags auto ban
 
i got it!

thanks you


All times are GMT -4. The time now is 20:11.

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