Raised This Month: $32 Target: $400
 8% 

[CS:S] One Man Army issues


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
InstantDeath
Senior Member
Join Date: Mar 2007
Old 06-19-2017 , 23:55   [CS:S] One Man Army issues
Reply With Quote #1

So, I would like to dedicate this thread to issues related to the CS:S One Man Army and to specific coding questions or problems I run into, as I seem to run into a fair amount when I work on this project.

If you need to look at the whole plugin, I won't be posting the entire plugin here as 4000+ lines would be way too much. the latest version can be grabbed here.


Now, my current and long standing issue is grenades. A staple feature of this mod/plugin is that CTs can go invisible. Now that feature works, however, CS:S apparently uses a dummy model for the grenades that are placed on the character model's belt. So when the player goes invisible, you essentially see a floating grenade. I have used the code below to fix the gun/knife model from showing, but I cannot figure out how to get the id for the dummy model so it will fade as well.

I have also included the helper function: GetGrenadeID

PHP Code:
stock GetGrenadeID(clientStringgrenade[])
{
    new 
MyWeapons FindSendPropInfo("CBasePlayer""m_hMyWeapons");
    if(
MyWeapons == -1)
        return -
1;
    
    
decl String:weapon[64];
    for(new 
0ent188+= 4)
    {
        
ent GetEntDataEnt2(clientMyWeapons i);
        
        if(
IsValidEntity(ent))
        {
            if(
IsValidEdict(ent))
            {
                
GetEdictClassname(entweaponsizeof(weapon));
                if(
StrEqual(weapongrenadefalse))
                    return 
ent;
            }
        }
    }
    return -
1;
}

/*
OnPlayerRunCmd will hook and detect player's +commands.
I have it set up so that this function will cloak the player
when they are pressing the crouch or walk key.
The weapon detection is for cloaking nades.
*/
public Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    new 
boolomaenable GetConVarBool(cvarpluginstatus);
    if(!
omaenable)
        return 
Plugin_Continue;
    if(!
IsClientInGame(client))
        return 
Plugin_Continue;
    if(
FreezeTime)
        return 
Plugin_Continue;
    
    if(
IsPlayerAlive(client) && GetClientTeam(client) == TEAM_CT)
    {
        new 
weaponid GetPlayerWeaponSlot(client2);
        new 
henadesgnade;
        
        if(
PlayerSkills[client][2] >= 1
            
henade GetGrenadeID(client"weapon_hegrenade");
        else
            
henade = -1;
        
        if(
PlayerSkills[client][3] >= 1)
            
sgnade GetGrenadeID(client"weapon_smokegrenade");
        else
        
sgnade = -1;
        
        
        
//PrintToChat(client, "[SM] CheckCloak is called.");
        
if(buttons IN_ATTACK || buttons IN_ATTACK2)
        {
            if(
PlayerCanCloak[client])
            {
                
SetEntityRenderFx(clientRENDERFX_NONE);
                
PlayerSpeed[client] = 1.0;
                
SetSpeed(clientPlayerSpeed[client]);
                if(
weaponid != -1)
                    
SetEntityRenderFx(weaponidRENDERFX_NONE);
                if(
henade != -1)
                {
                    
SetEntityRenderFx(henadeRENDERFX_NONE);
                    
SetAlpha(henade255);
                }
                if(
sgnade != -1)
                {
                    
SetAlpha(sgnade255);
                    
SetEntityRenderFx(sgnadeRENDERFX_NONE);
                }
                
                
PlayerCanCloak[client] = false;
                
CreateTimer(1.0,CloakChargeclient,TIMER_FLAG_NO_MAPCHANGE);
                
//PrintToChat(client, "[SM] Player Attacked. Rendering reset");
            
}
            
            if(
PlayerSkills[client][2] >= 1)
            {
                new 
count GetClientGrenades(clientSlot_HEgrenade);
                if(!
NadeRegenActive[client] && count PlayerSkills[client][2])
                    
CreateTimer(FloatDiv(15.0float(PlayerSkills[client][2])),HEnadeRegenclient,TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
            }
            
            else if(
PlayerSkills[client][3] >= 1)
            {
                new 
count GetClientGrenades(clientSlot_Smokegrenade);
                if(!
SNadeRegenActive[client] && count PlayerSkills[client][3])
                    
CreateTimer(FloatDiv(15.0float(PlayerSkills[client][3])),SmokenadeRegenclient,TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
            }
        }
        else if(
buttons IN_DUCK && !(GetEntityRenderFx(client) & RENDERFX_FADE_SLOW))
        {
            if(
PlayerCanCloak[client])
            {
                if(
buttons IN_JUMP && LongJump[client])
                {
                    new 
Float:vec[3];
                    if(
PlayerSkills[client][8] > && PlayerCanCloak[client])
                    {    
                        
PlayerSpeed[client] = 1.0;
                        
SetSpeed(clientPlayerSpeed[client]);
                        
vec[0]= GetEntDataFloat(clientVelocityOffset_x) * ((PlayerSkills[client][8] * 0.5) + 1.0) / 2.0;
                        
vec[1]= GetEntDataFloat(clientVelocityOffset_y) * ((PlayerSkills[client][8] * 0.5) + 1.0) / 2.0;
                        
vec[2]= 1.0 50.0;
                        
SetEntDataVector(clientBaseVelocityOffsetvectrue);
                        
                        
PlayerCanCloak[client] = false;
                        
LongJump[client] = false;
                        
SetEntityRenderFx(clientRENDERFX_NONE);
                        
SetSpeed(clientPlayerSpeed[client]);
                        if(
weaponid != -1)
                            
SetEntityRenderFx(weaponidRENDERFX_NONE);
                        if(
henade != -1)
                        {
                            
SetAlpha(henade255);
                            
SetEntityRenderFx(henadeRENDERFX_NONE);
                        }
                        if(
sgnade != -1)
                        {
                            
SetAlpha(sgnade255);
                            
SetEntityRenderFx(sgnadeRENDERFX_NONE);
                        }
                        
                        
//PrintToChat(client, "[SM] Player Has used long jump.");
                        
CreateTimer(1.5,JumpChargeclient,TIMER_FLAG_NO_MAPCHANGE);
                        
CreateTimer(1.0,CloakChargeclient,TIMER_FLAG_NO_MAPCHANGE);
                    }
                }
                else if(
buttons IN_ATTACK || buttons IN_ATTACK2 || buttons IN_JUMP)
                {
                    
SetEntityRenderFx(clientRENDERFX_NONE);
                    
PlayerSpeed[client] = 1.0;
                    
SetSpeed(clientPlayerSpeed[client]);
                    if(
weaponid != -1)
                        
SetEntityRenderFx(weaponidRENDERFX_NONE);
                    if(
henade != -1)
                    {
                        
SetAlpha(henade255);
                        
SetEntityRenderFx(henadeRENDERFX_NONE);
                    }
                    if(
sgnade != -1)
                    {
                        
SetAlpha(sgnade255);
                        
SetEntityRenderFx(sgnadeRENDERFX_NONE);
                    }
                    
                    
PlayerCanCloak[client] = false;
                    
CreateTimer(1.0,CloakChargeclient,TIMER_FLAG_NO_MAPCHANGE);
                    
                    
//PrintToChat(client, "[SM] Player Attacked or Jumped. Rendering reset");
                
}
                else
                {
                    
SetEntityRenderFx(clientRENDERFX_FADE_FAST);
                    if(
weaponid != -1)
                        
SetEntityRenderFx(weaponidRENDERFX_FADE_FAST);
                    if(
henade != -1)
                    {
                        
SetEntityRenderFx(henadeRENDERFX_FADE_FAST);
                        
SetAlpha(henade0);
                    }
                    if(
sgnade != -1)
                    {
                        
SetEntityRenderFx(sgnadeRENDERFX_FADE_FAST);
                        
SetAlpha(sgnade0);
                    }
                    
                    
//PrintToChat(client, "[SM] Rendering fade fast");
                    
if(PlayerSkills[client][6] > 0)
                    {
                        
PlayerSpeed[client] = 1.0 + (0.4 PlayerSkills[client][6]);
                        
SetSpeed(clientPlayerSpeed[client]);
                    }
                }
            }
        }    
        
        else if(
buttons IN_SPEED && !(GetEntityRenderFx(client) & RENDERFX_FADE_FAST))
        {
            if(
PlayerCanCloak[client])
            {
                if(
buttons IN_ATTACK || buttons IN_ATTACK2 || buttons IN_JUMP)
                {
                    
SetEntityRenderFx(clientRENDERFX_NONE);
                    
PlayerSpeed[client] = 1.0;
                    
SetSpeed(clientPlayerSpeed[client]);
                    if(
weaponid != -1)
                        
SetEntityRenderFx(weaponidRENDERFX_NONE);
                    if(
henade != -1)
                    {
                        
SetAlpha(henade255);
                        
SetEntityRenderFx(henadeRENDERFX_NONE);
                    }
                    if(
sgnade != -1)
                    {
                        
SetAlpha(sgnade255);
                        
SetEntityRenderFx(sgnadeRENDERFX_NONE);
                    }
                    
                    
PlayerCanCloak[client] = false;
                    
CreateTimer(1.0,CloakChargeclient,TIMER_FLAG_NO_MAPCHANGE);
                    
                    
//PrintToChat(client, "[SM] Player Attacked or Jumped. Rendering reset");
                
}
                else
                {
                    
SetEntityRenderFx(clientRENDERFX_FADE_SLOW);
                    if(
weaponid != -1)
                        
SetEntityRenderFx(weaponidRENDERFX_FADE_SLOW);
                    if(
henade != -1)
                    {
                        
SetAlpha(henade0);
                        
SetEntityRenderFx(henadeRENDERFX_FADE_SLOW);
                    }
                    if(
sgnade != -1)
                    {
                        
SetAlpha(sgnade0);
                        
SetEntityRenderFx(sgnadeRENDERFX_FADE_SLOW);
                    }
                    
                    
//PrintToChat(client, "[SM] Rendering fade slow");
                    
if(PlayerSkills[client][6] > 0)
                    {
                        
PlayerSpeed[client] = 1.0 + (0.6 PlayerSkills[client][6]);
                        
SetSpeed(clientPlayerSpeed[client]);
                    }
                }
            }
        }
        else if(!(
buttons IN_DUCK || buttons IN_SPEED) && (buttons IN_FORWARD 
        
|| buttons IN_BACK || buttons IN_LEFT || buttons IN_RIGHT || buttons IN_MOVELEFT || buttons IN_MOVERIGHT || buttons IN_JUMP) && PlayerCanCloak[client])
        {
            
SetEntityRenderFx(clientRENDERFX_NONE);
            if(
PlayerSkills[client][7] > 0)
                
PlayerSpeed[client] = 1.0 + (0.2 PlayerSkills[client][7]);
            else
            
PlayerSpeed[client] = 1.0;
            
SetSpeed(clientPlayerSpeed[client]);
            if(
weaponid != -1)
                
SetEntityRenderFx(weaponidRENDERFX_NONE);
            if(
henade != -1)
            {
                
SetEntityRenderFx(henadeRENDERFX_NONE);
                
SetAlpha(henade255);
            }
            if(
sgnade != -1)
            {
                
SetAlpha(sgnade255);
                
SetEntityRenderFx(sgnadeRENDERFX_NONE);
            }
            
            
PlayerCanCloak[client] = false;
            
CreateTimer(1.0,CloakChargeclient,TIMER_FLAG_NO_MAPCHANGE);
            
            
//PrintToChat(client, "[SM] Rendering reset");
        
}                    
    }
    return 
Plugin_Continue;

__________________
InstantDeath is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 06-20-2017 , 01:17   Re: [CS:S] One Man Army issues
Reply With Quote #2

Why don't you try first to contact the author and see if he can help you?
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 06-20-2017 , 02:29   Re: [CS:S] One Man Army issues
Reply With Quote #3

Isn't he the author?
hmmmmm is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 06-20-2017 , 03:01   Re: [CS:S] One Man Army issues
Reply With Quote #4

Quote:
Originally Posted by hmmmmm View Post
Isn't he the author?
Ohhh.
you are right, lol
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 06-20-2017 , 04:41   Re: [CS:S] One Man Army issues
Reply With Quote #5

https://forums.alliedmods.net/showthread.php?t=152165
8guawong is offline
InstantDeath
Senior Member
Join Date: Mar 2007
Old 07-11-2017 , 15:04   Re: [CS:S] One Man Army issues
Reply With Quote #6

Okay so a couple of things.

I've set the grenades to be removed when a player goes invisible, but instead of removing it, it seems to be showing a completely different equipment set. Should i set it to none if i want no equipment bits showing?
PHP Code:
#define CSAddon_NONE            0 
this is how it currently looks:
PHP Code:
#define CSAddon_NONE            0
#define CSAddon_HEGrenade       (1<<2)
#define CSAddon_SmokeGrenade    (1<<3)

new g_bits[MAXPLAYERS+1];

...

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
...

new 
henade GetClientGrenades(clientSlot_HEgrenade);
new 
sgnade GetClientGrenades(clientSlot_Smokegrenade);

if(
henade 0)
    
g_bits[client] &= ~CSAddon_HEGrenade;

if(
sgnade 0)
    
g_bits[client] &= ~CSAddon_SmokeGrenade;

...

    return 
Plugin_Continue;
}

//rest of plugin

GetClientGrenades(clientAmmoOffs)
{
    new 
offsNades FindDataMapInfo(client"m_iAmmo") + (AmmoOffs 4);
    
    return 
GetEntData(clientoffsNades);



The other thing is I have is a peculiar crash which I believe to have narrowed down to the "goodie box" a prop_physics that spawns where the CT player dies(if killed by the OMA). The OMA can touch it and pick up unique bonuses or a detriment(it can also explode, hurting the OMA)

There is a function called Entity_Touch that is used by both teams. The CT team can touch prop_physics and "find something" be it new gear, a health pack, etc.

Both teams use this function, and I've noticed that if a CT and a T touch the goodie box at the same time, the game crashes. Probably because when a T touches the goodie box, it removes it.


I'm not sure how to go about fixing this. Here are the functions in question:

also OMA_Goodie[MAXPLAYERS+1]; is a global array.

PHP Code:
#define GOODIEBOX_MODEL "models/items/boxmrounds.mdl"

public OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_TouchEntity_Touch);
        
        
//rest of code
}

stock SpawnGoodieBox(client)
{
    new 
Float:pos[3], Float:numVel[3];
    
numVel[0] = GetRandomFloat(-100.0100.0);
    
numVel[1] = GetRandomFloat(-100.0100.0);
    
numVel[2] = GetRandomFloat(1.0100.0);
    
OMA_Goodie[client] = CreateEntityByName("prop_physics");
    
SetEntityModel(OMA_Goodie[client], GOODIEBOX_MODEL);
    
DispatchSpawn(OMA_Goodie[client]);
    
GetClientAbsOrigin(clientpos);
    
TeleportEntity(OMA_Goodie[client], posNULL_VECTORnumVel);
    
CreateTimer(15.0TimedDeleteEntityOMA_Goodie[client], TIMER_FLAG_NO_MAPCHANGE); 
}

public 
Action:Entity_Touch(entity1entity2)
{
    new 
cliententity;
    if(
entity1 && entity1 <= 64)
    {
        
client entity1;
        
entity entity2;

    }
    else
    {
        
client entity2;
        
entity entity1;
    }
    new 
boolomaenable GetConVarBool(cvarpluginstatus);
    if(
omaenable)
    {
        new 
team GetClientTeam(client);
        if(
IsClientInGame(client))
        {
            if(
IsPlayerAlive(client))
            {
                if (
IsValidEntity(entity))
                {
                    
decl String:classname[32];
                    
GetEdictClassname(entityclassnamesizeof(classname));
                    
                    if((
WarmupActive && Weaponlvl[client] < 0) || (!WarmupActive && team == TEAM_CT))
                    {
                        if(
StrEqual(classname"weapon_hegrenade"false))
                        {
                            new 
count GetClientGrenades(clientSlot_HEgrenade);
                        
                            if (
count PlayerSkills[client][2])
                            {    
                                
PickupGrenade(cliententity);
                            }
                        }
                        
                        else if(
StrEqual(classname"weapon_smokegrenade"false))
                        {
                            new 
count GetClientGrenades(clientSlot_Smokegrenade);
                            
                            if (
count PlayerSkills[client][3])
                            {    
                                
PickupGrenade(cliententity);
                            }
                        }
                        
                        else if(
StrEqual(classname"prop_physics"false) || StrEqual(classname"prop_physics_multiplayer"false) || StrEqual(classname"func_physbox"false))
                        {
                            
//money roll code
                            //weapon roll code
                            //armor roll code
                        
}
                    }
                    else if((
WarmupActive && Weaponlvl[client] >= 0) || (!WarmupActive && team == TEAM_T))
                    {
                        if(
StrEqual(classname"prop_physics"false))
                        {
                            
                            new 
boolfoundent falsec;
                            for(
1MaxClientsc++)
                            {
                                if(
OMA_Goodie[c] == entity)
                                {
                                    
PrintDebugMsg("OMA touched Goodie box");
                                    
foundent true;
                                    if(
IsValidEdict(entity))
                                    {    
                                        
RemoveEdict(entity);
                                        
OMA_Goodie[c] = -1;
                                    }
                                    break;
                                }
                            }
                            if(
foundent)
                            {
                                new 
bool:lvl2keyrollrandom GetRandomInt(14);
                                new 
cashwonClientCash GetClientMoney(client);
                                new 
Float:pos[3];
                                
                                
GetClientAbsOrigin(clientpos);
                                
lvl2keyroll ChanceRoll(OMA_lvl[client]);
                                
                                switch(
random)
                                {
                                    case 
1:
                                    {
                                        
//found small amount of money reward code
                                    
}
                                    
                                    case 
2:
                                    {
                                        new 
randitem GetRandomInt(13);
                                        switch(
randitem)
                                        {
                                            case 
1:
                                            {
                                                
                                                
//found healthkit reward code

                                                
EmitSoundToAll(HEALTHKIT_SOUNDclientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS1.0SNDPITCH_NORMAL, -1posNULL_VECTORtrue0.0);
                                            }
                                            case 
2:
                                            {
                                                new 
ClientArmor GetClientArmor(client);
                                                
                                                if(
ClientArmor 100)
                                                {
                                                    
SetClientArmor(client100);
                                                    
EmitSoundToAll(ITEMPICKUP_SOUNDclientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS1.0SNDPITCH_NORMAL, -1posNULL_VECTORtrue0.0);
                                                }
                                            }
                                            case 
3:
                                            {
                                                new 
ClientArmor GetClientArmor(client);
                                                
                                                if(
ClientArmor 25 <= 125)
                                                {
                                                    
SetClientArmor(client125);
                                                }
                                                else
                                                
SetClientArmor(client125);
                                                
                                                
EmitSoundToAll(ITEMPICKUP_SOUNDclientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS1.0SNDPITCH_NORMAL, -1posNULL_VECTORtrue0.0);
                                            }
                                        }
                                    }
                                    case 
3:
                                    {
                                        
cashwon GetRandomInt(15000);
                                        
SetClientMoney(clientClientCash+cashwon);
                                        
PrintToChat(client"[SM] %t""found money"cashwon);
                                    }
                                    
                                    case 
4:
                                    {
                                        
//box explodes code
                                    
}
                                }
                                
PrintDebugMsg("OMA successfuly recieved Goodie box");
                            }
                        }
                    }
                }
            }
        }
    }
    return 
Plugin_Continue;

__________________

Last edited by InstantDeath; 07-11-2017 at 15:07.
InstantDeath is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-11-2017 , 17:29   Re: [CS:S] One Man Army issues
Reply With Quote #7

Install accelerator to debug crashes.

https://forums.alliedmods.net/showthread.php?t=277703&
__________________
Neuro Toxin is offline
InstantDeath
Senior Member
Join Date: Mar 2007
Old 07-11-2017 , 18:42   Re: [CS:S] One Man Army issues
Reply With Quote #8

Here is the crash dump and logs.

also, how do I open the dmp file?
Attached Files
File Type: txt ae324bff-9adc-451e-9a02-e9749d224936.dmp.txt (15.7 KB, 65 views)
File Type: 7z ae324bff-9adc-451e-9a02-e9749d224936.7z (34.3 KB, 18 views)
__________________

Last edited by InstantDeath; 07-11-2017 at 18:43.
InstantDeath is offline
InstantDeath
Senior Member
Join Date: Mar 2007
Old 07-12-2017 , 09:58   Re: [CS:S] One Man Army issues
Reply With Quote #9

Okay, so I moved the rewards code into a timer function that executes 0.1 seconds after the CT initially touches the entity. Also removed some useless and redundant code.

Also remembered to turn my debug messages on. It seems this time based on the logs that it crashed when it tried to switch the CT to the T side to become the OMA.

edit: https://crash.limetech.org/hc72u6mjy5rb

based on this crash report, the sdk hook function entity_touch is still crashing the server, despite the new protection I added.

current iteration of the entity_touch function:
PHP Code:
/* 
* Part of the code written below was originally written by Greyscale
* Modified by InstantDeath
*/
public Action:Entity_Touch(entity1entity2)
{
    new 
cliententity;
    if(
entity1 && entity1 <= 64)
    {
        
client entity1;
        
entity entity2;
        
//PrintToChatAll("entity 1: %d", client);
        //PrintToChatAll("entity 2: %d", entity);
    
}
    else
    {
        
client entity2;
        
entity entity1;
        
//PrintToChatAll("-entity 1: %d", client);
        //PrintToChatAll("-entity 2: %d", entity);
    
}
    new 
boolomaenable GetConVarBool(cvarpluginstatus);
    if(
omaenable)
    {
        new 
team GetClientTeam(client);
        if(
IsClientInGame(client))
        {
            if(
IsPlayerAlive(client))
            {
                if (
IsValidEntity(entity))
                {
                    
decl String:classname[32];
                    
GetEdictClassname(entityclassnamesizeof(classname));
                    
                    if((
WarmupActive && Weaponlvl[client] < 0) || (!WarmupActive && team == TEAM_CT))
                    {
                        if(
StrEqual(classname"weapon_hegrenade"false))
                        {
                            new 
count GetClientGrenades(clientSlot_HEgrenade);
                        
                            if (
count PlayerSkills[client][2])
                            {    
                                
PickupGrenade(cliententity);
                            }
                        }
                        
                        else if(
StrEqual(classname"weapon_smokegrenade"false))
                        {
                            new 
count GetClientGrenades(clientSlot_Smokegrenade);
                            
                            if (
count PlayerSkills[client][3])
                            {    
                                
PickupGrenade(cliententity);
                            }
                        }
                        
                        else if((
StrEqual(classname"prop_physics"false) || StrEqual(classname"prop_physics_multiplayer"false) || StrEqual(classname"func_physbox"false)) && entity != CheckedEntity[client])
                        {
                            
CheckedEntity[client] = entity;
                            
CreateTimer(0.1Timed_RewardclientTIMER_FLAG_NO_MAPCHANGE);
                        }
                    }
                    else if((
WarmupActive && Weaponlvl[client] >= 0) || (!WarmupActive && team == TEAM_T))
                    {
                        if(
StrEqual(classname"prop_physics"false))
                        {
                            
                            new 
boolfoundent falsec;
                            for(
1MaxClientsc++)
                            {
                                if(
OMA_Goodie[c] == entity)
                                {
                                    
PrintDebugMsg("OMA touched Goodie box");
                                    
foundent true;
                                    if(
IsValidEdict(entity))
                                    {    
                                        
RemoveEdict(entity);
                                        
OMA_Goodie[c] = -1;
                                    }
                                    break;
                                }
                            }
                            if(
foundent)
                            {
                                new 
bool:lvl2keyrollrandom GetRandomInt(14);
                                new 
cashwonClientCash GetClientMoney(client);
                                new 
Float:pos[3];
                                
                                
GetClientAbsOrigin(clientpos);
                                
lvl2keyroll ChanceRoll(OMA_lvl[client]);
                                
                                switch(
random)
                                {
                                    case 
1:
                                    {
                                        if(
lvl2keyroll && !OMAlvl2[client])
                                        {
                                            
EnableLevel2(client);
                                        }
                                        else
                                        {
                                            
cashwon GetRandomInt(150);
                                            
SetClientMoney(clientClientCash+cashwon);
                                            
PrintToChat(client"[SM] %t""found money"cashwon);
                                        }
                                    }
                                    
                                    case 
2:
                                    {
                                        new 
randitem GetRandomInt(13);
                                        switch(
randitem)
                                        {
                                            case 
1:
                                            {
                                                
                                                if(
ChanceRoll(40)) //full medkit
                                                
{    
                                                    
SetClientHealth(clientOMA_StartHealth);
                                                }
                                                else
                                                {
                                                    new 
ClientHealth GetClientHealth(client);
                                                    if(
ChanceRoll(33))
                                                    {
                                                        if(
ClientHealth 40 <= OMA_StartHealth)
                                                            
SetClientHealth(clientClientHealth 40);
                                                        else
                                                        
SetClientHealth(clientOMA_StartHealth);
                                                    }
                                                    else if(
ChanceRoll(33))
                                                    {
                                                        if(
ClientHealth 60 <= OMA_StartHealth)
                                                            
SetClientHealth(clientClientHealth 60);
                                                        else
                                                        
SetClientHealth(clientOMA_StartHealth);
                                                    }
                                                    else
                                                    {
                                                        if(
ClientHealth 20 <= OMA_StartHealth)
                                                            
SetClientHealth(clientClientHealth 20);
                                                        else
                                                        
SetClientHealth(clientOMA_StartHealth);
                                                    }
                                                }
                                                
EmitSoundToAll(HEALTHKIT_SOUNDclientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS1.0SNDPITCH_NORMAL, -1posNULL_VECTORtrue0.0);
                                            }
                                            case 
2:
                                            {
                                                new 
ClientArmor GetClientArmor(client);
                                                
                                                if(
ClientArmor 100)
                                                {
                                                    
SetClientArmor(client100);
                                                    
EmitSoundToAll(ITEMPICKUP_SOUNDclientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS1.0SNDPITCH_NORMAL, -1posNULL_VECTORtrue0.0);
                                                }
                                            }
                                            case 
3:
                                            {
                                                new 
ClientArmor GetClientArmor(client);
                                                
                                                if(
ClientArmor 25 <= 125)
                                                {
                                                    
SetClientArmor(client125);
                                                }
                                                else
                                                
SetClientArmor(client125);
                                                
                                                
EmitSoundToAll(ITEMPICKUP_SOUNDclientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS1.0SNDPITCH_NORMAL, -1posNULL_VECTORtrue0.0);
                                            }
                                        }
                                    }
                                    case 
3:
                                    {
                                        
cashwon GetRandomInt(15000);
                                        
SetClientMoney(clientClientCash+cashwon);
                                        
PrintToChat(client"[SM] %t""found money"cashwon);
                                    }
                                    
                                    case 
4:
                                    {
                                        new 
ent CreateEntityByName("env_explosion");
                                        new 
Float:vec[3];
                                        
DispatchKeyValue(ent"iMagnitude""100");
                                        
DispatchKeyValue(ent"fireballsprite"EXPLODE_SPR);
                                        
DispatchKeyValue(ent"rendermode""5");
                                        
DispatchSpawn(ent);
                                        
GetClientAbsOrigin(clientvec);
                                        
TeleportEntity(entvecNULL_VECTORNULL_VECTOR);
                                        
AcceptEntityInput(ent"Explode");
                                    }
                                }
                                
PrintDebugMsg("OMA successfuly recieved Goodie box");
                            }
                        }
                    }
                }
            }
        }
    }
    return 
Plugin_Continue;

Attached Files
File Type: txt 96c16225-ca1f-41d0-8f9b-6b07c430381a.dmp.txt (30.0 KB, 23 views)
File Type: zip 96c16225-ca1f-41d0-8f9b-6b07c430381a.zip (44.4 KB, 22 views)
__________________

Last edited by InstantDeath; 07-12-2017 at 10:26.
InstantDeath is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode