Example #1
0
// wid,att,vic,dmg,hp=0
static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params)
{ 
	int weapon = params[1];

	// only for custom weapons
	if(weapon < DODMAX_WEAPONS-DODMAX_CUSTOMWPNS)
	{ 
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid custom weapon id %d", weapon);
		return 0;
	}

	int att = params[2];
	CHECK_PLAYER(params[2]);

	int vic = params[3];
	CHECK_PLAYER(params[3]);
	
	int dmg = params[4];
	if(dmg<1)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid damage %d", dmg);
		return 0;
	}
	
	int aim = params[5];
	if(aim < 0 || aim > 7)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid aim %d", aim);
		return 0;
	}

	CPlayer* pAtt = GET_PLAYER_POINTER_I(att);
	CPlayer* pVic = GET_PLAYER_POINTER_I(vic);

	pVic->pEdict->v.dmg_inflictor = NULL;

	if(pAtt->index != pVic->index)
		pAtt->saveHit(pVic , weapon , dmg, aim);

	if(!pAtt) 
		pAtt = pVic;

	int TA = 0;

	if((pVic->pEdict->v.team == pAtt->pEdict->v.team) && (pVic != pAtt))
		TA = 1;

	MF_ExecuteForward(iFDamage,pAtt->index, pVic->index, dmg, weapon, aim, TA);

	if(pVic->IsAlive())
		return 1;

	pAtt->saveKill(pVic,weapon,( aim == 1 ) ? 1:0 ,TA);

	MF_ExecuteForward(iFDeath,pAtt->index, pVic->index, weapon, aim, TA);

	return 1;
}
Example #2
0
static cell AMX_NATIVE_CALL custom_wpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg,hp=0
	int weapon = params[1];
	if (  weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS ||  !weaponData[weapon].used ){ // only for custom weapons
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
		return 0;
	}

	int att = params[2];
	CHECK_PLAYERRANGE(att);

	int vic = params[3];
	CHECK_PLAYERRANGE(vic);
	
	int dmg = params[4];
	if ( dmg<1 ){
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid damage %d", dmg);
		return 0;
	}
	
	int aim = params[5];
	if ( aim < 0 || aim > 7 ){
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid aim %d", aim);
		return 0;
	}

	CPlayer* pAtt = GET_PLAYER_POINTER_I(att);
	CPlayer* pVic = GET_PLAYER_POINTER_I(vic);

	pVic->pEdict->v.dmg_inflictor = NULL;
	pAtt->saveHit( pVic , weapon , dmg, aim );

	if ( !pAtt ) pAtt = pVic;
	int TA = 0;
	if ( (pVic->teamId == pAtt->teamId) && ( pVic != pAtt) )
		TA = 1;
	MF_ExecuteForward( iFDamage, static_cast<cell>(pAtt->index),
		static_cast<cell>(pVic->index), static_cast<cell>(dmg), static_cast<cell>(weapon),
		static_cast<cell>(aim), static_cast<cell>(TA) );
	
	if ( pVic->IsAlive() )
		return 1;

	pAtt->saveKill(pVic,weapon,( aim == 1 ) ? 1:0 ,TA);
	MF_ExecuteForward( iFDeath, static_cast<cell>(pAtt->index), static_cast<cell>(pVic->index),
		static_cast<cell>(weapon), static_cast<cell>(aim), static_cast<cell>(TA) );

	return 1;
}
Example #3
0
static cell AMX_NATIVE_CALL menu_destroy(AMX *amx, cell *params)
{
	GETMENU_R(params[1]);

	if (pMenu->isDestroying)
	{
		return 0;	//prevent infinite recursion
	}

	pMenu->isDestroying = true;

	CPlayer *player;
	for (int i=1; i<=gpGlobals->maxClients; i++)
	{
		player = GET_PLAYER_POINTER_I(i);
		if (player->newmenu == pMenu->thisId)
		{
			pMenu->Close(player->index);
		}
	}
	g_NewMenus[params[1]] = NULL;
	delete pMenu;
	g_MenuFreeStack.push(params[1]);

	return 1;
}
Example #4
0
static cell AMX_NATIVE_CALL player_menu_info(AMX *amx, cell *params)
{
	if (params[1] < 1 || params[1] > gpGlobals->maxClients)
	{
		LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", params[1]);
		return 0;
	}

	CPlayer *player = GET_PLAYER_POINTER_I(params[1]);
	if (!player->ingame)
	{
		LogError(amx, AMX_ERR_NATIVE, "Player %d is not ingame", params[1]);
		return 0;
	}

	cell *m = get_amxaddr(amx, params[2]);
	cell *n = get_amxaddr(amx, params[3]);

	*m = player->menu;
	*n = player->newmenu;

	if (params[0] / sizeof(cell) == 4)
	{
		cell *addr = get_amxaddr(amx, params[4]);
		*addr = player->page;
	}

	if ( (*m != 0 && *m != -1) || (*n != -1))
	{
		return 1;
	}

	return 0;
}
Example #5
0
// player,wid
static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params)
{ 
	int index = params[1];
	CHECK_PLAYER(index);

	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	int iTeam = pPlayer->pEdict->v.team; 

	if ( params[3] )
	{ 
		const char *szTeam = ""; 
		switch(iTeam)
		{
		case 1: 
			szTeam = "Allies"; 
			break; 

		case 2: 
			szTeam = "Axis"; 
			break; 
		} 

		MF_SetAmxString(amx,params[2],szTeam,params[3]); 
	} 
	return iTeam; 
}
Example #6
0
bool Menu::Display(int player, page_t page)
{
	int keys = 0;
	const char *str = GetTextString(player, page, keys);

	if (!str)
		return false;

	static char buffer[2048];
	int len = ke::SafeSprintf(buffer, sizeof(buffer), "%s", str);

	CPlayer *pPlayer = GET_PLAYER_POINTER_I(player);

	pPlayer->keys = 0;
	pPlayer->menu = 0;

	UTIL_FakeClientCommand(pPlayer->pEdict, "menuselect", "10", 0);

	pPlayer->keys = keys;
	pPlayer->menu = menuId;
	pPlayer->newmenu = thisId;
	pPlayer->page = (int)page;

	UTIL_ShowMenu(pPlayer->pEdict, keys, -1, buffer, len);

	return true;
}
Example #7
0
/* We want to get just the weapon of whichever type that the player is on him */
static cell AMX_NATIVE_CALL dod_weapon_type(AMX *amx, cell *params) /* 2 params */
{
	int index = params[1];
	int type = params[2];

	CHECK_PLAYER(index);

	if(type < DODWT_PRIMARY || type > DODWT_OTHER)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon type id %d", type);
		return 0;
	}

	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);

	if(pPlayer->ingame)
	{
		int weaponsbit = pPlayer->pEdict->v.weapons & ~(1<<31); // don't count last element

		for(int x = 1; x < MAX_WEAPONS; ++x)
		{
			if((weaponsbit&(1<<x)) > 0)
			{
				if(weaponData[x].type == type)
					return x;
			}
		}
	}

	return 0;
}
Example #8
0
//Builds the menu string for a specific page (set title to 0 to not include title)
//page indices start at 0!
static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
{
	GETMENU(params[2]);
	
	int player = params[1];
	int page = params[3];
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(player);
	
	if (!CloseNewMenus(pPlayer))
	{
		LogError(amx, AMX_ERR_NATIVE, "Plugin called menu_display when item=MENU_EXIT");
		return 0;
	}

	int time = -1;
	if (params[0] / sizeof(cell) >= 4)
		time = params[4];

	if (time < 0)
		pPlayer->menuexpire = INFINITE;
	else
		pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);

	return pMenu->Display(player, page);
}
Example #9
0
static cell AMX_NATIVE_CALL reset_user_wstats(AMX *amx, cell *params) /* 6 param */
{
	int index = params[1];
	CHECK_PLAYER(index);
	GET_PLAYER_POINTER_I(index)->restartStats();
	return 1;
}
Example #10
0
static cell AMX_NATIVE_CALL get_user_stats(AMX *amx, cell *params) /* 3 param */
{
	int index = params[1];
	CHECK_PLAYERRANGE(index);
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if ( pPlayer->rank ){
		cell *cpStats = MF_GetAmxAddr(amx,params[2]);
		cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]);
		cpStats[0] = pPlayer->rank->kills;
		cpStats[1] = pPlayer->rank->deaths;
		cpStats[2] = pPlayer->rank->hs;
		cpStats[3] = pPlayer->rank->tks;
		cpStats[4] = pPlayer->rank->shots;
		cpStats[5] = pPlayer->rank->hits;
		cpStats[6] = pPlayer->rank->damage;

		cpStats[7] = pPlayer->rank->getPosition();

		for(int i = 1; i < 8; ++i)
			cpBodyHits[i] = pPlayer->rank->bodyHits[i];
		return pPlayer->rank->getPosition();
	}
	return 0;

}
Example #11
0
static cell AMX_NATIVE_CALL get_user_astats(AMX *amx, cell *params) /* 6 param */
{
	int index = params[1];
	CHECK_PLAYERRANGE(index);
	int attacker = params[2];
	CHECK_PLAYERRANGE(attacker);
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if (pPlayer->attackers[attacker].hits){
		cell *cpStats = MF_GetAmxAddr(amx,params[3]);
		cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
		CPlayer::PlayerWeapon* stats = &pPlayer->attackers[attacker];
		cpStats[0] = stats->kills;
		cpStats[1] = stats->deaths;
		cpStats[2] = stats->hs;
		cpStats[3] = stats->tks;
		cpStats[4] = stats->shots;
		cpStats[5] = stats->hits;
		cpStats[6] = stats->damage;
		for(int i = 1; i < 8; ++i)
			cpBodyHits[i] = stats->bodyHits[i];
		if (params[6] && attacker && stats->name )
			MF_SetAmxString(amx,params[5],stats->name,params[6]);
		return 1;
	}
	return 0;
}
Example #12
0
static cell AMX_NATIVE_CALL menu_cancel(AMX *amx, cell *params)
{
	int index = params[1];

	if (index < 1 || index > gpGlobals->maxClients)
	{
		LogError(amx, AMX_ERR_NATIVE, "Player %d is not valid", index);
		return 0;
	}

	CPlayer *player = GET_PLAYER_POINTER_I(index);
	if (!player->ingame)
	{
		LogError(amx, AMX_ERR_NATIVE, "Played %d is not in game", index);
		return 0;
	}

	int menu = player->newmenu;
	if (menu < 0 || menu >= (int)g_NewMenus.size() || !g_NewMenus[menu])
		return 0;

	Menu *pMenu = g_NewMenus[menu];

	player->newmenu = -1;
	player->menu = 0;
	executeForwards(pMenu->func, 
		static_cast<cell>(index),
		static_cast<cell>(pMenu->thisId),
		static_cast<cell>(MENU_EXIT));

	return 1;
}
Example #13
0
static cell AMX_NATIVE_CALL get_user_wstats(AMX *amx, cell *params) /* 4 param */
{
	int index = params[1];
	CHECK_PLAYERRANGE(index);
	int weapon = params[2];
	if (weapon<0||weapon>=MAX_WEAPONS+MAX_CWEAPONS){
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
		return 0;
	}
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if (pPlayer->weapons[weapon].shots){
		cell *cpStats = MF_GetAmxAddr(amx,params[3]);
		cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
		CPlayer::PlayerWeapon* stats = &pPlayer->weapons[weapon];
		cpStats[0] = stats->kills;
		cpStats[1] = stats->deaths;
		cpStats[2] = stats->hs;
		cpStats[3] = stats->tks;
		cpStats[4] = stats->shots;
		cpStats[5] = stats->hits;
		cpStats[6] = stats->damage;
		for(int i = 1; i < 8; ++i)
			cpBodyHits[i] = stats->bodyHits[i];
		return 1;
	}
	return 0;
}
Example #14
0
// player,wid
static cell AMX_NATIVE_CALL dod_get_user_team(AMX *amx, cell *params)
{ 
	int index = params[1];
	CHECK_PLAYER(index);

	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	return pPlayer->pEdict->v.team;

}
Example #15
0
const char *playerlang(const cell index)
{
	const char *pLangName = nullptr;

	if (index == LANG_PLAYER)
	{
		if (!amx_cl_langs)
		{
			amx_cl_langs = CVAR_GET_POINTER("amx_client_languages");
		}

		if (static_cast<int>(amx_cl_langs->value) == 0)
		{
			pLangName = amxmodx_language->string;
		}
		else
		{
			pLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(g_langMngr.GetDefLang())->pEdict, "lang");
		}
	}
	else if (index == LANG_SERVER)
	{
		pLangName = amxmodx_language->string;
	}
	else if (index >= 1 && index <= gpGlobals->maxClients)
	{
		if (!amx_cl_langs)
		{
			amx_cl_langs = CVAR_GET_POINTER("amx_client_languages");
		}

		if (static_cast<int>(amx_cl_langs->value) == 0)
		{
			pLangName = amxmodx_language->string;
		}
		else
		{
			pLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(index)->pEdict, "lang");
		}
	}

	return pLangName;
}
Example #16
0
static cell AMX_NATIVE_CALL get_user_score(AMX *amx, cell *params)
{
	int index = params[1];
	CHECK_PLAYER(index);
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);

	if (pPlayer->ingame)
		return (cell)pPlayer->savedScore;

	return -1;
}
Example #17
0
static cell AMX_NATIVE_CALL get_user_pronestate(AMX *amx, cell *params)
{
	int index = params[1];
	CHECK_PLAYER(index);
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);

	if (pPlayer->ingame)
			return pPlayer->pEdict->v.iuser3;

	return 0;
}
Example #18
0
static cell AMX_NATIVE_CALL dod_clear_model(AMX *amx, cell *params) // player
{
	int index = params[1];
	CHECK_PLAYER(index);

	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if(!pPlayer->ingame)
		return false;

	pPlayer->clearModel();

	return true;
}
Example #19
0
static cell AMX_NATIVE_CALL user_kill(AMX *amx, cell *params)
{
	int index = params[1];
	CHECK_PLAYER(index);
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);

	if(pPlayer->ingame && pPlayer->IsAlive())
	{
		pPlayer->killPlayer();
		return 1;
	}

	return 0;
}	
Example #20
0
static cell AMX_NATIVE_CALL custom_wpn_shot(AMX *amx, cell *params){ // player,wid
	int index = params[2];
	CHECK_PLAYERRANGE(index);

	int weapon = params[1];
	if (  weapon < MAX_WEAPONS  || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].used ){
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
		return 0;
	}

	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	pPlayer->saveShot(weapon);

	return 1;
}
Example #21
0
static cell AMX_NATIVE_CALL dod_set_body(AMX *amx, cell *params) // player,bodynumber
{
	int index = params[1];
	CHECK_PLAYER(index);

	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if(!pPlayer->ingame)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Player, Not on Server");
		return 0;
	}

	pPlayer->setBody(params[2]);

	return true;
}
Example #22
0
/* 
0 [Byte]	1	// Weapons Groupings
1 [Byte]	210	// Total Rounds Allowed
2 [Byte]	-1	// Undefined Not Used
3 [Byte]	-1	// Undefined Not Used
4 [Byte]	2	// Weapon Slot
5 [Byte]	0	// Bucket ( Position Under Weapon Slot )
6 [Short]	7	// Weapon Number / Bit Field for the weapon
7 [Byte]	128	// Bit Field for the Ammo or Ammo Type
8 [Byte]	30	// Rounds Per Mag

id, wpnID, slot, position, totalrds
*/
static cell AMX_NATIVE_CALL dod_weaponlist(AMX *amx, cell *params) // player
{
	if(!weaponlist[params[1]].changeable)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "This Weapon Cannot be Changed");
		return 0;
	}

	int id = params[1];
	int wpnID = params[2];
	int slot = params[3];
	int position = params[4];
	int totalrds = params[5];

	UTIL_LogPrintf("ID (%d) WpnID (%d) Slot (%d) Pos (%d) Rounds (%d)", id, wpnID, slot, position, totalrds);

	CHECK_PLAYER(id);

	CPlayer* pPlayer = GET_PLAYER_POINTER_I(id);
	if(!pPlayer->ingame)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Player, Not on Server");
		return 0;
	}
	
	MESSAGE_BEGIN(MSG_ONE, GET_USER_MSG_ID(PLID, "WeaponList", NULL), NULL, INDEXENT(id));
	WRITE_BYTE(weaponlist[wpnID].grp);
		WRITE_BYTE(totalrds);
		WRITE_BYTE(-1);
		WRITE_BYTE(-1);
		WRITE_BYTE(slot - 1);
		WRITE_BYTE(position);
		WRITE_SHORT(wpnID);
		WRITE_BYTE(weaponlist[wpnID].bitfield);

		// Is it grenades
		if(wpnID == 13 || wpnID == 14 || wpnID == 15 || wpnID == 16 || wpnID == 36)
			WRITE_BYTE(-1);
		else if(wpnID == 29 || wpnID == 30 || wpnID == 31)
			WRITE_BYTE(1);
		else
			WRITE_BYTE(weaponlist[wpnID].clip);
	MESSAGE_END();

	return 1;
}
Example #23
0
static cell AMX_NATIVE_CALL get_user_stats2(AMX *amx, cell *params) /* 3 param */
{
	int index = params[1];
	CHECK_PLAYERRANGE(index);
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if ( pPlayer->rank ){
		cell *cpStats = MF_GetAmxAddr(amx,params[2]);

		cpStats[0] = pPlayer->rank->bDefusions;
		cpStats[1] = pPlayer->rank->bDefused;
		cpStats[2] = pPlayer->rank->bPlants;
		cpStats[3] = pPlayer->rank->bExplosions;

		return pPlayer->rank->getPosition();
	}
	return 0;
}
Example #24
0
static cell AMX_NATIVE_CALL dod_set_model(AMX *amx, cell *params) // player,model
{
	int index = params[1];
	CHECK_PLAYER(index);

	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if(!pPlayer->ingame)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Player, Not on Server");
		return 0;
	}

	int length;
	pPlayer->initModel((char*)STRING(ALLOC_STRING(MF_GetAmxString(amx, params[2], 1, &length))));

	return true;
}
Example #25
0
static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params)
{
	int index = params[1];
	CHECK_PLAYER(index);
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);

	if (pPlayer->ingame)
	{
		int wpn = pPlayer->current;
		cell *cpTemp = MF_GetAmxAddr(amx,params[2]);
		*cpTemp = pPlayer->weapons[wpn].clip;
		cpTemp = MF_GetAmxAddr(amx,params[3]);
		*cpTemp = pPlayer->weapons[wpn].ammo;
		return wpn;
	}

	return 0;
}
Example #26
0
// player,wid
static cell AMX_NATIVE_CALL cwpn_shot(AMX *amx, cell *params)
{ 
	int index = params[2];

	CHECK_PLAYER(index);

	int weapon = params[1];
	if(weapon < DODMAX_WEAPONS-DODMAX_CUSTOMWPNS)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid custom weapon id %d", weapon);
		return 0;
	}

	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	pPlayer->saveShot(weapon);

	return 1;
}
Example #27
0
//Builds the menu string for a specific page (set title to 0 to not include title)
//page indices start at 0!
static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
{
	GETMENU(params[2]);
	
	int player = params[1];
	int page = params[3];
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(player);
	
	/* If the stupid handler keeps drawing menus, 
	 * We need to keep cancelling them.  But we put in a quick infinite loop
	 * counter to prevent this from going nuts.
	 */
	int menu;
	int loops = 0;
	while ((menu = pPlayer->newmenu) >= 0)
	{
		if ((size_t)menu >= g_NewMenus.size() || !g_NewMenus[menu])
		{
			break;
		}

		Menu *pOther = g_NewMenus[menu];

		pPlayer->newmenu = -1;
		pPlayer->menu = 0;
		executeForwards(pOther->func, 
			static_cast<cell>(player),
			static_cast<cell>(pOther->thisId),
			static_cast<cell>(MENU_EXIT));

		/* Infinite loop counter */
		if (++loops >= 10)
		{
			LogError(amx, AMX_ERR_NATIVE, "Plugin called menu_display when item=MENU_EXIT");
			return 0;
		}
	}

	// This will set the expire time of the menu to infinite
	pPlayer->menuexpire = INFINITE;

	return pMenu->Display(player, page);
}
Example #28
0
void Menu::Close(int player) 
{
	CPlayer *pPlayer = GET_PLAYER_POINTER_I(player);

	int status;
	if (gpGlobals->time > pPlayer->menuexpire)
		status = MENU_TIMEOUT;
	else
		status = MENU_EXIT;

	pPlayer->keys = 0;
	pPlayer->menu = 0;
	pPlayer->newmenu = -1;

	executeForwards(func,
		static_cast<cell>(player),
		static_cast<cell>(thisId),
		static_cast<cell>(status));
}
Example #29
0
static cell AMX_NATIVE_CALL get_user_rstats(AMX *amx, cell *params) /* 3 param */
{
	int index = params[1];
	CHECK_PLAYERRANGE(index);
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if (pPlayer->rank){
		cell *cpStats = MF_GetAmxAddr(amx,params[2]);
		cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]);
		cpStats[0] = pPlayer->life.kills;
		cpStats[1] = pPlayer->life.deaths;
		cpStats[2] = pPlayer->life.hs;
		cpStats[3] = pPlayer->life.tks;
		cpStats[4] = pPlayer->life.shots;
		cpStats[5] = pPlayer->life.hits;
		cpStats[6] = pPlayer->life.damage;
		for(int i = 1; i < 8; ++i)
			cpBodyHits[i] = pPlayer->life.bodyHits[i];
		return 1;
	}
	return 0;
}
Example #30
0
static cell AMX_NATIVE_CALL menu_cancel(AMX *amx, cell *params)
{
	int index = params[1];

	if (index < 1 || index > gpGlobals->maxClients)
	{
		LogError(amx, AMX_ERR_NATIVE, "Player %d is not valid", index);
		return 0;
	}

	CPlayer *player = GET_PLAYER_POINTER_I(index);
	if (!player->ingame)
	{
		LogError(amx, AMX_ERR_NATIVE, "Player %d is not in game", index);
		return 0;
	}

	if (Menu *pMenu = get_menu_by_id(player->newmenu)) {
		pMenu->Close(player->index);
		return 1;
	}

	return 0;
}