mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-07 16:43:21 +00:00
epi: Possibly fix crash
This commit is contained in:
parent
a3a85ee5b5
commit
b88976a38d
2 changed files with 13 additions and 8 deletions
Binary file not shown.
|
@ -188,7 +188,8 @@ public Action Event_PlayerFirstSpawn(Event event, const char[] name, bool dontBr
|
||||||
|
|
||||||
public void Frame_GiveNewClientKit(int client) {
|
public void Frame_GiveNewClientKit(int client) {
|
||||||
if(!DoesClientHaveKit(client) && GetRealSurvivorsCount() > 4) {
|
if(!DoesClientHaveKit(client) && GetRealSurvivorsCount() > 4) {
|
||||||
GivePlayerItem(client, "weapon_first_aid_kit");
|
int item = GivePlayerItem(client, "weapon_first_aid_kit");
|
||||||
|
EquipPlayerWeapon(client, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Action Timer_GiveClientKit(Handle hdl, int user) {
|
public Action Timer_GiveClientKit(Handle hdl, int user) {
|
||||||
|
@ -354,11 +355,13 @@ public Action Event_Pickup(int client, int weapon) {
|
||||||
char name[32];
|
char name[32];
|
||||||
GetEntityClassname(weapon, name, sizeof(name));
|
GetEntityClassname(weapon, name, sizeof(name));
|
||||||
if(StrEqual(name, "weapon_first_aid_kit", true)) {
|
if(StrEqual(name, "weapon_first_aid_kit", true)) {
|
||||||
if(isBeingGivenKit[client]) {
|
if(isBeingGivenKit[client]) return Plugin_Continue;
|
||||||
isBeingGivenKit[client] = false;
|
if(UseExtraKit(client)) {
|
||||||
}else if(UseExtraKit(client)) {
|
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}
|
}
|
||||||
|
/*else i*/
|
||||||
|
//FIXME: For some fucking reason this shit crashes server in end saferoom now.
|
||||||
|
//Literally, it should be impossible for it to do a stack crash, as this should have a LIMITED AMOUNT!!
|
||||||
}
|
}
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
@ -434,8 +437,8 @@ public void PopulateItems() {
|
||||||
if(survivors <= 4) return;
|
if(survivors <= 4) return;
|
||||||
|
|
||||||
float percentage = hExtraItemBasePercentage.FloatValue * survivors;
|
float percentage = hExtraItemBasePercentage.FloatValue * survivors;
|
||||||
PrintToServer("Populating extra items based on player count (%d) | Percentage %f%%", survivors, percentage * 100);
|
PrintToServer("Populating extra items based on player count (%d) | Percentage %.2f%%", survivors, percentage * 100);
|
||||||
PrintToConsoleAll("Populating extra items based on player count (%d) | Percentage %f%%", survivors, percentage * 100);
|
PrintToConsoleAll("Populating extra items based on player count (%d) | Percentage %.2f%%", survivors, percentage * 100);
|
||||||
char classname[32];
|
char classname[32];
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
for(int i = MaxClients + 1; i < 2048; i++) {
|
for(int i = MaxClients + 1; i < 2048; i++) {
|
||||||
|
@ -496,7 +499,8 @@ stock void GiveStartingKits() {
|
||||||
--skipLeft;
|
--skipLeft;
|
||||||
continue;
|
continue;
|
||||||
}else{
|
}else{
|
||||||
GivePlayerItem(i, "weapon_first_aid_kit");
|
int item = GivePlayerItem(i, "weapon_first_aid_kit");
|
||||||
|
EquipPlayerWeapon(i, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -541,12 +545,13 @@ stock bool DoesClientHaveKit(int client) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
//TODO: fix bs
|
||||||
stock bool UseExtraKit(int client) {
|
stock bool UseExtraKit(int client) {
|
||||||
if(extraKitsAmount > 0) {
|
if(extraKitsAmount > 0) {
|
||||||
isBeingGivenKit[client] = true;
|
isBeingGivenKit[client] = true;
|
||||||
int ent = GivePlayerItem(client, "weapon_first_aid_kit");
|
int ent = GivePlayerItem(client, "weapon_first_aid_kit");
|
||||||
EquipPlayerWeapon(client, ent);
|
EquipPlayerWeapon(client, ent);
|
||||||
|
isBeingGivenKit[client] = false;
|
||||||
PrintDebug("Used extra kit #%d - ent %d", extraKitsAmount, ent);
|
PrintDebug("Used extra kit #%d - ent %d", extraKitsAmount, ent);
|
||||||
if(--extraKitsAmount <= 0) {
|
if(--extraKitsAmount <= 0) {
|
||||||
extraKitsAmount = 0;
|
extraKitsAmount = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue