updated set_user_hitzones, added get_user_hitzones
This commit is contained in:
parent
1e69aaff18
commit
b505bdb7e8
@ -518,13 +518,19 @@ static cell AMX_NATIVE_CALL get_user_gravity(AMX *amx, cell *params) // Float:ge
|
||||
|
||||
static cell AMX_NATIVE_CALL set_user_hitzones(AMX *amx, cell *params) // set_user_hitzones(index = 0, target = 0, body = 255); = 3 arguments
|
||||
{
|
||||
// Gets user gravity.
|
||||
// Sets user hitzones.
|
||||
// params[1] = the one(s) who shoot(s), shooter
|
||||
int shooter = params[1];
|
||||
if (shooter == -1)
|
||||
shooter = 0;
|
||||
// params[2] = the one getting hit
|
||||
int gettingHit = params[2];
|
||||
if (gettingHit == -1)
|
||||
gettingHit = 0;
|
||||
// params[3] = specified hit zones
|
||||
int hitzones = params[3];
|
||||
if (hitzones == -1)
|
||||
hitzones = 255;
|
||||
|
||||
//set_user_hitzones(id, 0, 0) // Makes ID not able to shoot EVERYONE - id can shoot on 0 (all) at 0
|
||||
//set_user_hitzones(0, id, 0) // Makes EVERYONE not able to shoot ID - 0 (all) can shoot id at 0
|
||||
@ -554,6 +560,39 @@ static cell AMX_NATIVE_CALL set_user_hitzones(AMX *amx, cell *params) // set_use
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_user_hitzones(AMX *amx, cell *params) // get_user_hitzones(index, target); = 2 arguments
|
||||
{
|
||||
// Gets user hitzones.
|
||||
// params[1] = if this is not 0, return what zones this player can hit
|
||||
int shooter = params[1];
|
||||
// params[2] = if shooter was 0, and if this is a player, return what zones this player can get hit in, else... make runtime error?
|
||||
int gettingHit = params[2];
|
||||
|
||||
if (shooter) {
|
||||
if (FNullEnt(shooter)) {
|
||||
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return g_zones_toHit[shooter];
|
||||
}
|
||||
else {
|
||||
if (!gettingHit) {
|
||||
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if (FNullEnt(gettingHit)) {
|
||||
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return g_zones_getHit[gettingHit];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_user_noclip(AMX *amx, cell *params) // set_user_noclip(index, noclip = 0); = 2 arguments
|
||||
{
|
||||
// Sets user to no clipping mode.
|
||||
@ -661,7 +700,7 @@ AMX_NATIVE_INFO fun_Exports[] = {
|
||||
{"set_user_gravity", set_user_gravity},
|
||||
{"get_user_gravity", get_user_gravity},
|
||||
{"set_user_hitzones", set_user_hitzones},
|
||||
//{"get_hitzones", get_hitzones},
|
||||
{"get_user_hitzones", get_user_hitzones},
|
||||
{"set_user_noclip", set_user_noclip},
|
||||
{"get_user_noclip", get_user_noclip},
|
||||
{"set_user_footsteps", set_user_footsteps},
|
||||
|
@ -31,26 +31,29 @@ native set_user_origin(index, origin[3]);
|
||||
native set_user_rendering(index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16);
|
||||
|
||||
/* Gives item to player, name of item can start
|
||||
* with weapon_, ammo_ and item_. This event
|
||||
* is announced with proper message to all players. */
|
||||
* with weapon_, ammo_ and item_. This event
|
||||
* is announced with proper message to all players. */
|
||||
native give_item(index, const item[]);
|
||||
|
||||
/* (not yet implemented, don't know how to use native)
|
||||
* Sets hit zones for player. This event is announced
|
||||
* with proper message to all players.
|
||||
* Parts of body are as bits:
|
||||
* 2 - head
|
||||
* 4 - chest
|
||||
* 8 - stomach
|
||||
* 16 - left arm
|
||||
* 32 - right arm
|
||||
* 64 - left leg
|
||||
* 128 - right leg */
|
||||
//native set_hitzones(body = 255);
|
||||
/* Sets hit zones for player.
|
||||
* Parts of body are as bits:
|
||||
* 1 - generic
|
||||
* 2 - head
|
||||
* 4 - chest
|
||||
* 8 - stomach
|
||||
* 16 - left arm
|
||||
* 32 - right arm
|
||||
* 64 - left leg
|
||||
* 128 - right leg
|
||||
* Set index to a player's index and leave target at 0 to define what bodyparts this player can hit when he is firing.
|
||||
* Set index to 0 and target to a player's index to define what bodyparts on player other players can hit when they are firing. */
|
||||
* Set both index and target to 0 to define globally what bodyparts people can hit and what bodyparts can be hit when firing. */
|
||||
native set_user_hitzones(index = 0, target = 0, body = 255);
|
||||
|
||||
/* Get current hitzones. */
|
||||
//native get_hitzones();
|
||||
/* Get user hitzones.
|
||||
* To get what bodyparts a player can hit when firing, set the player's index to index and target to 0.
|
||||
* To get what bodyparts other players can hit when firing at player, set index to 0 and target to player's index. */
|
||||
native get_user_hitzones(index, target);
|
||||
|
||||
/* Sets users max. speed. */
|
||||
native set_user_maxspeed(index, Float:speed = -1.0);
|
||||
|
Loading…
Reference in New Issue
Block a user