View Single Post
evilmaniac
SourceMod Donor
Join Date: May 2012
Old 02-03-2016 , 18:06   Re: [L4D2] Points System (v1.7.7, 2016-02-02)
Reply With Quote #11

Quote:
Originally Posted by SELL View Post
when they change team, then Points are reset. using the instructions above code. but how to do so by using the command !takeover Points are not reset
Code:
HookEvent("player_team", Reset_Points); 
bool bTakeOver[MAXPLAYERS];

public Action Reset_Points(Handle hEvent, char[] sEventName, bool bDontBroadcast){
	int iClientIndex = GetClientOfUserId(GetEventInt(hEvent, "userid"));
	if(IsClientSurvivor(iClientIndex) || IsClientInfected(iClientIndex)){
		if(bTakeOver[iClientIndex] == true)
			bTakeOver[iClientIndex] = false;
		else
	   		PlayerData[iClientIndex][iPlayerPoints] = 0;
		return;
	}
	else{ // If player moved to spectator
		bTakeOver[iClientIndex] = true;
	}
}
Try this. People can still go around this by switching to spectator before moving to the other team; but if takeover works like I think it does, this should work for what you are trying to do.
__________________

Last edited by evilmaniac; 02-03-2016 at 18:09.
evilmaniac is offline