DefenderMoney: add obus' fix back
so what he did was to restore your cash when you kill a zombie as human
This commit is contained in:
		
							parent
							
								
									42be4648d6
								
							
						
					
					
						commit
						31c4db3118
					
				| @ -211,9 +211,17 @@ public Action EventHook_PlayerHurt(Event hEvent, const char[] sEventName, bool b | ||||
| public Action EventHook_PlayerDeath(Event hEvent, const char[] sEventName, bool bDontBroadcast) | ||||
| { | ||||
| 	int client = GetClientOfUserId(hEvent.GetInt("userid")); | ||||
| 	int attacker = GetClientOfUserId(hEvent.GetInt("attacker")); | ||||
| 
 | ||||
| 	g_iCash[client] = GetEntProp(client, Prop_Send, "m_iAccount"); | ||||
| 
 | ||||
| 	if (!IsValidClient(attacker) || !ZR_IsClientHuman(attacker)) | ||||
| 		return Plugin_Continue; | ||||
| 
 | ||||
| 	int iPacked = (attacker<<16) | (GetEntProp(attacker, Prop_Send, "m_iAccount")&0xFFFF); | ||||
| 
 | ||||
| 	RequestFrame(RequestFrame_Callback2, iPacked); | ||||
| 
 | ||||
| 	return Plugin_Continue; | ||||
| } | ||||
| 
 | ||||
| @ -232,6 +240,14 @@ public void RequestFrame_Callback(int client) | ||||
| 		SetEntProp(client, Prop_Send, "m_iAccount", g_iCash[client]); | ||||
| } | ||||
| 
 | ||||
| public void RequestFrame_Callback2(int iPacked) | ||||
| { | ||||
| 	int iOldCash = iPacked&0xFFFF; | ||||
| 	int iAttacker = iPacked>>16; | ||||
| 
 | ||||
| 	SetEntProp(iAttacker, Prop_Send, "m_iAccount", iOldCash); | ||||
| } | ||||
| 
 | ||||
| stock bool IsValidClient(int client) | ||||
| { | ||||
| 	return (client > 0 && client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client)); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user