Raised This Month: $ Target: $400
 0% 

Get log events , global variables comparation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mihaiveress
Member
Join Date: Jan 2009
Location: Tirgu-Mures , Romania
Old 02-15-2009 , 11:30   Get log events , global variables comparation
Reply With Quote #1

Hello
I have a script from an antirush plugin and tried to modify something at it
now please tell where I did wrong.... i will show you what i want to do with what part of it
this is the part refering to the punishments
PHP Code:
punishPlayer(id) {
                
    new 
action 1
    action 
get_cvar_num("amx_antirusher_action")    
    if ((
get_cvar_num("amx_antirusher_immunity") == 1)&&(get_user_flags(id)&ADMIN_IMMUNITY)) {
        
action 0
    
}
    switch (
action) {
        case 
0:{
        new 
name[32]
        
get_user_name(id,name,31)
        
server_cmd("amx_chat %L",LANG_SERVER,"AR_SRV_INFO"name)
        }
        case 
1:    fm_fakedamage id"rashing"slap*1.0,16384)
        case 
2user_silentkill(id)
        case 
3kickPlayer(id)
        case 
4banPlayer(id)
        case 
5:{
            if(
speed_limit[id]==0){
                
speed_limit[id]=1
                fm_set_user_maxspeed
(id,(fm_get_user_maxspeed(id)/2.0));
            }
        }
        case 
6:{
            if(
flashed[id]==0){
                
flashed[id]=1
                set_task
(FLASH_TIME,"Flash",TASK_FLASH+id
            }
        }
        case 
7:{
            new 
Floatvelocity[3]
            new 
FloatDW //Długosc wektora
            
pev(id,pev_velocity,velocity)
            
DW=vector_length velocity )+0.0001
            velocity
[0]=(velocity[0]/DW)*(-500.0)
            
velocity[1]=(velocity[1]/DW)*(-500.0)
            if(
velocity[2]<0velocity[2]=velocity[2]*(-1.0)+15.0 //wyrzuca do gory
            
set_pev(id,pev_velocity,velocity)    
        }
        case 
8:{
            
rasher[id]=1
        
}
        case 
9:{
            
aim_on_me(id)
        }
        case 
10:{
            
ebay_time_to_pay(id)    // ogladalem filmik w flashu i to chyba przez to :p
        
}
        default:{
            new 
name[32]
            
get_user_name(id,name,31)
            
server_cmd("amx_chat %L:p",LANG_SERVER,"AR_SRV_INFO"name)
        }
    }
    if (
warn_control >(25/floatround(10.0*TEST_TIME))){    // jak dlugo siedzisz w granicy to ci pisze w czacie :p
    
client_print(idprint_chat"%L",LANG_PLAYER,"AR_RASH_WARN")
    
warn_control=0;}
    
warn_control+=1

    
if(get_cvar_num("amx_antirusher_sound")){
        if(
sounded[id]==0){
        new 
sound_mode get_cvar_num("amx_antirusher_sound_mode")
        
        if(
sound_mode==0client_cmd(id,"spk %s",actions[action])
        else 
client_cmd(0,"spk %s",actions[action])
        
sounded[id]=1
        
}        
    }

now what i want to do is to disable the punishment menu and make the punishments apply by themselves so this is what how it now looks :d

PHP Code:
punishPlayer(id) {
                
    new 
action 1
    action 
get_cvar_num("amx_antirusher_action")    
    if ((
get_cvar_num("amx_antirusher_immunity") == 1)&&(get_user_flags(id)&ADMIN_IMMUNITY)) {
        
action 0
    
}
    
    new 
players[33], ok=0num
    get_players
(players,num)
    new 
i=1
    
if(action==0ok=1
    
while(i<num&&ok==0)
        {
        if(
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)
            
server_cmd("amx_tsay %L",LANG_SERVER,"AR_SRV_INFO"name)
            }
        
//case 1:    fm_fakedamage ( id, "rashing", slap*1.0,16384)
        
case 1:    server_cmd("amx_slap #%d %d",id,40)
            
        case 
2user_silentkill(id)
        case 
3kickPlayer(id)
        case 
4banPlayer(id)
default:{
            new 
name[32]
            
get_user_name(id,name,31)
            
server_cmd("amx_chat %L:p",LANG_SERVER,"AR_SRV_INFO"name)
        }
    }
    if (
warn_control >(25/floatround(10.0*TEST_TIME))){    // jak dlugo siedzisz w granicy to ci pisze w czacie :p
    
client_print(idprint_chat"%L",LANG_PLAYER,"AR_RASH_WARN")
    
warn_control=0;}
    
warn_control+=1

    
if(get_cvar_num("amx_antirusher_sound")){
        if(
sounded[id]==0){
        new 
sound_mode get_cvar_num("amx_antirusher_sound_mode")
        
        if(
sound_mode==0client_cmd(id,"spk %s",actions[action])
        else 
client_cmd(0,"spk %s",actions[action])
        
sounded[id]=1
        
}        
    }

now this is what I've changed
at the begining of the code I initiated a global array called g_playerp[33]=0 to set all the values to 0
when you enter the part of the punishments you get the authID of the player by function call
after that you get all the players id and compare them , if they are the same the value for g_playerp equal to the player is increased by 1
depending on what the number is you get the pennalty associated

pls tell me if i wrote it right?



LE: when I modify g_playerp does it take global effect?
I managed to solve the problem but it still doesn't take the punishment increase although i pass through 2 no rush limits ( and not with admin )

LLE: done...i was comparing 2 strings as if they ware numeric values

sorry for the space occupied

Last edited by mihaiveress; 02-17-2009 at 16:18.
mihaiveress is offline
Send a message via Yahoo to mihaiveress Send a message via Skype™ to mihaiveress
Reply



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:52.


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