CS.RIN.RU - Steam Underground Community
http://cs.rin.ru/forum/

cs 1.6 helk fix kills counter plugin
http://cs.rin.ru/forum/viewtopic.php?f=31&t=58904
Page 1 of 1

Author:  tfk-94 [ Tuesday, 22 Feb 2011, 22:14 ]
Post subject:  cs 1.6 helk fix kills counter plugin

this plugin is supposed to count kills and when u make X kills u gain a level
100 kills newbie
500 kills semi pro
750 kills pro
1000 kills veteran
but it doesnt work can someone help me fix it
here is the code

  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <nvault>
  4.  
  5. new const Version[] = "0.2";
  6.  
  7. enum KillLevels {
  8.    Newbie,
  9.    SemiPro,
  10.    Pro,
  11.    Veteran
  12. }
  13.  
  14. new KillLevelRange[ KillLevels ][ 2 ] =  {
  15.    { 0 , 499 },
  16.    { 500 , 749 },
  17.    { 750 , 999 },
  18.    { 1000 , 999999 }
  19. };
  20.  
  21. new KillLevelName[ KillLevels ][] =  {
  22.    "Newbie",
  23.    "Semi-Pro",
  24.    "Pro",
  25.    "Veteran"
  26. };
  27.  
  28. enum DeathMsg_Arg {
  29.    KillerID,
  30.    VictimID,
  31.    IsHeadshot,
  32.    WeaponName
  33. }
  34.  
  35. enum PlayerInfo {
  36.    Name[ 32 ],
  37.    AuthID[ 34 ],
  38.    NumKills,
  39.    KillLevels:CurrentLevel
  40. }
  41.  
  42. new g_PlayerData[ 33 ][ PlayerInfo ];
  43. new g_iVault;
  44. new g_MsgSayText;
  45.  
  46. public plugin_init()  {
  47.    register_plugin( "Kill Levels" , Version , "bugsy" );
  48.    register_event( "DeathMsg" , "fw_EvDeathMsg" , "a" , "1>0" );
  49.    register_clcmd( "say" , "fw_CmdSay" );
  50.    register_clcmd( "say_team" , "fw_CmdSayTeam" );
  51.    
  52.    g_MsgSayText = get_user_msgid( "SayText" );
  53.    if ( ( ( g_iVault = nvault_open( "klevels" ) ) == INVALID_HANDLE ) )
  54.       set_fail_state( "Error opening vault" );
  55. }
  56. public AnnounceJoin( id ) {
  57.    client_print( 0 , print_chat , "* %s is a %s in this server!" , g_PlayerData[ id ][ Name ] , KillLevelName[ g_PlayerData[ id ][ CurrentLevel ] ] );
  58. }
  59.  
  60. public plugin_end() {
  61.    nvault_close( g_iVault );
  62. }
  63. public client_infochanged(id)  {
  64.    if (!is_user_connected(id))
  65.       return
  66.    get_user_info(id, "name", g_PlayerData[id][Name], charsmax(g_PlayerData[][Name]))
  67. }
  68. public client_putinserver( id ) {
  69.    get_user_name( id , g_PlayerData[ id ][ Name ] , charsmax( g_PlayerData[][ Name ] ) );
  70.    get_user_ip( id , g_PlayerData[ id ][ AuthID ] , charsmax( g_PlayerData[][ AuthID ] ) );
  71.    if ( ( g_PlayerData[ id ][ NumKills ] = nvault_get( g_iVault , g_PlayerData[ id ][ AuthID ] ) ) ) {
  72.       SetPlayerLevel( id );
  73.       set_task( 7.0 , "AnnounceJoin" , id );
  74.    }
  75. }
  76. public client_disconnect( id ) {
  77.    new szKills[ 6 ];
  78.    num_to_str( g_PlayerData[ id ][ NumKills ] , szKills , charsmax( szKills ) );
  79.    nvault_set( g_iVault , g_PlayerData[ id ][ AuthID ] , szKills );
  80.    g_PlayerData[ id ][ Name ][ 0 ] = EOS;
  81.    g_PlayerData[ id ][ AuthID ][ 0 ] = EOS;
  82.    g_PlayerData[ id ][ NumKills ] = 0;
  83.    g_PlayerData[ id ][ CurrentLevel ] = _:Newbie;
  84. }
  85. public fw_EvDeathMsg() {
  86.    new id = read_data( _:KillerID );
  87.    g_PlayerData[ id ][ NumKills ]++;
  88.    SetPlayerLevel( id );
  89. }
  90. public fw_CmdSay(id) {
  91.    static szMessage[ 192 ] , iPlayers[ 32 ];
  92.    new bool:bIsAlive , iPos , iNum , iPlayer;
  93.    bIsAlive = bool:is_user_alive( id );
  94.    iPos = formatex( szMessage , charsmax( szMessage ) , "%s[%s] ^x03%s ^x01:  ", bIsAlive ? "^x04 " : "^x01*DEAD*^x04 " , KillLevelName[ g_PlayerData[ id ][ CurrentLevel ] ] , g_PlayerData[ id ][ Name ] , szMessage );
  95.    read_args( szMessage[ iPos ] , charsmax( szMessage ) - iPos );
  96.    remove_quotes( szMessage[ iPos ] );
  97.    get_players( iPlayers , iNum );
  98.    for ( new i = 0 ; i < iNum ; i++ ) {
  99.       iPlayer = iPlayers[ i ];
  100.       if( ( bIsAlive && is_user_alive( iPlayer ) ) || ( !bIsAlive && !is_user_alive( iPlayer ) ) ) {
  101.          message_begin( MSG_ONE_UNRELIABLE , g_MsgSayText , {0, 0, 0} , iPlayer );
  102.          write_byte( id );
  103.          write_string( szMessage );
  104.          message_end();
  105.       }
  106.    }
  107.    return PLUGIN_HANDLED;
  108. }
  109. public fw_CmdSayTeam( id ) {
  110.    static szMessage[ 192 ] , iPlayers[ 32 ];
  111.    new bool:bIsAlive , iPos , iNum , iPlayer , CsTeams:iTeam;
  112.    new const szTeams[ CsTeams ][] =  {
  113.       "",
  114.       "Terrorist",
  115.       "Counter-Terrorist",
  116.       "Spectator"
  117.    };
  118.    bIsAlive = bool:is_user_alive( id );
  119.    iTeam = cs_get_user_team( id );
  120.    iPos = formatex( szMessage , charsmax( szMessage ) , "^x01%s^x01(%s) ^x04[%s] ^x03%s ^x01:  " , bIsAlive ? "" : "*DEAD*" , szTeams[ iTeam ] , KillLevelName[ g_PlayerData[ id ][ CurrentLevel ] ] , g_PlayerData[ id ][ Name ] , szMessage );
  121.    read_args( szMessage[ iPos ] , charsmax( szMessage ) - iPos );
  122.    remove_quotes( szMessage[ iPos ] );
  123.    get_players( iPlayers , iNum );
  124.    for ( new i = 0 ; i < iNum ; i++ ) {
  125.       iPlayer = iPlayers[ i ];
  126.       if ( ( iTeam == cs_get_user_team( iPlayer ) ) && ( ( bIsAlive && is_user_alive( iPlayer ) ) || ( !bIsAlive && !is_user_alive( iPlayer ) ) ) ) {
  127.          message_begin( MSG_ONE_UNRELIABLE , g_MsgSayText , {0, 0, 0} , iPlayer );
  128.          write_byte( id );
  129.          write_string( szMessage );
  130.          message_end();
  131.       }
  132.    }
  133.    return PLUGIN_HANDLED;
  134. }
  135.  
  136. SetPlayerLevel( id ) {
  137.    for ( new KillLevels:iLevel = Newbie ; iLevel < KillLevels ; iLevel++ ) {
  138.       if ( KillLevelRange[ iLevel ][ 0 ] <= g_PlayerData[ id ][ NumKills ] <= KillLevelRange[ iLevel ][ 1 ] )  {
  139.          g_PlayerData[ id ][ CurrentLevel ] = _:iLevel;
  140.          break;
  141.       }
  142.    }
  143. }

Author:  .Rar [ Tuesday, 22 Feb 2011, 22:34 ]
Post subject:  Re: cs 1.6 helk fix kills counter plugin

Moved to the main forum, since although this involves coding (somewhat), it doesn't fit the developer section.

Judging from the title, it'd appear a "fix" you applied made the plugin stop working. It may help if you provide more details about that.

Author:  tfk-94 [ Tuesday, 22 Feb 2011, 22:39 ]
Post subject:  Re: cs 1.6 helk fix kills counter plugin

i will try to explaind the best i can becouse my english is bad
this plugin makes u to gain a level when u reach X kills
when u connect u have a prefix in front of ur nick - "newbie"
and when u reach 500 kills i have to become a Semipro

enum KillLevels {
Newbie,
SemiPro,
Pro,
Veteran

new KillLevelRange[ KillLevels ][ 2 ] = {
{ 0 , 499 },
{ 500 , 749 },
{ 750 , 999 },
{ 1000 , 999999 }

but it doesnt work it doesnt changes there prefix when they reach the kills
i hope someone understand me

Author:  lespaul [ Wednesday, 23 Feb 2011, 08:30 ]
Post subject:  Re: cs 1.6 helk fix kills counter plugin

You are in the wrong forum i think, go to alliedmodders forum for amxx coding.

Author:  tfk-94 [ Wednesday, 23 Feb 2011, 13:31 ]
Post subject:  Re: cs 1.6 helk fix kills counter plugin

they didnt help me there
but i see u also wont help me so u can lock the topick

Author:  .Rar [ Wednesday, 23 Feb 2011, 18:50 ]
Post subject:  Re: cs 1.6 helk fix kills counter plugin

tfk-94 wrote:
but i see u also wont help me so u can lock the topick


That's a bit drastic, but if it's what you want...

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/