Raised This Month: $ Target: $400
 0% 

HP Modification Issue: Need Help! KNIFE PLUGIN


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
vres
Junior Member
Join Date: Dec 2023
Location: Turkey
Old 12-11-2023 , 17:35   HP Modification Issue: Need Help! KNIFE PLUGIN
Reply With Quote #1

Hello everyone, I created this plugin to allow playing with different HP values on knife servers without the need to change the map. However, it has a flaw: when an admin types /35hp, 1hp, or acer, only their HP changes, and others remain unaffected.
Note: This is my first plugin.

Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fun>

new mod35hp, mod1hp;

public plugin_init() {
	RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
	
	register_clcmd("say /35hp", "cmd35hp");
	register_clcmd("say /1hp", "cmd1hp");
	register_clcmd("say /acer", "cmdacer");
	set_task(1.0, "hudgoster", _, _, _, "b");
}


public cmd35hp(id){
	if (!is_user_connected(id) || !is_user_admin(id)) {
		return PLUGIN_HANDLED;
	}
	mod1hp = 0
	mod35hp = 1
	hpver();
	
	return PLUGIN_HANDLED;
}

public cmd1hp(id){
	if (!is_user_connected(id) || !is_user_admin(id)) {
		return PLUGIN_HANDLED;
	}
	mod35hp = 0
	mod1hp = 1
	hpver();

	return PLUGIN_HANDLED;
}

public cmdacer(id){
	if (!is_user_connected(id) || !is_user_admin(id)) {
		return PLUGIN_HANDLED;
	}
	mod1hp = 0
	mod35hp = 0
	hpver();

	return PLUGIN_HANDLED;
}

public fwHamPlayerSpawnPost(iPlayer) {
	if (is_user_alive(iPlayer)) {
		if(mod1hp == 1 && mod35hp == 0){
			set_user_health(iPlayer, 1)
			client_print(0, print_chat, "1hp mod active");
		}else if(mod1hp == 0 && mod35hp == 1){
			set_user_health(iPlayer, 35)
			client_print(0, print_chat, "35hp mod active");
			
		}
	}
} 

public hudgoster(){
	set_hudmessage(200, 100, 0, -0.98, -0.73, .effects= 1 , .holdtime= 0.8)
	
	if(mod1hp==1){
		
		show_hudmessage(0, "1HP mode active")	
	}else if(mod35hp==1){
		
		show_hudmessage(0, "35HP mode active")
	}else{
		return PLUGIN_HANDLED;
	}
	return PLUGIN_HANDLED;
}

public hpver(){
	
	for (new i = 1; i <= get_maxplayers(); i++)
	{
		if (is_user_connected(i) && is_user_alive(i) && mod1hp == 1){
			set_user_health(i, 1)
		}else if(is_user_connected(i) && is_user_alive(i) && mod35hp == 1){
			set_user_health(i, 35)
		}else{
			set_user_health(i, 100)
			
		}
			
	}
	return PLUGIN_HANDLED;
}
vres 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 00:32.


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