Advertisement
Guest User

Untitled

a guest
May 30th, 2011
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.79 KB | None | 0 0
  1. public Event_DeathMsg() {
  2.    
  3.     new iKillerSkill = 0
  4.     new iVictimSkill = 0;
  5.    
  6.     new steam[32], victim_steam[32]
  7.     new id = get_msg_arg_int(1)
  8.     new victim = get_msg_arg_int(2)
  9.     new headshot = get_msg_arg_int(3)
  10.     new KillerWeapon = get_user_weapon(id, _, _);
  11.     new VictimWeapon = get_user_weapon(victim, _, _);
  12.     get_user_authid(id, steam, charsmax(steam))
  13.     get_user_authid(victim, victim_steam, charsmax(victim_steam))
  14.    
  15.     new bool:qVisible = fm_is_ent_visible(id, victim)
  16.  
  17.     if(!is_user_connected(id) || is_user_bot(victim))
  18.         return PLUGIN_HANDLED;
  19.    
  20.     if(id != victim)
  21.     {      
  22.         new szKillerData[64]
  23.         new szVictimData[64]
  24.    
  25.         new iKillerLen = formatex(szKillerData, charsmax(szKillerData), "kills=kills+1")
  26.         new iVictimLen = formatex(szVictimData, charsmax(szVictimData), "deaths=deaths+1")
  27.        
  28.         if(headshot)
  29.             iKillerLen += formatex(szKillerData[iKillerLen], charsmax(szKillerData) - iKillerLen, ", headshots=headshots+1")
  30.        
  31.         iDead[id] = 0;
  32.         iDead[victim] +=1;
  33.        
  34.         iKilled[victim] = 0;
  35.         iKilled[id] +=1;
  36.        
  37.         switch(iKilled[id])
  38.         {
  39.             case 2: iKillerSkill = 1
  40.             case 3: iKillerSkill = 2
  41.             case 4: iKillerSkill = 4
  42.             case 5: iKillerSkill = 8
  43.             case 6..31: iKillerSkill = 10
  44.         }
  45.        
  46.         switch(iDead[victim])
  47.         {
  48.             case 3: iVictimSkill = 1
  49.             case 4: iVictimSkill = 2
  50.             case 5: iVictimSkill = 4
  51.             case 6..100: iVictimSkill = 5
  52.         }
  53.        
  54.         if(KillerWeapon == CSW_KNIFE && VictimWeapon != CSW_KNIFE)
  55.         {
  56.             iKillerSkill += random_num(3, 7)
  57.         }
  58.        
  59.         if(++iDoubleKill[id] >= 2)
  60.         {
  61.             iDoubleKill[id] = 0;
  62.            
  63.             iKillerSkill += random_num(5, 10)
  64.         }
  65.        
  66.         if(!qVisible)
  67.         {
  68.             iKillerSkill += random_num(1, 2)
  69.         }
  70.        
  71.         set_task(0.1, "funcResetCount", id + FUNKYTHING);
  72.        
  73.         if(Onehp[id])
  74.             iKillerSkill += random_num(2, 7);
  75.        
  76.         new steamercent;
  77.         if( ( get_user_flashed( id, steamercent ) ) )
  78.         {
  79.             if( steamercent == 100 )
  80.                 iKillerSkill += random_num(3, 8);
  81.         }
  82.        
  83.         if(iKillerSkill)
  84.             iKillerLen += formatex(szKillerData[iKillerLen], charsmax(szKillerData) - iKillerLen, ", skill=((kills + headshots ) / deaths + %d)", iKillerSkill)
  85.            
  86.         if(iVictimSkill)
  87.             iVictimLen += formatex(szKillerData[iVictimLen], charsmax(szVictimData) - iVictimLen, ", skill=((kills + headshots ) / deaths - %d)", iVictimSkill)
  88.    
  89.         formatex(MySQL_Query, charsmax(MySQL_Query), "UPDATE `stats` SET %s WHERE steam='%s'", szKillerData, steam)
  90.         SQL_SimpleQuery(MySQL_Connection, MySQL_Query)
  91.        
  92.         formatex(MySQL_Query, charsmax(MySQL_Query), "UPDATE `stats` SET %s WHERE steam='%s'", szVictimData, victim_steam)
  93.         SQL_SimpleQuery(MySQL_Connection, MySQL_Query)
  94.     }
  95.     else
  96.     {
  97.         formatex(MySQL_Query, charsmax(MySQL_Query), "UPDATE `stats` SET skill=skill-%d WHERE steam='%s'", random_num(5, 15), steam)
  98.         SQL_SimpleQuery(MySQL_Connection, MySQL_Query)
  99.     }
  100.     return PLUGIN_HANDLED;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement