Raised This Month: $51 Target: $400
 12% 

[Request] Auto show menu instead typing in chat /menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Razvann.
Senior Member
Join Date: Jul 2012
Old 05-10-2015 , 18:17   [Request] Auto show menu instead typing in chat /menu
Reply With Quote #1

I want this menu to appear in each round (on the beginning) without typing !vipmenu /vipmenu

I only want to show the VIP menu facility's to the VIP's (custom 2) and to not show messages to the players without VIP (you dont have vip to acces menu...)

PS: Is not full plugin, is a part of him, is only compiling with 1.6.4 sm

Code:
    GetConVarString(g_hVip, g_sVip, sizeof(g_sVip)); 
    menuv = GetConVarInt(g_menu);

    AutoExecConfig(true, "vip_menu");
}

public OnConfigsExecuted()
{
    iHealth = GetConVarInt(g_iHealth);
    iArmor = GetConVarInt(g_iArmor);
    iMoney = GetConVarInt(g_iMoney);
    iSpeed = GetConVarFloat(g_iSpeed);
    iGravity = GetConVarFloat(g_iGravity);

    Vie = GetConVarInt(Active_Vie);
    Armure = GetConVarInt(Active_Armure);
    Usp = GetConVarInt(Active_Usp);
    Grenade = GetConVarInt(Active_Grenade);
    Smoke = GetConVarInt(Active_Smoke);
    Vitesse = GetConVarInt(Active_Vitesse);
    Argent = GetConVarInt(Active_Argent);
    Gravite = GetConVarInt(Active_Gravite);
    Regeneration = GetConVarInt(Active_Regeneration);
    Rien = GetConVarInt(Active_Rien);
    Advert = GetConVarInt(Active_Advert);
    Transparance = GetConVarInt(Active_Transparance);
    Respawn = GetConVarInt(Active_Respawn);
    GetConVarString(g_tagteam, TagTeam, sizeof(TagTeam));
}


public Action:OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    IsValideRegen[client] = false;

    if (GetUserFlagBits(client) & ADMFLAG_CUSTOM2)    
    {
        SetEntityGravity(client, 1.0);
        SetEntityRenderMode(client, RENDER_TRANSCOLOR);
        SetEntityRenderColor(client, 255, 255, 255, 255);
    }
    
    PlayerRespawn[client] = 0;

    return Plugin_Handled;
}


//aici

public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
for(new i = 1; i <= MaxClients; i++)
{
HasMenu[i] = false;
HasUseMenu[i] = false;
menu_times[i] = 0;
}
CPrintToChatAll("\x04[GLS-RO] \x01Scrie !vipmenu pentru a deschide meniul VIP.", TagTeam);
} 
public Action:menuvip(client, args)
{
    GetClientAuthString(client, steamid, sizeof(steamid));
    if (GetUserFlagBits(client) & ADMFLAG_CUSTOM2)
    {
        if(client == 0)
        {
            CPrintToChat(client, "\x04[GLS-RO] \x01Comanda este invalida.", TagTeam);
            return Plugin_Handled;
        }
        if(menuv <= 0)
        {
            CPrintToChat(client, "\x04[GLS-RO] \x01Comanda este dezactivata.", TagTeam);
            return Plugin_Handled;
        }
        if(GetClientTeam(client) == 1)
        {
            CPrintToChat(client, "\x04[GLS-RO] \x01Nu poti utiliza comanda din echipa Spectatori.", TagTeam);
            return Plugin_Handled;
        }
        if(!IsPlayerAlive(client))
        {
            CPrintToChat(client, "\x04[GLS-RO] \x01Trebuie sa fi in viata.", TagTeam);
            return Plugin_Handled;        
        }
        if(HasMenu[client])
        {
            CPrintToChat(client, menu_times[client] >= menuv ? "\x04[GLS-RO] \x01Ti-ai folosit toate beneficiile":"Nu mai poti utiliza meniul", TagTeam);
            return Plugin_Handled;
        }
        else
        {
            HasUseMenu[client] = true;
            new Handle:menu = CreateMenu(vipmenu);
            SetMenuTitle(menu, "Meniul VIP");
            if (Vie == 1)
            {
                AddMenuItem(menu, "Vie", "Mai multa viata");
            }
            if(Armure == 1)
            {
                AddMenuItem(menu, "Armure", "Armura gratis");
            }
            if (Usp == 1)
            {
                AddMenuItem(menu, "Usp", "Pistolul USP-S");
            }
            if (Grenade == 1)
            {
                AddMenuItem(menu, "Grenade", "Grenada exploziva");
            }
            if (Smoke == 1)
            {
                AddMenuItem(menu, "Smoke", "Grenada fumigena");
            }
            if (Vitesse == 1)
            {
                AddMenuItem(menu, "Vitesse", "Viteza marita");
            }
            if (Argent == 1)
            {
                AddMenuItem(menu, "Argent", "Mai multi bani");
            }
            if (Gravite == 1)
            {
                AddMenuItem(menu, "Gravite", "Gravitatie marita");
            }
            if (Regeneration == 1)
            {
                AddMenuItem(menu, "Regeneration", "Regenerare viata");
            }
            if (Transparance == 1)
            {
                AddMenuItem(menu, "Transparance", "Transparenta corp");
            }
            if (Respawn == 1)
            {
                AddMenuItem(menu, "Respawn", "Reinviere");
            }
            SetMenuExitButton(menu, (Rien == 1 ? true : false));
            DisplayMenu(menu, client, MENU_TIME_FOREVER);
            menu_times[client]++;
            if(menu_times[client] >= menuv) 
            {
                HasMenu[client] = true;
            }
            CPrintToChat(client, "\x04[GLS-RO] \x01Ai disponibil 1 avantaj pe runda.", TagTeam, menu_times[client], menuv);
        }
        return Plugin_Continue;
    }
    else
    {
        CPrintToChat( client, "\x04[GLS-RO] \x01Trebuie sa fii VIP." , TagTeam);
    }
    return Plugin_Continue;
}

public vipmenu(Handle:menu, MenuAction:action, client, param2)
{
    if ( action == MenuAction_Select )
    {
        GetMenuItem(menu, param2, info, sizeof(info));
        if(StrEqual(info, "Vie"))
        {
            CPrintToChat( client, "\x04[GLS-RO] \x01Ai ales beneficiul: Viata." , TagTeam);
            if (g_iHealth != INVALID_HANDLE)
            SetEntProp(client, Prop_Send, "m_iHealth", iHealth);
        }
        if(StrEqual(info, "Armure"))
        {
            CPrintToChat( client, "\x04[GLS-RO] \x01Ai ales beneficiul: Armura.", TagTeam);
            if (g_iArmor != INVALID_HANDLE)
            SetEntProp(client, Prop_Send, "m_ArmorValue", iArmor);
        }
        if(StrEqual(info, "Usp"))
        {
            CPrintToChat( client, "\x04[GLS-RO] \x01Un pistol USP-S ti-a fost aruncat (uitate jos).", TagTeam);
            GivePlayerItem(client, "weapon_usp_silencer");
        }
        if(StrEqual(info, "Grenade"))
        {
            CPrintToChat( client, "\x04[GLS-RO] \x01Ai ales beneficiul: Grenada.", TagTeam);
            GivePlayerItem(client, "weapon_hegrenade");
        }
        if(StrEqual(info, "Smoke"))
        {
            CPrintToChat( client, "\x04[GLS-RO] \x01Ai ales beneficiul: Smoke.", TagTeam);
            GivePlayerItem(client, "weapon_smokegrenade");    
        }
        if(StrEqual(info, "Vitesse"))
        {
            CPrintToChat( client, "\x04[GLS-RO] \x01Ai ales beneficiul: Viteza.", TagTeam);
            if (g_iSpeed != INVALID_HANDLE)
            SetEntPropFloat( client, Prop_Data, "m_flLaggedMovementValue", iSpeed);
        }
        if(StrEqual(info, "Argent"))
        {
            CPrintToChat( client, "\x04[GLS-RO] \x01Ai ales beneficiul: Bani.", TagTeam);
            if (g_iMoney != INVALID_HANDLE)
            SetEntProp(client, Prop_Send, "m_iAccount", iMoney);
        }
        if(StrEqual(info, "Gravite"))
        {
            CPrintToChat( client, "\x04[GLS-RO] \x01Ai ales beneficiul: Gravitatie.", TagTeam);
            if (g_iGravity != INVALID_HANDLE)
            SetEntPropFloat( client, Prop_Data, "m_flGravity", iGravity);
        }
        if(StrEqual(info, "Regeneration"))
        {
            CPrintToChat( client, "\x04[GLS-RO] \x01Ai ales beneficiul: Regenerare.", TagTeam);
            IsValideRegen[client] = true;
        }
        if(StrEqual(info, "Transparance"))
        {
            CPrintToChat( client, "\x04[GLS-RO] \x01Ai ales beneficiul: Transparenta.", TagTeam);
            SetEntityRenderMode(client, RENDER_TRANSCOLOR);
            SetEntityRenderColor(client, 255, 255, 255, 100);
        }
        if(StrEqual(info, "Respawn"))
        {
            CPrintToChat( client, "\x04[GLS-RO] \x01Ai ales beneficiul: Reinviere.", TagTeam);
            CPrintToChat( client, "\x04[GLS-RO] \x01Scrie: !vipspawn pentru reinviere", TagTeam);
            PlayerRespawn[client] = 1;
        }
    }
    else if (action == MenuAction_End )
    {
        CloseHandle(menu);
    }  
}

public Action:VipRespawn(client, args)
{
    if (GetUserFlagBits(client) & ADMFLAG_CUSTOM2)
    {
        if(StrEqual(info, "Respawn"))
        {
            if (PlayerRespawn[client] > 0)
            {
                CS_RespawnPlayer(client);
                CPrintToChat(client, "\x04[GLS-RO] \x01Ti-ai folosit Reinvierea!", TagTeam);
                PlayerRespawn[client]--;
            }
            else
            {
                CPrintToChat(client, "\x04[GLS-RO] \x01Ai folosit !vipspawn deja.", TagTeam);
            }
        }
        else
        {
            CPrintToChat(client, "\x04[GLS-RO] \x01You do not choose the bonus Respawn.", TagTeam);
        }
    }
    else
    {
        CPrintToChat(client, "\x04[GLS-RO] \x01Nu ai cumparat VIP ca sa utilizezi privilegiile speciale.", TagTeam);
    }
}

public Action:advert(Handle:timer)
{
    for(new client = 1; client <= MaxClients;client++)
    {
        if (GetConVarInt(adverts_info) && IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) > 1 && ADMFLAG_CUSTOM2)
        {
            CPrintToChat( client, "\x04[GLS-RO] \x01Pentru meniul VIP scrie: \x04!vipmenu", TagTeam);
        }
    }
}

public Action:advert2(Handle:timer)
{
    if (Advert == 1)
    {
        if(GetConVarInt(adverts_info2))
        {
            CPrintToChatAll( "\x04[VIP] \x01Pentru mai multe informatii scrie: /vip", TagTeam);
        }
    }
}

public OnPlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
    new iUserId = GetEventInt(event, "userid");
    new client = GetClientOfUserId(iUserId);

    if(g_hRegenTimer[client] == INVALID_HANDLE && GetUserFlagBits(client) & ADMFLAG_CUSTOM2 && IsValideRegen[client] == true)
    {
        g_hRegenTimer[client] = CreateTimer(GetConVarFloat(g_Interval), Regenerate, client, TIMER_REPEAT);
    }
}

public Action:Regenerate(Handle:timer, any:client)
{
    if (IsClientInGame(client))
    {
        new ClientHealth = GetClientHealth(client);
        if(ClientHealth < GetConVarInt(g_MaxHP))
        {
            SetClientHealth(client, ClientHealth + GetConVarInt(g_Inc));
        }
        else
        {
            SetClientHealth(client, GetConVarInt(g_MaxHP));
            KillTimer(timer);
            g_hRegenTimer[client] = INVALID_HANDLE;
        }
    }
}

SetClientHealth(client, amount)
{
    new HealthOffs = FindDataMapOffs(client, "m_iHealth");
    SetEntData(client, HealthOffs, amount, true);
}

public OnClientDisconnect_Post(client)
{
    HasMenu[client] = true;
    menu_times[client] = 0;
}

public bool:TraceEntityFilterPlayer(entity, contentsMask) 
{
     return entity > GetMaxClients();
}
I tried this:
Code:
public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    for(new i = 1; i <= MaxClients; i++)
    {
        HasMenu[i] = false;
        HasUseMenu[i] = false;
        menu_times[i] = 0;
        menuvip(i, 0);
    }
}  
menu appears ok to the VIP but message with You dont have vip spam the players...
Razvann. is offline
Send a message via Yahoo to Razvann.
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 05-10-2015 , 18:41   Re: [Request] Auto show menu instead typing in chat /menu
Reply With Quote #2

Quote:
Originally Posted by Razvann. View Post
I want this menu to appear in each round (on the beginning) without typing !vipmenu /vipmenu

I only want to show the VIP menu facility's to the VIP's (custom 2) and to not show messages to the players without VIP (you dont have vip to acces menu...)

PS: Is not full plugin, is a part of him, is only compiling with 1.6.4 sm
Your thread seems to belong to the Scripting section.

Also, you already have a thread there: Auto show menu instead typing in chat /menu

Cross-posting is against the rules, which means you should stick to your original threads and don't spawn the same question in every single forum.

Quote:
Originally Posted by Razvann. View Post
menu appears ok to the VIP but message with You dont have vip spam the players...
Well, I don't see the phrase "You dont have VIP" anywhere... Post your code in English, and you will receive much more attention than if you don't.

Anyway, is this message the one you are saying is being spammed to non-vips?

Code:
        return Plugin_Continue;
    }
    else
    {
        CPrintToChat( client, "\x04[GLS-RO] \x01Trebuie sa fii VIP." , TagTeam);
    }
    return Plugin_Continue;
}
If it is, you can remove this part:

Code:
    else
    {
        CPrintToChat( client, "\x04[GLS-RO] \x01Trebuie sa fii VIP." , TagTeam);
    }
And this message will no longer arrive.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
Razvann.
Senior Member
Join Date: Jul 2012
Old 05-10-2015 , 18:46   Re: [Request] Auto show menu instead typing in chat /menu
Reply With Quote #3

Thanks! Works great
a little request, how can i set VIP Menu to show after ~5 seconds (not in spawn)?


edit: problems (logs):

L 05/11/2015 - 02:29:06: [SM] [0] Line 187, menuvip2.sp::menuvip()
L 05/11/2015 - 02:29:06: [SM] [1] Line 182, menuvip2.sp::OnRoundStart()
L 05/11/2015 - 021:13: [SM] Native "GetClientAuthString" reported: Client 29 is not connected


1mb of log with this error...

Last edited by Razvann.; 05-11-2015 at 14:58.
Razvann. is offline
Send a message via Yahoo to Razvann.
Reply



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 07:57.


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