Morrgans Posted January 28, 2017 Posted January 28, 2017 Descarcare: #include < amxmodx > #include < amxmisc > #include < cstrike > #include < fun > new const PLUGIN [ ] = "Points"; new const VERSION [ ] = "1.3"; new const AUTHOR [ ] = "Alex #"; new Points [ 33 ]; new SaveDataFile [ 128 ]; const Float:HUD_SPECT_X = -1.0 const Float:HUD_SPECT_Y = 0.8 public plugin_init ( ) { register_plugin ( PLUGIN, VERSION, AUTHOR ); register_event ( "DeathMsg", "eDeath", "a" ); new DataDir [ 64 ]; get_configsdir ( DataDir, charsmax ( DataDir ) ); format ( SaveDataFile, 127, "%s/Points.dat", DataDir ); set_task ( 0.1, "TASK_MSG", _, _, _, "b" ); } public plugin_natives ( ) { register_native ( "csdm_get_user_points", "get_user_points", 1 ); register_native ( "csdm_set_user_points", "set_user_points", 1 ); } public get_user_points ( id ) { return Points [ id ]; } public set_user_points ( id, PointsNum ) { Points [ id ] = PointsNum; } public eDeath ( ) { new Killer = read_data ( 1 ); new Victim = read_data ( 2 ); new HeadShoot = read_data ( 3 ); if ( Killer == Victim ) return PLUGIN_HANDLED; Points [ Killer ] += 1; if ( HeadShoot ) { Points [ Killer ] += 2; } return PLUGIN_CONTINUE; } public client_connect ( id ) { LoadPoints ( id ); } public client_disconnect ( id ) { SavePoints ( id ); } public LoadPoints ( id ) { new Name [ 32 ]; get_user_name ( id, Name, 31 ); new Line [ 128 ], IsPlayer = false, Arg1 [ 32 ], Arg2 [ 32 ]; new File = fopen ( SaveDataFile, "rt" ) while ( !feof ( File ) ) { fgets ( File, Line, 127 ); trim ( Line ); parse ( Line, Arg1, 31, Arg2, 31 ); if ( equali ( Arg1, Name ) ) { Points [ id ] = str_to_num ( Arg2 ); IsPlayer = true; break; } } fclose ( File ); if ( !IsPlayer ) Points [ id ] = 0; } public SavePoints ( id ) { new Name [ 32 ]; get_user_name ( id, Name, 31 ); new Save [ 1024 ]; format ( Save, sizeof ( Save ) -1, "^"%s^" %d", Name, Points [ id ] ); new Line [ 128 ], Linie, IsPlayer = false, Arg1 [ 32 ] new File = fopen ( SaveDataFile, "rt" ); while ( !feof ( File ) ) { fgets ( File, Line, 127 ); parse ( Line, Arg1, 31 ); if ( equali ( Arg1, Name ) ) { write_file ( SaveDataFile, Save, Linie ); IsPlayer = true; break; } Linie++ } fclose ( File ); if ( !IsPlayer ) write_file ( SaveDataFile, Save, -1 ); } public TASK_MSG ( ) { static id; for ( id = 1; id <= get_maxplayers ( ); id++ ) { if ( is_user_alive ( id ) && is_user_connected ( id ) ) { switch ( cs_get_user_team ( id ) ) { case CS_TEAM_T : { set_hudmessage ( id, 127, 255, HUD_SPECT_X, HUD_SPECT_Y, 1, 6.0, 1.1, 0.0, 0.0, -1 ); show_hudmessage ( id, "Terorist, HP: %d - AP: %d - Points: %d", get_user_health ( id ), get_user_armor ( id ), Points [ id ] ); } case CS_TEAM_CT : { set_hudmessage ( id, 127, 255, HUD_SPECT_X, HUD_SPECT_Y, 1, 6.0, 1.1, 0.0, 0.0, -1 ) show_hudmessage ( id, "Counter, HP: %d - AP: %d - Points: %d", get_user_health ( id ), get_user_armor ( id ), Points [ id ] ); } case CS_TEAM_SPECTATOR : { return PLUGIN_CONTINUE; } } } } return PLUGIN_CONTINUE; } Nume: PointsVersiune: 1.3Instalare:1. Fisierul Points.sma il puneti in addons/amxmodx/scripting2. Fisierul Points.amxx il puneti in addons/amxmodx/plugins3. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma: Points.amxx
Recommended Posts