AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved need help (https://forums.alliedmods.net/showthread.php?t=325086)

Johnoclock 06-07-2020 20:05

need help
 
hello why do this not work if u need any other info feel free to ask

PHP Code:

#include <sourcemod>

#define PREFIX "[SM]"
bool g_bEnabled[MAXPLAYERS 1] = false;

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_sandermingud"Command_CrosshairADMFLAG_KICK"This is my great command");
    
    
CreateTimer(0.1Timer_Hud_TIMER_REPEAT);
}

public 
void OnClientPostAdminCheck(int client)
{
    
g_bEnabled[client] = false;
}

public 
void OnClientDisconnect(int client)
{
    
g_bEnabled[client] = false;
}

public 
Action Command_Crosshair(int clientint args)
{
    if (
IsClientInGame(client) && !IsFakeClient(client))
    {
        
g_bEnabled[client] = !g_bEnabled[client];
        
PrintToChat(client"%s Du mærker en lille rejsning %s\x01 DET KILDER!"PREFIXg_bEnabled[client] ? "\x04Du mærker en kilden nede i bukserne":"\x02NU SPRØJTER DET!");
    }
    return 
Plugin_Handled;
}

public 
Action Timer_Hud(Handle timerany data)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i))
        {
            if (
IsPlayerAlive(i) && g_bEnabled[i])
            {
                
int currentWeapon GetEntPropEnt(iProp_Send"m_hActiveWeapon");
                if (
currentWeapon == -1)
                {
                    
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                }
                
                
int itemIndex GetEntProp(currentWeaponProp_Send"m_iItemDefinitionIndex");
                if (
itemIndex != 9// weapon awp
                
{
                    
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                }
                
int itemIndex40 GetEntProp(currentWeaponProp_Send"m_iItemDefinitionIndex");
                if (
itemIndex40 != 40// weapon ssg 08
                
{
                    
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                }
                
int itemIndex11 GetEntProp(currentWeaponProp_Send"m_iItemDefinitionIndex");
                if (
itemIndex11 != 11// weapon g3sgg1
                
{
                    
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                }
                
int itemIndex38 GetEntProp(currentWeaponProp_Send"m_iItemDefinitionIndex");
                if (
itemIndex38 != 38// weapon scar20
                
{
                    
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                }
                
int fov GetEntProp(iProp_Data"m_iFOV");
                if (
fov && fov GetEntProp(iProp_Data"m_iDefaultFOV"))
                {
                    
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                }
                
                
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                
ShowHudText(i2"+");
            }
        }
    }



Vieni 06-07-2020 20:13

Re: need help
 
Quote:

Originally Posted by john96dk (Post 2704542)
hello why do this not work if u need any other info feel free to ask

PHP Code:

#include <sourcemod>

#define PREFIX "[SM]"
bool g_bEnabled[MAXPLAYERS 1] = false;

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_sandermingud"Command_CrosshairADMFLAG_KICK"This is my great command");
    
    
CreateTimer(0.1Timer_Hud_TIMER_REPEAT);
}

public 
void OnClientPostAdminCheck(int client)
{
    
g_bEnabled[client] = false;
}

public 
void OnClientDisconnect(int client)
{
    
g_bEnabled[client] = false;
}

public 
Action Command_Crosshair(int clientint args)
{
    if (
IsClientInGame(client) && !IsFakeClient(client))
    {
        
g_bEnabled[client] = !g_bEnabled[client];
        
PrintToChat(client"%s Du mærker en lille rejsning %s\x01 DET KILDER!"PREFIXg_bEnabled[client] ? "\x04Du mærker en kilden nede i bukserne":"\x02NU SPRØJTER DET!");
    }
    return 
Plugin_Handled;
}

public 
Action Timer_Hud(Handle timerany data)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i))
        {
            if (
IsPlayerAlive(i) && g_bEnabled[i])
            {
                
int currentWeapon GetEntPropEnt(iProp_Send"m_hActiveWeapon");
                if (
currentWeapon == -1)
                {
                    
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                }
                
                
int itemIndex GetEntProp(currentWeaponProp_Send"m_iItemDefinitionIndex");
                if (
itemIndex != 9// weapon awp
                
{
                    
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                }
                
int itemIndex40 GetEntProp(currentWeaponProp_Send"m_iItemDefinitionIndex");
                if (
itemIndex40 != 40// weapon ssg 08
                
{
                    
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                }
                
int itemIndex11 GetEntProp(currentWeaponProp_Send"m_iItemDefinitionIndex");
                if (
itemIndex11 != 11// weapon g3sgg1
                
{
                    
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                }
                
int itemIndex38 GetEntProp(currentWeaponProp_Send"m_iItemDefinitionIndex");
                if (
itemIndex38 != 38// weapon scar20
                
{
                    
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                }
                
int fov GetEntProp(iProp_Data"m_iFOV");
                if (
fov && fov GetEntProp(iProp_Data"m_iDefaultFOV"))
                {
                    
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                }
                
                
SetHudTextParams(-1.0, -1.00.152552525000.00.00.0);
                
ShowHudText(i2"+");
            }
        }
    }



Wrong thread, I think you should post here: https://forums.alliedmods.net/forumdisplay.php?f=107

Btw, maybe 'cause of this?
HTML Code:

CreateTimer(0.1, Timer_Hud, _, TIMER_REPEAT)
-->
HTML Code:

CreateTimer(0.1, "Timer_Hud", _, TIMER_REPEAT)
I'm not familiar with source code, but feel free to try it if no answer comes

Johnoclock 06-07-2020 20:17

Re: need help
 
Quote:

Originally Posted by Vieni (Post 2704545)
Wrong thread, I think you should post here: https://forums.alliedmods.net/forumdisplay.php?f=107

Btw, maybe 'cause of this?
HTML Code:

CreateTimer(0.1, Timer_Hud, _, TIMER_REPEAT)
-->
HTML Code:

CreateTimer(0.1, "Timer_Hud", _, TIMER_REPEAT)
I'm not familiar with source code, but feel free to try it if no answer comes

i dont think is that but thanks it works with only one weapon
PHP Code:

                int itemIndex GetEntProp(currentWeaponProp_Send"m_iItemDefinitionIndex");
                if (
itemIndex != 9// weapon awp
                
{
                    
SetHudTextParams(-1.0, -1.00.15255252100.00.00.0);
                    
ShowHudText(i2"");
                    continue;
                } 



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

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