Also speaking of weapon functions - how about a proper isHoldingNade(); function?
Printable View
Also speaking of weapon functions - how about a proper isHoldingNade(); function?
Here are the addresses required to get setg_speed working on 1.0
Code://libcod.cpp
#if COD_VERSION == COD2_1_0
cracking_hook_call(0x080F50AB, (int)hook_player_g_speed);
#elif COD_VERSION == COD2_1_3
cracking_hook_call(0x080F7803, (int)hook_player_g_speed);
//gsc_player.cpp
#if COD_VERSION == COD2_1_0
calc_client_speed_t calc_client_speed = (calc_client_speed_t)0x0811FB7A;
#else
calc_client_speed_t calc_client_speed = (calc_client_speed_t)0x0812200A;
#endif
I added them last night and included 1.2. I was working on changing g_gravity per player :).
https://github.com/M-itch/libcod/com...dac4ef9608efb7
Edit: this should block melee and fire for x time (in ms).
PHP Code:
void gsc_player_setweaponfiremeleedelay(int id) {
int delay;
if ( ! stackGetParams("i", &delay)) {
printf("scriptengine> ERROR: gsc_player_setweaponfiremeleedelay(): param \"delay\"[1] has to be an int!\n");
stackPushUndefined();
return;
}
if(delay < 0) {
printf("scriptengine> ERROR: gsc_player_setweaponfiremeleedelay(): param \"delay\"[1] must be equal or above zero!\n");
stackPushUndefined();
return;
}
int* weapondelay = (int *)(PLAYERSTATE(id) + 0x34);
*weapondelay = delay;
}
It does work for me, but you first need to bash once and then melee is blocked. But I should be able to fix that.
PHP Code:
while(isAlive(self))
{
self setweaponfiremeleedelay(1000); // keep forcing 1s delay
if(self MeleeButtonPressed() && self UseButtonPressed())
{
break;
}
wait(0.05);
}
I fixed the first bash problem. In addition to blocking firing, it also blocks aiming and reloading your weapon and it delays switching your weapon.
https://github.com/M-itch/libcod/com...a4f6d86ac2ce74