Raised This Month: $ Target: $400
 0% 

[SOLVED] Bazooka for ctf mod


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Despardus
Junior Member
Join Date: Aug 2013
Old 08-06-2014 , 14:09   [SOLVED] Bazooka for ctf mod
Reply With Quote #1

I was modifying bazooka plugin for jctf mod. Everything is working fine. Just 1 bug.

Like when you have less money than bazooka cost you cant buy bazooka.. the same way when you have insufficient adrenaline(jctf feature) you shouldnt be able to buy it.

Bug : You can still buy the bazooka even if you have 0 adrenaline.

If you have 100 adrenaline and bazooka costs 75 adrenaline then 75 adrenaline is reduced and and changing players adrenaline to 25 but player can still buy another adrenaline.

What exactly do i need to change ?

PS : I'm newbie in this programming.


Code:
new iMoney = cs_get_user_money(id)
	new iCost = get_pcvar_num(cvar_bazooka_cost)
	new iAdre1 = jctf_get_adrenaline(id)
	new iAdre2 = get_pcvar_num(cvar_bazooka_adre)
	
	if(!is_user_alive(id)) 
		client_print(id, print_center, "You cant buy when your dead!")
		
	else if(Has_Bazooka[id])
		client_print(id, print_center, "You already own that weapon.")
		
	else if(iMoney < iCost)
		client_print(id, print_center, "Insufficient funds! ($%d)", iCost)
		
	else if(iAdre1 < iAdre2 ){
		client_print(id, print_center, "Insufficient Adrenaline ! ($%d)",iAdre2)
		}
	else { 
		
		give_item(id, "weapon_c4")
		
		Has_Bazooka[id] = true
		Allow_Shooting[id] = true
		
		Bazooka_Ammo1[id] = get_pcvar_num(cvar_bazooka_ammo1)
		Bazooka_Ammo2[id] = get_pcvar_num(cvar_bazooka_ammo2)
		Bazooka_Ammo3[id] = get_pcvar_num(cvar_bazooka_ammo3)
		
		jctf_add_adrenaline(id ,get_pcvar_num(cvar_bazooka_adre))
		
		client_print(id, print_chat," Adrenaline reduced !!")
		
		cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_bazooka_cost))
		
		client_print(id, print_chat, "[Bazooka] You have successfully bought a bazooka!")
		client_print(id, print_chat, "[Bazooka] What are you going to do now!?")
	
		new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1])
			
		if(weaponID == CSW_C4) {
				
			Bazooka_Active[id] = true
			Event_CurWeapon(id)	
			entity_set_int(id, EV_INT_weaponanim, SEQ_FIDGET)
				
		}
		
		else {
			
			Bazooka_Active[id] = true
			client_cmd(id, "weapon_c4")
			
		}

Edit : Bug resolved
It was a cvar problem -.-

Last edited by Despardus; 08-07-2014 at 03:37. Reason: Bug resolved Solved
Despardus is offline
Awesome_man
Senior Member
Join Date: May 2014
Location: singapore
Old 08-08-2014 , 11:26   Re: [SOLVED] Bazooka for ctf mod
Reply With Quote #2

Can someone give me bazooka plugin for ctf mod ?
Awesome_man is offline
Reply



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 13:13.


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