Raised This Month: $32 Target: $400
 8% 

Will this work? Set money on round end plugin


Post New Thread Reply   
 
Thread Tools Display Modes
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-27-2018 , 21:43   Re: Will this work? Set money on round end plugin
Reply With Quote #11

Why not use money event combined with Round_End event?

it will be much more efficient than simple set on a loop

Code:
#include <amxmodx>
#include <cstrike>

new g_LastWinner = 0;
new bool:g_AlreadySetMoney[33];

public plugin_init()
{
	register_plugin("Test","0.1","SmileY");
	
	register_event("SendAudio","MRAD_terwin","a","2=%!MRAD_terwin");
	register_event("SendAudio","MRAD_ctwin","a","2=%!MRAD_ctwin");
	register_event("SendAudio","MRAD_rounddraw","a","2=%!MRAD_rounddraw");
	
	register_message(get_user_msgid("Money"),"Money");
}

public MRAD_terwin()
{
	g_LastWinner = 1;
	arrayset(g_AlreadySetMoney,false,sizeof(g_AlreadySetMoney));
}

public MRAD_ctwin()
{
	g_LastWinner = 2;
	arrayset(g_AlreadySetMoney,false,sizeof(g_AlreadySetMoney));
}

public MRAD_rounddraw()
{
	g_LastWinner = 0;
}

public Money(Msg,Dest,id)
{
	if(g_LastWinner && !g_AlreadySetMoney[id])
	{
		if(!is_user_alive(id))
		{
			if(get_user_team(id) != g_LastWinner)
			{
				if(cs_get_user_money(id) < 800)
				{
					g_AlreadySetMoney[id] = true;
					cs_set_user_money(id,800,1);
					return PLUGIN_HANDLED;
				}
			}
		}
	}
	
	return PLUGIN_CONTINUE;
}
And i do not think it is really necessary to check loser team here, duo if player logically have minus than $800 that is because he lose some rounds
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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 16:47.


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