Пример #1
0
static cell AMX_NATIVE_CALL esf_get_playerclass(AMX *amx, cell *params) // esf_get_playerclass(index); = 1 arg
{
	// Get the player class
	// params[1] = index
	// ---------------------
	// If playerclass == 
	
	/*  ESF_CLASS_NONE = 0,
        ESF_CLASS_BUU = 1,
        ESF_CLASS_GOKU = 2,
        ESF_CLASS_GOHAN = 3,
        ESF_CLASS_KRILLIN = 4,
        ESF_CLASS_FRIEZA = 5,
        ESF_CLASS_PICCOLO = 6,
        ESF_CLASS_TRUNKS = 7,
        ESF_CLASS_VEGETA = 8,
        ESF_CLASS_CELL = 9
	*/

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
    edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
       
    return pPlayer->v.playerclass;
}
Пример #2
0
static cell AMX_NATIVE_CALL set_user_rendering(AMX *amx, cell *params) // set_user_rendering(index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16); = 7 arguments
{
	// Sets user rendering.
	// params[1] = index
	// params[2] = fx
	// params[3] = r
	// params[4] = g
	// params[5] = b
	// params[6] = render
	// params[7] = amount

	// Check index
	CHECK_PLAYER(params[1]);

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict(params[1]);

	pPlayer->v.renderfx = params[2];
	Vector newVector = Vector(float(params[3]), float(params[4]), float(params[5]));
	pPlayer->v.rendercolor = newVector;
	pPlayer->v.rendermode = params[6];
	pPlayer->v.renderamt = params[7];
	
	return 1;
}
Пример #3
0
static cell AMX_NATIVE_CALL csdm_respawn(AMX *amx, cell *params)
{
	int index = params[1];

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

	edict_t *pEdict = MF_GetPlayerEdict(index);

	if (FNullEnt(pEdict))
		return 0;

	int team = GetPlayerTeam(pEdict);
	if (team == TEAM_T || team == TEAM_CT)
	{
		RespawnPlayer(pEdict);
	} else {
		return 0;
	}

	return 1;
}
Пример #4
0
void CHamSpecialBotHandler::CheckClientKeyValue(int &clientIndex, char *infobuffer, const char *key, const char *value)
{
	if(m_specialbot_vtable != NULL)
		return;

	edict_t *pEdict = MF_GetPlayerEdict(clientIndex);
	if((pEdict->v.flags & FL_FAKECLIENT) != FL_FAKECLIENT)
	{
		const char *auth = GETPLAYERAUTHID(pEdict); 	 
		if (auth && (strcmp(auth, "BOT") != 0)) 	
			return;
	}

	if(strcmp(key, "*bot") != 0 || strcmp(value, "1") != 0)
		return;

	m_specialbot_vtable = GetVTable(pEdict->pvPrivateData, Offsets.GetBase());

	if(m_RHP_list.empty())
		return;

	for (size_t i = 0; i < m_RHP_list.length(); ++i)
	{
		CRegisterHamParams *item = m_RHP_list.at(i);
		RegisterChecked(item->amx, item->func, item->function, item->post, item->fwd);
		delete item;
	}

	m_RHP_list.clear();
}
Пример #5
0
//shamelessly pulled from fun
static cell AMX_NATIVE_CALL csdm_give_item(AMX *amx, cell *params) // native give_item(index, const item[]); = 2 params
{
	// Check index.
	if (params[1] < 1 || params[1] > gpGlobals->maxClients)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", params[1]);
		return 0;
	} else if (!MF_IsPlayerIngame(params[1])) {
		MF_LogError(amx, AMX_ERR_NATIVE, "Player %d is not in game", params[1]);
		return 0;
	}

	// Get player pointer.
	edict_t *pPlayer = MF_GetPlayerEdict(params[1]);

	// Create item entity pointer
	edict_t	*pItemEntity;

	// Make an "intstring" out of 2nd parameter
	int length;
	const char *szItem = MF_GetAmxString(amx, params[2], 1, &length);

	//check for valid item
	if (strncmp(szItem, "weapon_", 7) && 
		strncmp(szItem, "ammo_", 5) && 
		strncmp(szItem, "item_", 5) &&
		strncmp(szItem, "tf_weapon_", 10)
	) {
		return 0;
	}

	string_t item = ALLOC_STRING(szItem); // Using MAKE_STRING makes "item" contents get lost when we leave this scope! ALLOC_STRING seems to allocate properly...
	pItemEntity = CREATE_NAMED_ENTITY(item);

	if (FNullEnt(pItemEntity)) {
		MF_LogError(amx, AMX_ERR_NATIVE, "Item \"%s\" failed to create", szItem);
		return 0;
	}

	pItemEntity->v.origin = pPlayer->v.origin;
	pItemEntity->v.spawnflags |= (1 << 30);	//SF_NORESPAWN;

	MDLL_Spawn(pItemEntity);

	int save = pItemEntity->v.solid;

	MDLL_Touch(pItemEntity, ENT(pPlayer));

	if (pItemEntity->v.solid == save)
	{
		REMOVE_ENTITY(pItemEntity);
		//the function did not fail - we're just deleting the item
		return -1;
	}

	return ENTINDEX(pItemEntity);
}
Пример #6
0
static cell AMX_NATIVE_CALL esf_get_block(AMX *amx, cell *params) // esf_get_block(index); = 1 arg
{
	// Check if player is blocking an attack
	// params[1] = index

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
	   
	return *((int *)pPlayer->pvPrivateData + ESFX_BLOCK_OFFSET);
}  
Пример #7
0
static cell AMX_NATIVE_CALL esf_get_advancedmelee(AMX *amx, cell *params) // esf_get_advancedmelee(index); = 1 arg
{
	// Check if player is in advanced melee
	// params[1] = index

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
	   
	return *((int *)pPlayer->pvPrivateData + ESFX_ADVMELEE_OFFSET);
}  
Пример #8
0
static cell AMX_NATIVE_CALL esf_get_swooping(AMX *amx, cell *params) // esf_get_swooping(index); = 1 arg
{
	// Check if player is currently swoopin'
	// params[1] = index

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
	   
	return *((int *)pPlayer->pvPrivateData + ESFX_SWOOPING_OFFSET);
}    
Пример #9
0
static cell AMX_NATIVE_CALL esf_get_powerup(AMX *amx, cell *params) // esf_get_powerup(index); = 1 arg
{
	// Check if player is charging his power
	// params[1] = index

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
	   
	return *((int *)pPlayer->pvPrivateData + ESFX_POWERUP_OFFSET);
}    
Пример #10
0
static cell AMX_NATIVE_CALL esf_get_turbo(AMX *amx, cell *params) // esf_get_turbo(index); = 1 arg
{
	// Check if player has turbo on (T key);
	// params[1] = index

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
	   
	return *((int *)pPlayer->pvPrivateData + ESFX_TURBO_OFFSET);
}
Пример #11
0
static cell AMX_NATIVE_CALL esf_get_fly(AMX *amx, cell *params) // esf_get_fly(index); = 1 arg
{
	// Check is player is flying
	// params[1] = index

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
	   
	return *((int *)pPlayer->pvPrivateData + ESFX_FLY_OFFSET );
}
Пример #12
0
static cell AMX_NATIVE_CALL esf_get_swoopspeed(AMX *amx, cell *params) // esf_get_swoopspeed(index); = 1 arg
{
	// Get player swoopspeed
	// params[1] = index

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
    edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
       
    return pPlayer->v.fuser1;
}
Пример #13
0
static cell AMX_NATIVE_CALL esf_get_maxhealth(AMX *amx, cell *params) // esf_get_maxhealth(index); = 1 arg
{
	// Get player maxhealth
	// params[1] = index

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
	   
	return *((int *)pPlayer->pvPrivateData + ESFX_MAXHEALTH_OFFSET);
}
Пример #14
0
static cell AMX_NATIVE_CALL esf_get_wallground(AMX *amx, cell *params) // esf_get_wallground(index); =  1 arg
{
	// Client has been thrown into Wall / on Ground
	// params[1] = index

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
	   
	return *((int *)pPlayer->pvPrivateData + ESFX_WALLGND_OFFSET);
}
Пример #15
0
static cell AMX_NATIVE_CALL esf_get_user_deaths(AMX *amx, cell *params) // esf_get_user_deaths(index); = 1 arg
{
	// Return player deaths
	// params[1] =  index

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
	   
	return *((int *)pPlayer->pvPrivateData + ESFX_DEATHS_OFFSET); // offset by ConnorMcLeod
}
Пример #16
0
static cell AMX_NATIVE_CALL esf_get_beamjump(AMX *amx, cell *params) // esf_get_beamjump(index); = 1 arg
{
	// Get when a player performs a BeamJump
	// params[1] = index

	// Check index
	CHECK_PLAYER(params[ 1 ]);

	// Fetch player pointer
	edict_t* pPlayer = MF_GetPlayerEdict(params[ 1 ]);

	return pPlayer->v.movetype == 15;
}
Пример #17
0
static cell AMX_NATIVE_CALL get_user_gravity(AMX *amx, cell *params) // Float:get_user_gravity(index) = 1 argument
{
	// Gets user gravity.
	// params[1] = index

	// Check index
	CHECK_PLAYER(params[1]);

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict(params[1]);

	return amx_ftoc(pPlayer->v.gravity); 
}
Пример #18
0
static cell AMX_NATIVE_CALL esf_get_acpl(AMX *amx, cell *params) // esf_get_acpl(index); = 1 arg
{
	// Get user actual powerlevel
	// params[1] = index

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
	   
	return *((int *)pPlayer->pvPrivateData + ESFX_ACPL_OFFSET);
}
Пример #19
0
static cell AMX_NATIVE_CALL esf_get_freefall(AMX *amx, cell *params) // esf_get_freefall(index); = 1 arg
{
	// Client is in freefall like after jumping of ground
	// params[1] = index

	// Check index
	CHECK_PLAYER(params[ 1 ]);

	// Fetch player pointer
	edict_t* pPlayer = MF_GetPlayerEdict(params[ 1 ]);

	return *((int *)pPlayer->pvPrivateData + ESFX_FREEFALL_OFFSET);
}
Пример #20
0
static cell AMX_NATIVE_CALL esf_get_ki(AMX* amx, cell* params) // esf_get_ki(index); = 1 arg
{
	// Get player kinetik energy (KI)
	// params[1] = index

	// Check index
	CHECK_PLAYER(params[ 1 ]);

	// Fetch player pointer
	edict_t* pPlayer = MF_GetPlayerEdict(params[ 1 ]);
	   
	return pPlayer->v.fuser4;
}
Пример #21
0
static cell AMX_NATIVE_CALL esf_get_throw(AMX *amx, cell *params) // esf_get_throw(index); =  1 arg
{
	// Client is in Throw
	// params[1] = index

	// Check index
	CHECK_PLAYER(params[ 1 ]);

	// Fetch player pointer
	edict_t* pPlayer = MF_GetPlayerEdict(params[ 1 ]);

	return *((int *)pPlayer->pvPrivateData + ESFX_THROW_OFFSET);
}
Пример #22
0
static cell AMX_NATIVE_CALL get_user_noclip(AMX *amx, cell *params) // get_user_noclip(index); = 1 argument
{
	// Gets user noclip.
	// params[1] = index

	// Check index
	CHECK_PLAYER(params[1]);

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict(params[1]);

	return pPlayer->v.movetype == MOVETYPE_NOCLIP;
}
Пример #23
0
static cell AMX_NATIVE_CALL set_user_gravity(AMX *amx, cell *params) // set_user_gravity(index, Float:gravity = 1.0) = 2 arguments
{
	// Sets user gravity.
	// params[1] = index
	// params[2] = gravity (=-1.0)
	// Check index
	CHECK_PLAYER(params[1]);

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict(params[1]);

	pPlayer->v.gravity = amx_ctof(params[2]);

	return 1;
}
Пример #24
0
static cell AMX_NATIVE_CALL esf_set_swoopspeed(AMX *amx, cell *params) // esf_set_swoopspeed(index, sspeed); = 2 args
{
	// Set player swoop speed
	// params[1] = index
	// params[2] = swoop speed

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
    edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
       
    pPlayer->v.fuser1 = params[ 2 ];
       
    return 1;
}
Пример #25
0
static cell AMX_NATIVE_CALL esf_set_powerlevel(AMX *amx, cell *params) // esf_set_powerlevel(index, powerlevel); = 2 args
{
	// Sets user powerlevel
	// params[1] = index
	// params[2] = powerlevel

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
	edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
	   
	*((int *)pPlayer->pvPrivateData + ESFX_POWERLEVEL_OFFSET) = params[ 2 ];

	return 1;
}
Пример #26
0
static cell AMX_NATIVE_CALL esf_set_ki(AMX *amx, cell *params) // esf_set_ki(index, ki); = 2 args
{
	// Sets user ki
	// params[1] = index
	// params[2] = ki

	// Check index
	CHECK_PLAYER( params[ 1 ] );

	// Fetch player pointer
    edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
       
    pPlayer->v.fuser4 = params[ 2 ];

	return 1;
}
Пример #27
0
static cell AMX_NATIVE_CALL esf_set_hiddenpowerup(AMX *amx, cell *params) // esf_set_hiddenpowerup(index, hpwp); = 2 args
{
	// Set player hidden powerup
	// params[1] = index
	// params[2] = hidden power up

	// Check index
	CHECK_PLAYER(params[ 1 ]);

	// Fetch player pointer
	edict_t* pPlayer = MF_GetPlayerEdict(params[ 1 ]);

	*((int *)pPlayer->pvPrivateData + ESFX_HPOWERUP_OFFSET) = params[ 2 ];

	return 1;
}
Пример #28
0
static cell AMX_NATIVE_CALL esf_set_adpl(AMX *amx, cell *params) // esf_set_adpl(index, adpl); = 2 args
{
	// Set player ADPL
	// params[1] = index
	// params[2] = adpl

	// Check index
	CHECK_PLAYER(params[ 1 ]);

	// Fetch player pointer
	edict_t* pPlayer = MF_GetPlayerEdict(params[ 1 ]);

	*((int *)pPlayer->pvPrivateData + ESFX_ADPL_OFFSET) = params[ 2 ];

	return 1;
}
Пример #29
0
static cell AMX_NATIVE_CALL esf_reset_model(AMX *amx, cell *params) // esf_reset_model(index); = 1 arg
{
	// Reset player model!
	// params[1] = index

	// Check index
	CHECK_PLAYER(params[ 1 ]);

	// Fetch player pointer
	edict_t* pPlayer = MF_GetPlayerEdict(params[1]);

	// Remove that ugly model :)
	esfmodels[params[1]-1].bSet = false;

	return 1; 
}
Пример #30
0
static cell AMX_NATIVE_CALL esf_set_frags(AMX* amx, cell* params) // esf_set_frags(index, frags); = 2 args
{
	// Set player frags
	// params[1] = index
	// params[2] = frags

	// Check index
	CHECK_PLAYER(params[ 1 ]);

	// Fetch player pointer
	edict_t* pPlayer = MF_GetPlayerEdict(params[ 1 ]);
	   
	pPlayer->v.frags = params[ 2 ];
	   
	return 1;
}