mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 05:45:36 +03:00
small changes in natives
This commit is contained in:
parent
06098e3bf1
commit
27f5e72afe
@ -336,6 +336,42 @@ static cell AMX_NATIVE_CALL is_custom(AMX *amx, cell *params){
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL dod_get_user_team(AMX *amx, cell *params){ // player,wid
|
||||
int index = params[2];
|
||||
if (index<1||index>gpGlobals->maxClients){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
return pPlayer->pEdict->v.team;
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params){ // player,wid
|
||||
int index = params[2];
|
||||
if (index<1||index>gpGlobals->maxClients){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
int iTeam = pPlayer->pEdict->v.team;
|
||||
if ( params[3] ){
|
||||
char *szTeam = "";
|
||||
switch(iTeam){
|
||||
case 1:
|
||||
szTeam = "Allies";
|
||||
break;
|
||||
case 2:
|
||||
szTeam = "Axis";
|
||||
break;
|
||||
}
|
||||
MF_SetAmxString(amx,params[2],szTeam,params[3]);
|
||||
}
|
||||
return iTeam;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO base_Natives[] = {
|
||||
|
||||
{ "dod_wpnlog_to_name", wpnlog_to_name },
|
||||
@ -364,6 +400,13 @@ AMX_NATIVE_INFO base_Natives[] = {
|
||||
{ "custom_weapon_dmg", cwpn_dmg },
|
||||
{ "custom_weapon_shot", cwpn_shot },
|
||||
|
||||
//****************************************
|
||||
|
||||
{ "get_user_team", get_user_team },
|
||||
{ "get_weaponname", get_weapon_name },
|
||||
{ "get_user_weapon", get_user_weapon },
|
||||
{ "dod_get_user_team", dod_get_user_team },
|
||||
|
||||
///*******************
|
||||
{ NULL, NULL }
|
||||
};
|
@ -454,6 +454,11 @@ AMX_NATIVE_INFO base_Natives[] = {
|
||||
{"tfc_setpddata", TFC_SetPDdata },
|
||||
|
||||
{"register_statsfwd",register_forward },
|
||||
|
||||
//*****************************************
|
||||
|
||||
{"get_weaponname", TFC_GetWpnName},
|
||||
|
||||
//******************* 19 :)
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
@ -84,7 +84,7 @@ static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params){
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params){
|
||||
static cell AMX_NATIVE_CALL ts_get_user_weapon(AMX *amx, cell *params){
|
||||
int id = params[1];
|
||||
if ( id<1 || id>gpGlobals->maxClients ){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
@ -106,6 +106,24 @@ static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params){
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params){
|
||||
int id = params[1];
|
||||
if ( id<1 || id>gpGlobals->maxClients ){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
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;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_user_cash(AMX *amx, cell *params){
|
||||
int id = params[1];
|
||||
if ( id<1 || id>gpGlobals->maxClients ){
|
||||
@ -402,7 +420,7 @@ AMX_NATIVE_INFO base_Natives[] = {
|
||||
{ "ts_wpnlogtoname", wpnlog_to_name },
|
||||
{ "ts_wpnlogtoid", wpnlog_to_id },
|
||||
|
||||
{ "ts_getuserwpn", get_user_weapon },
|
||||
{ "ts_getuserwpn", ts_get_user_weapon },
|
||||
{ "ts_getusercash", get_user_cash },
|
||||
{ "ts_getuserspace", get_user_space },
|
||||
{ "ts_getuserpwup",get_user_pwup },
|
||||
@ -419,6 +437,10 @@ AMX_NATIVE_INFO base_Natives[] = {
|
||||
|
||||
{ "register_statsfwd",register_forward },
|
||||
|
||||
//****************************************
|
||||
{ "get_weaponname", get_weapon_name },
|
||||
{ "get_user_weapon", get_user_weapon },
|
||||
|
||||
//"*******************"
|
||||
{ NULL, NULL }
|
||||
};
|
Loading…
Reference in New Issue
Block a user