AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   small help needed (https://forums.alliedmods.net/showthread.php?t=134582)

Afro-Ankan 08-06-2010 17:00

small help needed
 
Can someone tell me how to do.. ?

i want it like this.
when your earn xp, you earn them on 2 different ways.. Making Headshot or Just killing.. Is this right ?

PHP Code:

public eDeath( )
{
 
 new 
iKiller read_data(1);
 new 
kill_name[128];
 
 new 
iVictim read_data(2);
 new 
vic_name[128];
 
 new 
iHeadshot read_data(3);
 
 
//Make sure that the killer exists
 
if( <= iKiller <= get_maxplayers() )
 {
  
//If victim is not killer
  
if( iVictim != iKiller )
  {
   
//If victim is not a teammate of killer
   
if( cs_get_user_teamiVictim ) != cs_get_user_teamiKiller ) )
   {
    
get_user_name(iVictimvic_name127);
 
    
PlayerXP[iKiller] += get_pcvar_num(XP_Kill)
    
client_print(iKillerprint_chat"%s You got 20 XP for killing %s"PREFIXvic_name);
   }
   else
   {
    if(
iHeadshot)
 
    
PlayerXP[iKiller] += get_pcvar_num(XP_Hs);
    
client_print(iKillerprint_chat"%s You got bonus XP for killing %s with Headshot"PREFIXvic_name);
 
    
//Get the victims name
    
get_user_name(iVictimvic_name127);
 
    
//get the killers name
    
get_user_name(iKillerkill_name127);
 
    while(
PlayerXP[iKiller] >= LEVELS[PlayerLevel[iKiller]])
    {
     
client_print(0print_chat"%s You are now on Level %i"PREFIXPlayerLevel[iKiller]);
 
     
PlayerLevel[iKiller] += 
    
}
   }
 
  }
 
 }
 



t3hNox 08-06-2010 17:18

Re: small help needed
 
You could give more information like the errors from compiler.

Afro-Ankan 08-06-2010 17:33

Re: small help needed
 
there is no compiling Errors..

i just want to get kills from either Headshot OR killing...

now i cant get from headshot.. and before that i got for headshot and kill. just want to get either kill or headshot..

vL. 08-06-2010 20:10

Re: small help needed
 
I think the Headshot one should be before the kill. Atleast thats how mine is.

PHP Code:

public eDeath( )
{    
    new 
iKiller read_data(1);
    new 
kill_name[128];
    
    new 
iVictim read_data(2);
    new 
vic_name[128];
    
    new 
iHeadshot read_data(3);
    
    
//Make sure that the killer exists
    
if( <= iKiller <= get_maxplayers() )
    {
        
//If victim is not killer
        
if( iVictim != iKiller )
        {
            
//If victim is not a teammate of killer
            
if( cs_get_user_teamiVictim ) != cs_get_user_teamiKiller ) )
            {
                
get_user_name(iVictimvic_name127);
                
                if(
iHeadshot)
                {
                    
PlayerXP[iKiller] += get_pcvar_num(XP_Hs);
                    
client_print(iKillerprint_chat"%s You got bonus XP for killing %s with Headshot"PREFIXvic_name);
                }
                else
                {                
                    
PlayerXP[iKiller] += get_pcvar_num(XP_Kill)
                    
client_print(iKillerprint_chat"%s You got 20 XP for killing %s"PREFIXvic_name);
                }
                
//Get the victims name
                
get_user_name(iVictimvic_name127);
                
                
//get the killers name
                
get_user_name(iKillerkill_name127);
                
                while(
PlayerXP[iKiller] >= LEVELS[PlayerLevel[iKiller]])
                {
                    
client_print(0print_chat"%s You are now on Level %i"PREFIXPlayerLevel[iKiller]);
                    
                    
PlayerLevel[iKiller] += 
                
}
            }
        }
    }


PS: Didn't test.

Vechta 08-07-2010 03:33

Re: small help needed
 
maybe?
PHP Code:

public eDeath( )
{
    new 
iKiller read_data(1);
    new 
kill_name[128];
 
    new 
iVictim read_data(2);
    new 
vic_name[128];
 
    new 
iHeadshot read_data(3);
 
    
//Make sure that the killer exists
    
if( <= iKiller <= get_maxplayers() )
    {        
        if(
iHeadshot)
 
        
PlayerXP[iKiller] += get_pcvar_num(XP_Hs);
        
client_print(iKillerprint_chat"%s You got bonus XP for killing %s with Headshot"PREFIXvic_name);
 
        
//Get the victims name
        
get_user_name(iVictimvic_name127);
 
        
//get the killers name
        
get_user_name(iKillerkill_name127);
 
        while(
PlayerXP[iKiller] >= LEVELS[PlayerLevel[iKiller]])
        {
            
client_print(0print_chat"%s You are now on Level %i"PREFIXPlayerLevel[iKiller]);
            
PlayerLevel[iKiller] += 
        
}
        else
        {
            
//If victim is not killer
            
if( iVictim != iKiller )
            {
                
//If victim is not a teammate of killer
                
if( cs_get_user_teamiVictim ) != cs_get_user_teamiKiller ) )
                {
                    
get_user_name(iVictimvic_name127);
 
                    
PlayerXP[iKiller] += get_pcvar_num(XP_Kill)
                    
client_print(iKillerprint_chat"%s You got 20 XP for killing %s"PREFIXvic_name);
                }
            }
        }
    }



Afro-Ankan 08-07-2010 19:22

Re: small help needed
 
thanks guys, but i find my own way...

PHP Code:

public eDeath( )
{
 new 
iKiller read_data(1);
 new 
kill_name[32];
 
 new 
iVictim read_data(2);
 new 
vic_name[32];
 
 new 
iHeadshot read_data(3);
 
 
//Make sure that the killer exists
 
if( <= iKiller <= get_maxplayers() )
 {
  
//If victim is not killer
  
if( cs_get_user_team(iKiller) != cs_get_user_team(iVictim) )
  {
   
get_user_name(iVictimvic_namecharsmax(vic_name)     );
   
//If victim is not a teammate of killer
   
if(!iHeadshot)
   {
    
PlayerPS[iKiller] += get_pcvar_num(PS_Kill)
    
print_color(iKiller"You got ^x04%i^x01 Points for killing ^x04%s"get_pcvar_num(PS_Kill), vic_name);
   }
   else
   {
    
PlayerPS[iKiller] += get_pcvar_num(PS_Hs);
    
print_color(iKiller"You got ^x04%i^x01 Points for killing ^x04%s^x01 with ^x04Headshot"get_pcvar_num(PS_Hs), vic_name);
    
    
//get the killers name
    
get_user_name(iKillerkill_namecharsmax(kill_name)   );
   }
   
   while(
PlayerPS[iKiller] >= LEVELS[PlayerLevel[iKiller]])
   {
    
print_color(iKiller"You just reced Level %i"iKillerPlayerLevel[iKiller]);
    
PlayerLevel[iKiller] += 1
   
}
  }
  
 } 




All times are GMT -4. The time now is 00:07.

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