In popcorn i have a ability that will enable melee on everyone, taking all weapons except for melee, after the person who got the
ability dies, melee ends and everyone can go and pickup their weapons from resupply which is disabled during the melee session.
Everything seems to work until 5 minutes or so later weird things begin to happen. Players, namely the pyro, soldier, medic and spy,
begin losing their weapons until they are down to civilian. Im not sure if its just my code or the new update and could really use
some help with this, im stumped
and I was just on the way of solving our melee issue on the server where some players wanted to
play and some did not, arguments got started and gunfire
.
Heres the section of code for melee
PHP Code:
public Action:megapop(client)//g_runeActive set to 9
{
if (pop_megapopActive || pop_arenaMap)
{
uberpop(client);
return;
}
pop_megapopActive = true;
g_runeExtra[client] = 0;
g_runeActive[client] = 9;
meleemash(client);
}
public Action:meleemash(client)//megapop
{
pop_meleemash = true;
new String:name[32];
GetClientName(client, name, sizeof(name));
PrintCenterTextAll("%s has begun Melee Mash!", name);
PrintCenterText(client, "MegaPop: Melee Mash!");
runesound(client);
SetAlpha(client, 255);
SetEntityRenderMode(client, RENDER_NORMAL);
SetEntityRenderColor(client, 50, 255, 50, 255);
//function_DisableResupply(true);
for (new p = 1; p <= MaxClients; ++p)
{
new weaponIndex;
// Iterate through weapon slots
for ( new i = 0; i < 5; i++ )
{
// Do not remove melee weapon slot
if ( ( weaponIndex = GetPlayerWeaponSlot( p, i ) ) != -1 && i != 2 )
{
RemovePlayerItem( p, weaponIndex );
RemoveEdict( weaponIndex );
}
}
}
}
public Action:meleemashTime(Handle:timer, any:client)
{
new weaponIndex;
// Iterate through weapon slots
for ( new i = 0; i < 5; i++ )
{
// Do not remove melee weapon slot
if ( ( weaponIndex = GetPlayerWeaponSlot( client, i ) ) != -1 && i != 2 )
{
RemovePlayerItem( client, weaponIndex );
RemoveEdict( weaponIndex );
}
}
}
public PlayerDeathEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (IsClientInGame(client))
{
new runeType = g_runeActive[client];
switch (runeType)
{
case 9:
{
pop_megapopActive = false;
if (pop_meleemash)
{
pop_meleemash = false;
function_DisableResupply(false);
PrintCenterTextAll("Melee Mash is over, Resupplies are now Active.");
}
}
}
}
}
public PlayerSpawnEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client > 0)
{
SetEntityMoveType(client, MOVETYPE_WALK);
SetEntityGravity(client, 1.0);
DoColorize(client);
if (g_targetOnline[client] == 1)
{
SaveHealth(client);
if (g_runeActive[client] == 9)
{
pop_megapopActive = false;
pop_frankenstein[0] = 0;
}
g_runeActive[client] = 0;
g_runeExtra[client] = 0;
g_runeBox[client] = 0;
g_alreadykilled[client] = false;
g_targetTeam[client] = GetClientTeam(client);
if (pop_megapopActive)
{
if (pop_meleemash)
{
//CreateTimer(0.1, meleemashTime, client);
}
}
}
}
}
public PlayerDisconnectEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
if (pop_meleemash && g_runeActive[client] == 9)
{
pop_meleemash = false;
pop_megapopActive = false;
PrintCenterTextAll("Melee Mash is over, Resupplies are now Active.");
}
g_targetOnline[client] = 0;
g_runeActive[client] = 0;
g_runeExtra[client] = 0;
g_runeBox[client] = 0;
g_targetTeam[client] = 0;
}
And heres the full popcorn script -
popcorn.smx its activated with pop_test for now til it gets fixed.
__________________