Raised This Month: $ Target: $400
 0% 

give exp when ct or t win


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Zombie Player
Member
Join Date: May 2014
Old 06-23-2014 , 17:22   give exp when ct or t win
Reply With Quote #1

please help me in this plugin i need to add to it code when ct or t win give all team who win 1 exp please help me
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#include <fun>
#include <nvault>
#include <hamsandwich>
#define PREFIX "[...]"
new gExp[33], gLvl[33], gSpecs[33];
new 
gCvarKillgCvarHsgCvarSuigCvarWingCvarLoose;
new 
gVault;
new const 
Specs[][] =
{
 
"Newbie",
 
"Regular",
 
"ModeRate",
 
"Semi-Pro",
 
"OptiMax"
}
new const 
Levels[] =
{
 
0,
 
25,
 
50,
 
75,
 
100,
 
125,
 
150,
 
175,
 
200,
 
235,
 
270,
 
310,
 
350,
 
375,
 
400,
 
425,
 
450,
 
485,
 
520,
 
555,
 
600
}
new const 
CTWin[][] =
{
 
"2=%!MRAD_ctwin",
 
"2=%!MRAD_BOMBDEF",
 
"2=%!MRAD_rescued"
}
public 
plugin_init()
{
 
register_plugin("Exp-Mod""1.0""Rtk.Esc")
 
 
register_event"DeathMsg""DeathEvent""a" )
 
register_event"SendAudio""TwinEvent""a""2=%!MRAD_terwin" )
 for(new 
isizeof(CTWin); i++)
  
register_event"SendAudio""CwinEvent""a"CTWin[i] )
 
RegisterHamHam_Spawn"player""HamSpawnEvent")
 
 
gCvarKill  register_cvar("exp_kill",     "20")
 
gCvarHs    register_cvar("exp_headshot","10")
 
gCvarSui   register_cvar("exp_suicide""10")
 
gCvarWin   register_cvar("exp_win",     "10")
 
gCvarLoose register_cvar("exp_loose",   "5")
 
 
register_clcmd("say /xp""showExp")
 
register_clcmd("say /info""showInfo")
 
 
gVault nvault_open("exp")
}
public 
SaveExp(id)
{
 new 
SteamID[35]
 
get_user_authid(idSteamID34)
 
 new 
vaultkey[64],vaultdata[256]
 
format(vaultkey63"%s-Mod"SteamID)
 
format(vaultdata255"%i#%i#%i#"gExp[id], gLvl[id], gSpecs[id])
 
nvault_set(gVaultvaultkeyvaultdata)
 
 return 
PLUGIN_CONTINUE
}
public 
LoadExpid )
{
 new 
SteamID[35]
 
get_user_authid(idSteamID34)
 
 new 
vaultkey[64],vaultdata[256]
 
format(vaultkey63"%s-Mod"SteamID)
 
format(vaultdata255"%i#%i#%i#"gExp[id], gLvl[id], gSpecs[id])
 
nvault_get(gVault,vaultkey,vaultdata,255)
 
 
replace_all(vaultdata255"#"" ")
 new 
exp[32], lvl[32], specs[32]
 
 
parse(vaultdataexp31lvl31specs31)
 
 
gExp[id] = str_to_num(exp)
 
gLvl[id] = str_to_num(lvl)
 
gSpecs[id] = str_to_num(specs)
 
 return 
PLUGIN_CONTINUE;
}
public 
client_authorized(id)
{
 
LoadExp(id)
}
public 
client_disconnect(id)
{
 
SaveExp(id)
 
gExp[id] = 0;
 
gLvl[id] = 0;
 
gSpecs[id] = 0;
}
public 
DeathEvent()
{
 new 
iAtkr read_data(1)
 new 
iVict read_data(2)
 new 
iSuic read_data(0)
 new 
AtkrTeam get_user_team(iAtkr)
 new 
VictTeam get_user_team(iVict)
 
 if(
is_user_bot(iAtkr) || AtkrTeam == VictTeam)
 {
  return 
PLUGIN_HANDLED;
 }
 
 if(
iSuic)
 {
  
gExp[iSuic] -= get_pcvar_num(gCvarSui)
  
SaveExp(iSuic)
  return 
PLUGIN_HANDLED;
 }
 
 if(
AtkrTeam != VictTeam)
 {
  
gExp[iAtkr] += get_pcvar_num(gCvarKill)
  
  if(
read_data(3))
  {
   
gExp[iAtkr] += get_pcvar_num(gCvarHs)
  }
 }
 while(
gExp[iAtkr] >= Levels[gLvl[iAtkr]])
 {
  
gLvl[iAtkr] += 1;
  
ColorChat(iAtkrGREEN"%sCongratulations! You grew to level %i!"PREFIXgLvl[iAtkr]);
  if(
gLvl[iAtkr] == || 10 || 15 || 20)
  {
   
rankUp(iAtkr);
  }
 }
 
SaveExp(iAtkr)
 return 
PLUGIN_CONTINUE;
}
public 
TwinEvent( )
{
 for ( new 
id 1id <= 32; ++id )
 {
  if(
get_user_team(id) == )
  {
   
gExp[id] -= get_pcvar_num(gCvarLoose)
   
SaveExp(id)
   return 
PLUGIN_HANDLED;
  }
  if( 
get_user_team id ) == )
  {
   
gExp[id] += get_pcvar_numgCvarWin )
   
   while( 
gExp[id] >= Levels[gLvl[id]] )
   {
    
gLvl[id] += 1;
    
ColorChat(idGREEN"%sCongratulations! You grew to level %i!"PREFIXgLvl[id]);
    if(
gLvl[id] == || 10 || 15 || 20)
    {
     
rankUp(id);
    }
    
SaveExpid );
   }
  }
 }
 return 
PLUGIN_HANDLED;
}
public 
CwinEvent( )
{
 for ( new 
id 1id <= 32; ++id )
 {
  if(
get_user_team(id) == )
  {
   
gExp[id] -= get_pcvar_num(gCvarLoose)
   
SaveExp(id)
   return 
PLUGIN_HANDLED;
  }
  if( 
get_user_team id ) == )
  {
   
gExp[id] += get_pcvar_numgCvarWin )
   
   while( 
gExp[id] >= Levels[gLvl[id]] )
   {
    
gLvl[id] += 1;
    
ColorChat(idGREEN"%sCongratulations! You grew to level %i!"PREFIXgLvl[id]);
    if(
gLvl[id] == || 10 || 15 || 20)
    {
     
rankUp(id);
    }
    
SaveExpid );
   }
  }
 }
 return 
PLUGIN_HANDLED;
}
public 
HamSpawnEvent(id)
{
 if(
gLvl[id] >= 5)
  
set_user_health(id105)
 if(
gLvl[id] >= 8)
  
set_user_health(id110)
 if(
gLvl[id] >= 12)
  
set_user_health(id120)
 if(
gLvl[id] >= 15)
  
set_user_health(id130)
 if(
gLvl[id] >= 18)
 {
  
set_user_health(id135)
  
give_item(id"weapon_hegrenade")
 }
 if(
gLvl[id] >= 21)
 {
  
set_user_health(id140);
  
give_item(id"weapon_hegrenade");
  
give_item(id"weapon_awp");
 }
}
 
public 
showExp(id)
{
 
set_hudmessage(255000.010.1706.012.0)
 
show_hudmessage(id"[%s]Exp: %i Lvl: %i"Specs[gSpecs[id]], gExp[id], gLvl[id])
}
public 
showInfo(id)
{
 
set_hudmessage(255000.010.1706.012.0)
 
show_hudmessage(id"[%s]Exp:%i/%i Lvl: %i"Specs[gSpecs[id]], gExp[id], Levels[gLvl[id] + 1], gLvl[id])
}
public 
rankUp(id)

 if(
gLvl[id] == 5)
 {
  
gSpecs[id] = 1;
  
ColorChat(idGREEN"%sYou grew to %s"PREFIXSpecs[gSpecs[id]])
 }
 if(
gLvl[id] == 10)
 {
  
gSpecs[id] = 2;
  
ColorChat(idGREEN"%sYou grew to %s"PREFIXSpecs[gSpecs[id]])
 }
 if(
gLvl[id] == 15)
 {
  
gSpecs[id] = 3;
  
ColorChat(idGREEN"%sYou grew to %s"PREFIXSpecs[gSpecs[id]])
 }
 if(
gLvl[id] == 20)
 {
  
gSpecs[id] = 4;
  
ColorChat(idGREEN"%sYou grew to %s"PREFIXSpecs[gSpecs[id]])
 }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1053\\ f0\\ fs16 \n\\ par }
*/ 
Zombie Player is offline
 



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 21:14.


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