added new functions
This commit is contained in:
@ -41,7 +41,6 @@ static cell AMX_NATIVE_CALL set_user_class(AMX *amx, cell *params){
|
||||
if ( !pPlayer->ingame )
|
||||
return 0;
|
||||
|
||||
|
||||
if (iClass){
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_CLASS) = iClass;
|
||||
*( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_RCLASS) = 0; // disable random class
|
||||
@ -439,34 +438,294 @@ static cell AMX_NATIVE_CALL get_user_ammo(AMX *amx, cell *params){
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL test_pd(AMX *amx, cell *params){
|
||||
static cell AMX_NATIVE_CALL objective_set_data(AMX *amx, cell *params){ // index, key, ivalue , szvalue
|
||||
int index = params[1];
|
||||
CHECK_PLAYER(index);
|
||||
int type = params[2];
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
if (pPlayer->ingame){
|
||||
int i;
|
||||
FILE *bp = fopen("pdtest.txt","at");
|
||||
for ( i=1;i<1000;i++ ){
|
||||
switch(type){
|
||||
case 0: fprintf(bp,"%d %d\n",i,*( (int*)pPlayer->pEdict->pvPrivateData + i));
|
||||
break;
|
||||
case 1: fprintf(bp,"%d %f\n",i,*( (float*)pPlayer->pEdict->pvPrivateData + i));
|
||||
break;
|
||||
case 2:
|
||||
fprintf(bp,"%d %c\n",i+1000,*( (char*)pPlayer->pEdict->pvPrivateData + i + 1000));
|
||||
break;
|
||||
//MF_PrintSrvConsole("",*( (int*)pPlayer->pEdict->pvPrivateData + i) );
|
||||
}
|
||||
}
|
||||
fclose(bp);
|
||||
if ( index < 0 || index > mObjects.count ){
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Index out of range (%d)", index);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
||||
edict_t *pent = mObjects.obj[index].pEdict;
|
||||
|
||||
int iLen;
|
||||
int ivalue = params[3];
|
||||
char *szValue = MF_GetAmxString(amx, params[4], 0, &iLen);
|
||||
|
||||
CP_VALUE key = (CP_VALUE)params[2];
|
||||
switch ( key ){
|
||||
case CP_owner :
|
||||
mObjects.UpdateOwner( index, ivalue );
|
||||
return 1;
|
||||
case CP_default_owner :
|
||||
mObjects.obj[index].default_owner = ivalue;
|
||||
GET_CP_PD(pent).default_owner = ivalue;
|
||||
return 1;
|
||||
case CP_visible :
|
||||
mObjects.obj[index].visible = ivalue;
|
||||
mObjects.obj[index].pEdict->v.spawnflags = 1 - ivalue;
|
||||
return 1;
|
||||
case CP_icon_neutral :
|
||||
mObjects.obj[index].icon_neutral = ivalue;
|
||||
GET_CP_PD(pent).icon_neutral = ivalue;
|
||||
return 1;
|
||||
case CP_icon_allies :
|
||||
mObjects.obj[index].icon_allies = ivalue;
|
||||
GET_CP_PD(pent).icon_allies = ivalue;
|
||||
return 1;
|
||||
case CP_icon_axis :
|
||||
mObjects.obj[index].icon_axis = ivalue;
|
||||
GET_CP_PD(pent).icon_axis = ivalue;
|
||||
return 1;
|
||||
case CP_origin_x :
|
||||
mObjects.obj[index].origin_x = (float)ivalue;
|
||||
// reinit
|
||||
return 1;
|
||||
case CP_origin_y :
|
||||
mObjects.obj[index].origin_y = (float)ivalue;
|
||||
// reinit
|
||||
return 1;
|
||||
case CP_can_touch :
|
||||
GET_CP_PD(pent).can_touch = ivalue;
|
||||
return 1;
|
||||
case CP_pointvalue :
|
||||
GET_CP_PD(pent).pointvalue = ivalue;
|
||||
return 1;
|
||||
|
||||
case CP_points_for_cap :
|
||||
GET_CP_PD(pent).points_for_player = ivalue;
|
||||
return 1;
|
||||
case CP_team_points :
|
||||
GET_CP_PD(pent).points_for_team = ivalue;
|
||||
return 1;
|
||||
|
||||
case CP_model_body_neutral :
|
||||
GET_CP_PD(pent).model_body_neutral = ivalue;
|
||||
return 1;
|
||||
case CP_model_body_allies :
|
||||
GET_CP_PD(pent).model_body_axis = ivalue;
|
||||
return 1;
|
||||
case CP_model_body_axis :
|
||||
GET_CP_PD(pent).model_body_axis = ivalue;
|
||||
return 1;
|
||||
|
||||
// Strings
|
||||
|
||||
case CP_name :
|
||||
mObjects.obj[index].pEdict->v.netname = MAKE_STRING(szValue);
|
||||
return 1;
|
||||
case CP_reset_capsound :
|
||||
mObjects.obj[index].pEdict->v.noise = MAKE_STRING(szValue);
|
||||
return 1;
|
||||
case CP_allies_capsound :
|
||||
mObjects.obj[index].pEdict->v.noise1 = MAKE_STRING(szValue);
|
||||
return 1;
|
||||
case CP_axis_capsound :
|
||||
mObjects.obj[index].pEdict->v.noise2 = MAKE_STRING(szValue);
|
||||
return 1;
|
||||
case CP_targetname :
|
||||
mObjects.obj[index].pEdict->v.targetname = MAKE_STRING(szValue);
|
||||
return 1;
|
||||
|
||||
case CP_model_neutral :
|
||||
strcpy(GET_CP_PD(pent).model_neutral,szValue);
|
||||
return 1;
|
||||
case CP_model_allies :
|
||||
strcpy(GET_CP_PD(pent).model_allies,szValue);
|
||||
return 1;
|
||||
case CP_model_axis :
|
||||
strcpy(GET_CP_PD(pent).model_axis,szValue);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL objective_get_data(AMX *amx, cell *params){ // flagid, key, ivalue szvalue[],len=0
|
||||
int index = params[1];
|
||||
if ( index < 0 || index > mObjects.count ){
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Index out of range (%d)", index);
|
||||
return 0;
|
||||
}
|
||||
int len = params[4];
|
||||
CP_VALUE key = (CP_VALUE)params[2];
|
||||
|
||||
switch ( key ){
|
||||
case CP_edict :
|
||||
return ENTINDEX(mObjects.obj[index].pEdict);
|
||||
case CP_area :
|
||||
GET_CAPTURE_AREA(index)
|
||||
return mObjects.obj[index].areaflags == 2 ? ENTINDEX(mObjects.obj[index].pAreaEdict) : 0;
|
||||
case CP_owner :
|
||||
return mObjects.obj[index].owner;
|
||||
case CP_default_owner :
|
||||
return mObjects.obj[index].default_owner;
|
||||
case CP_visible :
|
||||
return mObjects.obj[index].visible;
|
||||
case CP_icon_neutral :
|
||||
return mObjects.obj[index].icon_neutral;
|
||||
case CP_icon_allies :
|
||||
return mObjects.obj[index].icon_allies;
|
||||
case CP_icon_axis :
|
||||
return mObjects.obj[index].icon_axis;
|
||||
case CP_origin_x :
|
||||
return (int)mObjects.obj[index].origin_x;
|
||||
case CP_origin_y :
|
||||
return (int)mObjects.obj[index].origin_y;
|
||||
case CP_can_touch :
|
||||
return GET_CP_PD( mObjects.obj[index].pEdict ).can_touch;
|
||||
case CP_pointvalue :
|
||||
return GET_CP_PD( mObjects.obj[index].pEdict ).pointvalue;
|
||||
|
||||
case CP_points_for_cap :
|
||||
return GET_CP_PD( mObjects.obj[index].pEdict ).points_for_player;
|
||||
case CP_team_points :
|
||||
return GET_CP_PD( mObjects.obj[index].pEdict ).points_for_team;
|
||||
|
||||
case CP_model_body_neutral :
|
||||
return GET_CP_PD(mObjects.obj[index].pEdict).model_body_neutral;
|
||||
case CP_model_body_allies :
|
||||
return GET_CP_PD(mObjects.obj[index].pEdict).model_body_allies;
|
||||
case CP_model_body_axis :
|
||||
return GET_CP_PD(mObjects.obj[index].pEdict).model_body_axis;
|
||||
|
||||
// strings
|
||||
|
||||
case CP_name :
|
||||
if ( len ){
|
||||
MF_SetAmxString(amx,params[3],STRING(mObjects.obj[index].pEdict->v.netname),len);
|
||||
}
|
||||
return 1;
|
||||
case CP_reset_capsound :
|
||||
if ( len ){
|
||||
MF_SetAmxString(amx,params[3],STRING(mObjects.obj[index].pEdict->v.noise),len);
|
||||
}
|
||||
return 1;
|
||||
case CP_allies_capsound :
|
||||
if ( len ){
|
||||
MF_SetAmxString(amx,params[3],STRING(mObjects.obj[index].pEdict->v.noise1),len);
|
||||
}
|
||||
return 1;
|
||||
case CP_axis_capsound :
|
||||
if ( len ){
|
||||
MF_SetAmxString(amx,params[3],STRING(mObjects.obj[index].pEdict->v.noise2),len);
|
||||
}
|
||||
return 1;
|
||||
case CP_targetname :
|
||||
if ( len ){
|
||||
MF_SetAmxString(amx,params[3],STRING(mObjects.obj[index].pEdict->v.targetname),len);
|
||||
}
|
||||
return 1;
|
||||
case CP_model_neutral :
|
||||
if ( len ){
|
||||
MF_SetAmxString(amx,params[3],GET_CP_PD(mObjects.obj[index].pEdict).model_neutral,len);
|
||||
}
|
||||
return 1;
|
||||
case CP_model_allies :
|
||||
if ( len ){
|
||||
MF_SetAmxString(amx,params[3],GET_CP_PD(mObjects.obj[index].pEdict).model_allies,len);
|
||||
}
|
||||
return 1;
|
||||
case CP_model_axis :
|
||||
if ( len ){
|
||||
MF_SetAmxString(amx,params[3],GET_CP_PD(mObjects.obj[index].pEdict).model_axis,len);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL objectives_get_num(AMX *amx, cell *params){
|
||||
return mObjects.count;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL objectives_reinit(AMX *amx, cell *params){ // index
|
||||
int player = params[1];
|
||||
if ( player < 0 || player > gpGlobals->maxClients ){
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Index out of range (%d)", player);
|
||||
return 0;
|
||||
}
|
||||
mObjects.InitObj( player == 0 ? MSG_ALL:MSG_ONE, player == 0 ? NULL:INDEXENT(player) );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL area_get_data(AMX *amx, cell *params){ // flagid, key, ivalue szvalue[],len=0
|
||||
int index = params[1];
|
||||
if ( index < 0 || index > mObjects.count ){
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Index out of range (%d)", index);
|
||||
return 0;
|
||||
}
|
||||
int len = params[4];
|
||||
CA_VALUE key = (CA_VALUE)params[2];
|
||||
|
||||
GET_CAPTURE_AREA(index)
|
||||
|
||||
switch ( key ){
|
||||
case CA_edict :
|
||||
return ENTINDEX(mObjects.obj[index].pAreaEdict);
|
||||
case CA_allies_numcap :
|
||||
return GET_CA_PD( mObjects.obj[index].pAreaEdict ).allies_numcap;
|
||||
case CA_axis_numcap :
|
||||
return GET_CA_PD( mObjects.obj[index].pAreaEdict ).axis_numcap;
|
||||
case CA_timetocap :
|
||||
return GET_CA_PD( mObjects.obj[index].pAreaEdict ).time_to_cap;
|
||||
case CA_can_cap :
|
||||
return GET_CA_PD( mObjects.obj[index].pAreaEdict ).can_cap;
|
||||
|
||||
// strings
|
||||
case CA_target:
|
||||
if ( len ){
|
||||
MF_SetAmxString(amx,params[3],STRING(mObjects.obj[index].pAreaEdict->v.target),len);
|
||||
}
|
||||
return 1;
|
||||
case CA_sprite:
|
||||
if ( len ){
|
||||
MF_SetAmxString(amx,params[3],GET_CA_PD(mObjects.obj[index].pAreaEdict).hud_sprite,len);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL area_set_data(AMX *amx, cell *params){ // index, key, ivalue , szvalue
|
||||
int index = params[1];
|
||||
if ( index < 0 || index > mObjects.count ){
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Index out of range (%d)", index);
|
||||
return 0;
|
||||
}
|
||||
int iLen;
|
||||
int ivalue = params[3];
|
||||
char *szValue = MF_GetAmxString(amx, params[4], 0, &iLen);
|
||||
|
||||
CA_VALUE key = (CA_VALUE)params[2];
|
||||
|
||||
GET_CAPTURE_AREA(index)
|
||||
|
||||
switch ( key ){
|
||||
case CA_allies_numcap :
|
||||
GET_CA_PD( mObjects.obj[index].pAreaEdict ).allies_numcap = ivalue;
|
||||
return 1;
|
||||
case CA_axis_numcap :
|
||||
GET_CA_PD( mObjects.obj[index].pAreaEdict ).axis_numcap = ivalue;
|
||||
return 1;
|
||||
case CA_timetocap :
|
||||
GET_CA_PD( mObjects.obj[index].pAreaEdict ).time_to_cap = ivalue;
|
||||
return 1;
|
||||
case CA_can_cap :
|
||||
GET_CA_PD( mObjects.obj[index].pAreaEdict ).can_cap = ivalue;
|
||||
return 1;
|
||||
// strings
|
||||
case CA_target:
|
||||
mObjects.obj[index].pAreaEdict->v.target = MAKE_STRING(szValue);
|
||||
return 1;
|
||||
case CA_sprite:
|
||||
strcpy(GET_CA_PD( mObjects.obj[index].pAreaEdict ).hud_sprite,szValue);
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO pd_Natives[] = {
|
||||
|
||||
{ "dod_set_user_class", set_user_class },
|
||||
{ "dod_set_user_team", set_user_team },
|
||||
{ "dod_get_next_class", get_user_nextclass },
|
||||
@ -475,16 +734,21 @@ AMX_NATIVE_INFO pd_Natives[] = {
|
||||
{ "dod_set_pl_deaths", set_user_deaths },
|
||||
{ "dod_set_user_score", set_user_score },
|
||||
{ "dod_set_pl_teamname", set_user_teamname },
|
||||
{ "dod_get_pl_teamname", get_user_teamname },
|
||||
{ "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_get_user_ammo", get_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 },
|
||||
{ "objective_set_data", objective_set_data },
|
||||
{ "objective_get_data", objective_get_data },
|
||||
{ "objectives_get_num", objectives_get_num },
|
||||
{ "objectives_reinit", objectives_reinit },
|
||||
{ "area_set_data", area_set_data },
|
||||
{ "area_get_data", area_get_data },
|
||||
///*******************
|
||||
{ NULL, NULL }
|
||||
};
|
Reference in New Issue
Block a user