I have made a method for detecting if a player is touching a weapon/turret/bombsite. Basically in any situation where the "Press (F) to use" dialog shows up.
Use example:
PHP Code:
if ( player isUseTouching() ) ...
Install
Open gsc.cpp, CTRL + F and search for "resetNextReliableTime". Then add the following on a new line;
PHP Code:
{"isusetouching" , gsc_player_isusetouching , 0},
Open gsc_player.hpp, CTRL + F and search for "void gsc_player_resetNextReliableTime(int id);". Then add the following on a new line;
PHP Code:
void gsc_player_isusetouching(int id);
Open gsc_player.cpp, CTRL + F and search for "// entity functions". Then add the following on a new line;
PHP Code:
void gsc_player_isusetouching(int id) {
#if COD_VERSION == COD2_1_0
int info_use_offset = 0x0811F004;
#elif COD_VERSION == COD2_1_2
int info_use_offset = 0x08121338;
#elif COD_VERSION == COD2_1_3
int info_use_offset = 0x08121494;
#endif
int entity = gentities + id * gentities_size;
int base[2050];
int res = 0;
int (*isUseHover)(int a1, void *d);
*(int *)&isUseHover = info_use_offset;
res = isUseHover(entity, base);
stackPushInt(res);
}
Compile your version and you are done.