Hi Everyone,I Have a problem.
In CSGO or CS:S,When BOT died after C4 was installed.
There are always bots don't get notified thus doing nothing in the spawn zone.
Could anyone point me out how to do it?
Any help or suggestion are much appreciated!
English isn’t my first language, so please excuse any mistakes.
PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#include <cstrike>
float c4_position[3];
bool bomb_set_up;
Handle update_bomb = null;
public void OnPluginStart(){
HookEvent("round_start", round_start_event);
HookEvent("player_spawn", player_spawn_event);
HookEvent("bomb_planted", c4_bome_planted);
//CSGameState::UpdatePlantedBomb
//https://github.com/VSES/SourceEngine2007/blob/master/se2007/game/server/cstrike/bot/cs_gamestate.cpp
StartPrepSDKCall(SDKCall_Raw);
PrepSDKCall_SetVirtual(22484);
PrepSDKCall_SetSignature(SDKLibrary_Server,"\x55\x89\xE5\x56\x53\x83\xEC\x10\x8B\x75\x0C\xA1\x2A\x2A\x2A\x2A", 16);
//Linux Offsets and Signature
PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_Pointer);
update_bomb = EndPrepSDKCall();
if (update_bomb == null){
SetFailState("Unable to find the signature!");
PrintToServer("no signature");
}
}
public void round_start_event(Handle event, char[] name, bool dontBroadcast){
bomb_set_up = false;
}
public void player_spawn_event(Handle event, char[] name, bool dontBroadcast){
int userid = GetClientOfUserId(GetEventInt(event,"userid"));
if (bomb_set_up == true && IsClientInGame(userid) && IsPlayerAlive(userid) && GetClientTeam(userid) == 3){
SDKCall(update_bomb, c4_position);
//PrintToChatAll("");
}
}
public void c4_bome_planted(Handle event, char[] name, bool dontBroadcast){
bomb_set_up = true;
int ent=-1;
ent = FindEntityByClassname(ent, "planted_c4");
GetEntPropVector(ent, Prop_Send, "m_vecOrigin", c4_position);
}
PHP Code:
L 01/20/2020 - 23:23:11: [SM] Exception reported: Expected 3th parameter, found none
L 01/20/2020 - 23:23:11: [SM] Blaming: c4_say_pos.smx
L 01/20/2020 - 23:23:11: [SM] Call stack trace:
L 01/20/2020 - 23:23:11: [SM] [0] SDKCall
L 01/20/2020 - 23:23:11: [SM] [1] Line 39, c4_say_pos.sp::player_spawn_event
Thanks!