added dod_set_user_kills

This commit is contained in:
Lukasz Wlasinksi 2004-09-21 21:25:30 +00:00
parent 0f38a24555
commit 5233be593f
3 changed files with 50 additions and 22 deletions

View File

@ -97,30 +97,10 @@ static cell AMX_NATIVE_CALL nade_set_fuse(AMX *amx, cell *params){ // id,(re)set
return 0; return 0;
} }
static cell AMX_NATIVE_CALL dod_get_wpninfo(AMX *amx, cell *params){ // id
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);
//weapon_data_t wdata;
//mm_DispatchThink(pPlayer->pEdict);
//mm_GetWeaponData(pPlayer->pEdict,&wdata);
//MF_PrintSrvConsole("%d \n",wdata.iuser1);
return 1;
}
AMX_NATIVE_INFO base_Natives[] = { AMX_NATIVE_INFO base_Natives[] = {
{ "dod_set_stamina", set_player_stamina }, { "dod_set_stamina", set_player_stamina },
{ "dod_set_fuse", nade_set_fuse }, { "dod_set_fuse", nade_set_fuse },
{ "dod_get_wpninfo", dod_get_wpninfo },
///******************* ///*******************
{ NULL, NULL } { NULL, NULL }
}; };

View File

@ -132,13 +132,13 @@ static cell AMX_NATIVE_CALL get_user_deaths(AMX *amx, cell *params){
int index = params[1]; int index = params[1];
if (index<1||index>gpGlobals->maxClients){ if (index<1||index>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE); MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0; return -1;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->ingame){ if (pPlayer->ingame){
return *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS ); return *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS );
} }
return 0; return -1;
} }
static cell AMX_NATIVE_CALL set_user_deaths(AMX *amx, cell *params){ static cell AMX_NATIVE_CALL set_user_deaths(AMX *amx, cell *params){
@ -190,6 +190,45 @@ static cell AMX_NATIVE_CALL set_user_score(AMX *amx, cell *params){
return 1; return 1;
} }
static cell AMX_NATIVE_CALL set_user_frags(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){
pPlayer->pEdict->v.frags = (float)params[2];
if ( params[3]){
//ScoreShort message
MESSAGE_BEGIN(MSG_ALL,gmsgScoreShort);
WRITE_BYTE(pPlayer->index);
WRITE_SHORT( *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_SCORE ) );
WRITE_SHORT((int)pPlayer->pEdict->v.frags);
WRITE_SHORT( *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS ) );
WRITE_BYTE(1);
MESSAGE_END();
}
}
return 1;
}
static cell AMX_NATIVE_CALL get_user_frags(AMX *amx, cell *params){
int index = params[1];
if (index<1||index>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return -1;
}
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->ingame)
return (int)pPlayer->pEdict->v.frags;
return -1;
}
static cell AMX_NATIVE_CALL set_user_teamname(AMX *amx, cell *params){ static cell AMX_NATIVE_CALL set_user_teamname(AMX *amx, cell *params){
int index = params[1]; int index = params[1];
if (index<1||index>gpGlobals->maxClients){ if (index<1||index>gpGlobals->maxClients){
@ -487,6 +526,9 @@ AMX_NATIVE_INFO pd_Natives[] = {
{ "dod_get_user_ammo", get_user_ammo }, { "dod_get_user_ammo", get_user_ammo },
{ "dod_set_user_ammo", set_user_ammo }, { "dod_set_user_ammo", set_user_ammo },
{ "dod_get_user_kills", get_user_frags },
{ "dod_set_user_kills", set_user_frags },
{ "dod_test_pd", test_pd }, { "dod_test_pd", test_pd },
///******************* ///*******************
{ NULL, NULL } { NULL, NULL }

View File

@ -41,6 +41,12 @@ native dod_get_pl_deaths(index);
/* Sets player deaths. */ /* Sets player deaths. */
native dod_set_pl_deaths(index,value,refresh=1); native dod_set_pl_deaths(index,value,refresh=1);
/* Returns player deaths. */
native dod_get_user_kills(index);
/* Sets player kills. */
native dod_set_user_kills(index,value,refresh=1);
/* Sets player score. */ /* Sets player score. */
native dod_set_user_score(index,value,refresh=1); native dod_set_user_score(index,value,refresh=1);