mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 05:45:36 +03:00
added get/set_user_ammo natives
This commit is contained in:
parent
287720c4e4
commit
3439fac417
@ -54,6 +54,41 @@
|
||||
#define WON_PDOFFSET_SCORE 626 + LINUXOFFSET // score
|
||||
#define WON_PDOFFSET_TEAMNAME 1896 + LINUXOFFSET // team name
|
||||
|
||||
/* DoD weapons */
|
||||
enum {
|
||||
DODW_AMERKNIFE = 1,
|
||||
DODW_GERKNIFE,
|
||||
DODW_COLT,
|
||||
DODW_LUGER,
|
||||
DODW_GARAND,
|
||||
DODW_SCOPED_KAR,
|
||||
DODW_THOMPSON,
|
||||
DODW_STG44,
|
||||
DODW_SPRINGFIELD,
|
||||
DODW_KAR,
|
||||
DODW_BAR,
|
||||
DODW_MP40,
|
||||
DODW_HANDGRENADE,
|
||||
DODW_STICKGRENADE,
|
||||
DODW_STICKGRENADE_EX,
|
||||
DODW_HANDGRENADE_EX,
|
||||
DODW_MG42,
|
||||
DODW_30_CAL,
|
||||
DODW_SPADE,
|
||||
DODW_M1_CARBINE,
|
||||
DODW_MG34,
|
||||
DODW_GREASEGUN,
|
||||
DODW_FG42,
|
||||
DODW_K43,
|
||||
DODW_ENFIELD,
|
||||
DODW_STEN,
|
||||
DODW_BREN,
|
||||
DODW_WEBLEY,
|
||||
DODW_BAZOOKA,
|
||||
DODW_PANZERSCHRECK,
|
||||
DODW_PIAT,
|
||||
};
|
||||
|
||||
|
||||
// *****************************************************
|
||||
// class CPlayer
|
||||
|
@ -286,6 +286,204 @@ static cell AMX_NATIVE_CALL is_weapon_deployed(AMX *amx, cell *params){
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL set_user_ammo(AMX *amx, cell *params){
|
||||
int index = params[1];
|
||||
if (index<1||index>gpGlobals->maxClients){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
|
||||
if ( !pPlayer->ingame || !bSteam )
|
||||
return 0;
|
||||
|
||||
switch(params[2]){
|
||||
|
||||
//53,284,316
|
||||
case DODW_COLT:
|
||||
case DODW_LUGER:
|
||||
case DODW_WEBLEY:
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 53+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 284+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 316+LINUXOFFSET ) = params[3];
|
||||
break;
|
||||
|
||||
//54,283,315
|
||||
case DODW_GARAND:
|
||||
case DODW_KAR:
|
||||
case DODW_SCOPED_KAR:
|
||||
case DODW_ENFIELD:
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 56+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 281+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 313+LINUXOFFSET ) = params[3];
|
||||
break;
|
||||
|
||||
//57,286,318
|
||||
case DODW_STG44:
|
||||
case DODW_BAR:
|
||||
case DODW_FG42:
|
||||
case DODW_BREN:
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 56+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 281+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 313+LINUXOFFSET ) = params[3];
|
||||
break;
|
||||
|
||||
//56,281,313
|
||||
case DODW_THOMPSON:
|
||||
case DODW_GREASEGUN:
|
||||
case DODW_MP40:
|
||||
case DODW_STEN:
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 56+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 281+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 313+LINUXOFFSET ) = params[3];
|
||||
break;
|
||||
|
||||
//58,282,314
|
||||
case DODW_K43:
|
||||
case DODW_M1_CARBINE:
|
||||
case DODW_MG34:
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 58+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 282+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 314+LINUXOFFSET ) = params[3];
|
||||
break;
|
||||
|
||||
//55,285,317
|
||||
case DODW_SPRINGFIELD:
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 55+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 285+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 317+LINUXOFFSET ) = params[3];
|
||||
break;
|
||||
|
||||
//59,289,321
|
||||
case DODW_HANDGRENADE:
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 59+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 289+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 321+LINUXOFFSET ) = params[3];
|
||||
break;
|
||||
|
||||
//61,291,323
|
||||
case DODW_STICKGRENADE:
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 61+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 291+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 323+LINUXOFFSET ) = params[3];
|
||||
break;
|
||||
|
||||
//287,319
|
||||
case DODW_MG42:
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 287+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 319+LINUXOFFSET ) = params[3];
|
||||
break;
|
||||
|
||||
//288,320
|
||||
case DODW_30_CAL:
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 288+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 320+LINUXOFFSET ) = params[3];
|
||||
break;
|
||||
|
||||
//49,293,325
|
||||
case DODW_BAZOOKA:
|
||||
case DODW_PANZERSCHRECK:
|
||||
case DODW_PIAT:
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 49+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 293+LINUXOFFSET ) = params[3];
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + 325+LINUXOFFSET ) = params[3];
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL get_user_ammo(AMX *amx, cell *params){
|
||||
int index = params[1];
|
||||
if (index<1||index>gpGlobals->maxClients){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
|
||||
if ( !pPlayer->ingame || !bSteam )
|
||||
return 0;
|
||||
|
||||
switch(params[2]){
|
||||
|
||||
//53,284,316
|
||||
case DODW_COLT:
|
||||
case DODW_LUGER:
|
||||
case DODW_WEBLEY:
|
||||
return *( (int*)pPlayer->pEdict->pvPrivateData + 53+LINUXOFFSET );
|
||||
break;
|
||||
|
||||
//49,293,325
|
||||
case DODW_BAZOOKA:
|
||||
case DODW_PANZERSCHRECK:
|
||||
case DODW_PIAT:
|
||||
return *( (int*)pPlayer->pEdict->pvPrivateData + 49+LINUXOFFSET );
|
||||
break;
|
||||
|
||||
//54,283,315
|
||||
case DODW_GARAND:
|
||||
case DODW_KAR:
|
||||
case DODW_SCOPED_KAR:
|
||||
case DODW_ENFIELD:
|
||||
return *( (int*)pPlayer->pEdict->pvPrivateData + 56+LINUXOFFSET );
|
||||
break;
|
||||
|
||||
//55,285,317
|
||||
case DODW_SPRINGFIELD:
|
||||
return *( (int*)pPlayer->pEdict->pvPrivateData + 55+LINUXOFFSET );
|
||||
break;
|
||||
|
||||
//56,281,313
|
||||
case DODW_THOMPSON:
|
||||
case DODW_GREASEGUN:
|
||||
case DODW_MP40:
|
||||
case DODW_STEN:
|
||||
return *( (int*)pPlayer->pEdict->pvPrivateData + 56+LINUXOFFSET );
|
||||
break;
|
||||
|
||||
//57,286,318
|
||||
case DODW_STG44:
|
||||
case DODW_BAR:
|
||||
case DODW_FG42:
|
||||
case DODW_BREN:
|
||||
return *( (int*)pPlayer->pEdict->pvPrivateData + 57+LINUXOFFSET );
|
||||
break;
|
||||
|
||||
//58,282,314
|
||||
case DODW_K43:
|
||||
case DODW_M1_CARBINE:
|
||||
case DODW_MG34:
|
||||
return *( (int*)pPlayer->pEdict->pvPrivateData + 58+LINUXOFFSET );
|
||||
break;
|
||||
|
||||
//59,289,321
|
||||
case DODW_HANDGRENADE:
|
||||
return *( (int*)pPlayer->pEdict->pvPrivateData + 59+LINUXOFFSET );
|
||||
break;
|
||||
|
||||
//61,291,323
|
||||
case DODW_STICKGRENADE:
|
||||
return *( (int*)pPlayer->pEdict->pvPrivateData + 61+LINUXOFFSET );
|
||||
break;
|
||||
|
||||
//287,319
|
||||
case DODW_MG42:
|
||||
return *( (int*)pPlayer->pEdict->pvPrivateData + 287+LINUXOFFSET );
|
||||
break;
|
||||
|
||||
//288,320
|
||||
case DODW_30_CAL:
|
||||
return *( (int*)pPlayer->pEdict->pvPrivateData + 288+LINUXOFFSET );
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL test_pd(AMX *amx, cell *params){
|
||||
int index = params[1];
|
||||
if (index<1||index>gpGlobals->maxClients){
|
||||
@ -327,6 +525,9 @@ AMX_NATIVE_INFO pd_Natives[] = {
|
||||
{ "dod_get_pl_teamname", get_user_teamname },
|
||||
{ "dod_is_deployed", is_weapon_deployed },
|
||||
|
||||
{ "dod_get_user_ammo", get_user_ammo },
|
||||
{ "dod_set_user_ammo", set_user_ammo },
|
||||
|
||||
{ "dod_test_pd", test_pd },
|
||||
///*******************
|
||||
{ NULL, NULL }
|
||||
|
Loading…
Reference in New Issue
Block a user