Raised This Month: $ Target: $400
 0% 

Log event , global variables troubles


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
mihaiveress
Member
Join Date: Jan 2009
Location: Tirgu-Mures , Romania
Old 02-17-2009 , 06:17   Log event , global variables troubles
Reply With Quote #1

Hello i need some help to make some ideas about scripting regarding log events and global variables and the way they are mainained
sorry if i don't express myself write but I am at the begining ( only 3 posts )


first of all here is the entire source from the plugin i want to modify
http://files.filefront.com/xPaw+Antirusher...;/fileinfo.html

i want to do the followings
1. In the plugin it is set that a certain type of punishment is applied to the rushers depending on the cvar set by amx_antirusher_action
i want to make this punishment dinamic and to set the punishment by itself dependending on how many times the player has rushed
i thought of making a global array g_playerp[32] and here to set the number of rushes made
i know that if i declare [b] new g_playerp[32]=0 all of the fields will be set to 0 ( please corect me if I am wrong)
so..when you get to the punishment part ( M_Antirusher Punishments it is highlighted by comments ) i thought that this could be enough to change from the whole punishplayer function
PHP Code:
punishPlayer(id) {
    new 
action 0
    
new name[32]
    
get_user_name(id,name,31)
    
action get_cvar_num("amx_antirusher_action")
    if (
get_cvar_num("amx_antirusher_immunity") == 1) {
        if (
get_user_flags(id)&ADMIN_IMMUNITY) {
            
action 0
        
}
    }
    
    new 
players[32], ok=0num
    get_players
(players,num)
    new 
i=1
    
if(action==0)  // if admin then it won't get into the loop just write to other admins
         
{
         
ok=1  
         
new name[32]
         
get_user_name(id,name,31)
         
server_cmd("amx_chat %L",LANG_SERVER,"AR_SRV_INFO"name)
         }
    while(
i<num&&ok==0)
        {
        if(
equali(players[i]==id))
           {
           
g_playerp[i]++
           
ok=1
           
}
        
i++   
        }
    
i-=1    
        
    
switch (g_playerp[i]) {
        case 
0:{
            new 
name[32]
            
get_user_name(id,name,31)
            
server_cmd("amx_chat %L",LANG_SERVER,"AR_SRV_INFO"name)
            }
        case 
1:    server_cmd("amx_slap #%d %d",id,40)            
        case 
2user_silentkill(id)
        case 
3kickPlayer(id)
        case 
4banPlayer(id)
    }
    
client_print(idprint_chat"You crossed rush border! Dont break a rules! Say /rules")
    
log_amx("%s has passed rush borders",name)

so could this be right?
i want to determine the punishments by the authID, i also think that after banPlayer(id) i shoudl initialize to 0 the g_playerp[i] according to that authID because it leaves the server and it changes


another thing that i want to do is "play" with the events
what i mean by that is to count the number of wins that CTs and T have and to set a task that checks if the difference between the CT and the T score is more then 10 ( 2 global variables g_ctwin-g_twin>=10 ) and only then change the cvar amx_antirusher to 1 ( at de_ maps )
so when that happens some cvars get changed
- amx_antirusher = 1
- amx_antirusher_time = 120 ( the roundtime cvar of the server is set for 2 minutes => no rush at all, strange rules I know )
i found something for the event logging but don't know if it's enough to count
in the plugin_init()
Code:
register_logevent("t_round_end",2, "3=Terrorists_Win");
register_logevent("ct_round_end",2, "3=CTs_Win");
and after that
PHP Code:
public t_round_end()
{
    
g_twin+=1
}

public 
ct_round_end()
{
    
g_ctwin+=1

if i write like this will their value be increased?


another thing is to "delay" the punishments.
for example a player crosses the rush limit and it gets slaped or warned beeing the first time
i want the next punishment wouldn't be apllied as soon as he gets back rushing ( i mean a delay of half of minute or something like that)
i think that a solution might be to change the g_playerp array type and make it a double one like g_playerp[32][2] where g_playerp[i][1] shows the value of the rushes and g_playerp[i][2] will show the last time he was punished ( putting the value in by get_round_time )

for now these are my questions and i will try to find some answers in the morning by myself if noone helps me.... ( i hope it won't be the case )

thank you in advance
mihaiveress is offline
Send a message via Yahoo to mihaiveress Send a message via Skype™ to mihaiveress
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:53.


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