All pastes #931846 Raw Edit

Simon

public cpp v1 · immutable
·published 2008-03-07 11:32 UTC
rendered paste body
#define	loopPlayers(%1)\		for(new %1=g_iLastJoinedPlayerID; %1!=INVALID_PLAYER_ID; %1=pData[%1][P_LIST_PREVIOUS_ID])public OnPlayerConnect( playerid ){	// Code to make loopPlayers work correctly, this will	// update the variables so you don't have to loop through	// all playerid's to check if they're connected.	pData[ playerid ][ P_LIST_PREVIOUS_ID ] = g_iLastJoinedPlayerID;	if ( g_iLastJoinedPlayerID != INVALID_PLAYER_ID )		pData[ g_iLastJoinedPlayerID ][ P_LIST_NEXT_ID ] = playerid;	g_iLastJoinedPlayerID = playerid;	// loopPlayers code end}public OnPlayerDisconnect( playerid, reason ){	// loopPlayers macro code start	if ( g_iLastJoinedPlayerID == playerid )	    g_iLastJoinedPlayerID = pData[ playerid ][ P_LIST_PREVIOUS_ID ];	else if ( pData[ playerid ][ P_LIST_NEXT_ID ] != INVALID_PLAYER_ID )		pData[ pData[ playerid ][ P_LIST_NEXT_ID ] ][ P_LIST_PREVIOUS_ID ] = pData[ playerid ][ P_LIST_PREVIOUS_ID ];	// loopPlayers macro code end}