RSSy MYGO.pl Opublikowano Lipiec 3, 2022 o 00:41 RSSy Udostępnij Opublikowano Lipiec 3, 2022 o 00:41 Hi guys i have this plugin i just want to change from hud to chat and add every kill this chats.. &x04[DZ-Points] You Killed %s , and you got 5 Points. &x04[DZ-Points] Head Shot kill %s, and you got 10 Points. &x04[DZ-Points] You Knifed %s , and you got 5 Points. &x04[DZ-Points] You Knifed %s HS , and you got 10 Points. PHP Code: #include <amxmodx> #include <nvault> // Defining numbers , for better read ability #define NORMAL_KILL 5 #define HEADSHOT_KILL 10 #define KNIFE_KILL 5 #define KNIFE_HEADSHOT 10 #define BOMB_DEFUSED 8 #define CT_WIN 5 #define TR_WIN 5 //our uniq task id #define TASK_ID 1000 // Max players that a server can have #define MAX_PLAYERS 32 // Hud X position const Float: HUD_POSITION_X = -1.0 // Hud Y position const Float: HUD_POSITION_Y = 0.88 // Hud display time const Float:HOLD_TIME = 9.9 const HUD_CHANNEL = 1 new const VERSION[] = "1.0" //Our main array for Point_System new Points[MAX_PLAYERS + 1] // Saving users authid here new szAuthid[MAX_PLAYERS + 1][35] // nVault new g_save public plugin_init() { register_plugin("Point System" , VERSION , "Abaaaaadiii.") // Logevents , (For increasing points) register_logevent("bomb_defused", 3, "2=Defused_The_Bomb") register_logevent("on_CTWin", 6, "3=CTs_Win", "3=All_Hostages_Rescued") register_logevent("on_TerroristWin" , 6, "3=Terrorists_Win", "3=Target_Bombed") // called whenever a cliend dies/killed register_event ("DeathMsg", "Event_Death", "a") } // Opening Our nVault (All of our data related to points , authids are saved in an nVault file) public plugin_cfg() { g_save = nvault_open("FR-Points") if ( g_save == INVALID_HANDLE ) { set_fail_state( "Error opening nVault" ) } } // close nVault public plugin_end() { nvault_close(g_save) } // Our natives (They are so useful whe you want to make sub-plugins) public plugin_natives() { register_library("point_sytem") register_native("get_user_point" , "native_get_user_point") register_native("set_user_point" , "native_set_user_point") } // get_user_point public native_get_user_point(index) { return Points[get_param(1)] } // set_user_point public native_set_user_point(index , amount) { Points[get_param(1)] = get_param(2) } // get user authid , and load point whenever a client joins server + start a task for showing player point in hud public client_putinserver(id) { get_user_authid(id , szAuthid[id] , charsmax(szAuthid)) LoadData(id) set_task (1.0, "show_points",id + TASK_ID,_,_,"b") } // Save data (points) and remove task public client_disconnect(id) { remove_task(id + TASK_ID) SaveData(id) } // increasing points public Event_Death() { static Attacker , Victim , Headshot , wpn Attacker = read_data(1) Victim = read_data(2) Headshot = read_data(3) wpn = get_user_weapon(Attacker) if (Attacker == Victim) return PLUGIN_HANDLED if(Headshot && wpn != CSW_KNIFE) { Points[Attacker] += HEADSHOT_KILL } if (wpn == CSW_KNIFE && !Headshot) { Points[Attacker] += KNIFE_KILL } if (wpn == CSW_KNIFE && Headshot) { Points[Attacker] += KNIFE_HEADSHOT } if (!Headshot && wpn != CSW_KNIFE) { Points[Attacker] += NORMAL_KILL } return PLUGIN_CONTINUE } // give points to defuser public bomb_defused(id) { Points[id] += BOMB_DEFUSED } // give point to all terrorist's public on_TerroristWin() { new players[32], num get_players(players, num, "ceh" , "TERRORIST") for( --num; num >= 0; num-- ) { Points[players[num]] += TR_WIN } } // give point to all CT's public on_CTWin() { new players[32], num get_players(players, num, "ceh" , "CT") for( --num; num >= 0; num-- ) { Points[players[num]] += CT_WIN } } // show hud message public show_points(TASK) { new id = TASK - TASK_ID set_hudmessage(0 , 255 , 0 , HUD_POSITION_X , HUD_POSITION_Y , -1.0, 0.88, HOLD_TIME, 9.9, 1.0, HUD_CHANNEL) show_hudmessage(id , "Your Points : %i" , Points[id]) } // Saving Data to nVault file SaveData(id) { new vaultkey[64], vaultdata[256] formatex(vaultkey, charsmax(vaultkey), "%s-/", szAuthid[id]) formatex(vaultdata, charsmax(vaultdata), "%i#", Points[id]) nvault_set(g_save, vaultkey, vaultdata) } // Loading Data from nVault file LoadData(id) { new vaultkey[64], vaultdata[256] formatex(vaultkey, charsmax(vaultkey), "%s-/", szAuthid[id]) formatex(vaultdata, charsmax(vaultdata), "%i#", Points[id]) nvault_get(g_save, vaultkey, vaultdata, charsmax(vaultdata)) replace_all(vaultdata, charsmax(vaultdata), "#", " ") new get_points[MAX_PLAYERS] parse(vaultdata, get_points , charsmax(get_points)) Points[id] = str_to_num(get_points) } Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi