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

CS:GO Plugin vip - change flags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
staszek
New Member
Join Date: Sep 2014
Old 09-09-2014 , 11:41   CS:GO Plugin vip - change flags
Reply With Quote #1

Hi. I have question about this plugin.
Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <clientprefs>
#include <colors>
#include <loghelper>

public Plugin:myinfo =
{
    name = "VIP Plugin",
    author = "hanys",
    description = "vip plugin",
    version = "1.0",
    url = "http://cs-wojak.com"
};

public OnPluginStart()
{
    RegConsoleCmd("say", Command_SendToAll);
    RegConsoleCmd("say_team", Command_SendToTeam);

    HookEvent("player_spawn", Event_OnPlayerSpawn); 
    HookEvent("bomb_planted", Event_BombPlanted);
    HookEvent("bomb_defused", Event_BombDefused);
    HookEvent("player_death",  Event_PlayerDeath);
    HookEvent("player_team", Event_TagTable); 
    HookEvent("player_spawn", Event_TagTable); 

    //CreateTimer(5.0, Timer_Copy, _, TIMER_REPEAT); 
}

public Action:Timer_Copy(Handle:timer)
{
    PrintToChatAll("\x01[\x04DEMO\x01]\x04 PLUGIN DEMO PLUGIN DEMOPLUGIN DEMOPLUGIN DEMO");
}  

public Event_OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    new money = GetEntProp(client, Prop_Send, "m_iAccount");

    if (client > 0 && IsPlayerAlive(client))
    {
        if (IsPlayerGenericAdmin(client))
        {
            SetEntityHealth(client, 110);  //hp
            SetEntProp(client, Prop_Send, "m_ArmorValue", 100, 1); //armor
            GivePlayerItem(client, "weapon_smokegrenade"); //smoke
            GivePlayerItem(client, "weapon_flashbang"); //flash
            GivePlayerItem(client, "weapon_hegrenade"); //grenade

            SetEntProp(client, Prop_Send, "m_iAccount", money + 200); //200$ plus

            
        }
    }
} 

public Event_BombPlanted(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    new money = GetEntProp(client, Prop_Send, "m_iAccount");

    if (IsPlayerGenericAdmin(client))
    {
        SetEntProp(client, Prop_Send, "m_iAccount", money + 200); //200$ plus          
    }
}

public Event_BombDefused(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    new money = GetEntProp(client, Prop_Send, "m_iAccount");

    if (IsPlayerGenericAdmin(client))
    {
        SetEntProp(client, Prop_Send, "m_iAccount", money + 200); //200$ plus          
    }
}

public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
    new money = GetEntProp(attacker, Prop_Send, "m_iAccount");

    new bool:headshot = GetEventBool(event, "headshot");
    if (IsPlayerGenericAdmin(attacker))
    {
        if(headshot){
            SetEntProp(attacker, Prop_Send, "m_iAccount", money + 150); //150$ plus for hs
        }else{
            SetEntProp(attacker, Prop_Send, "m_iAccount", money + 100); //100$ plus for kill 
        }
    }
}

public Action:Event_TagTable(Handle:event, String:name[], bool:dontBroadcast) 
{ 
    new client = GetClientOfUserId(GetEventInt(event, "userid")); 
    if (IsPlayerGenericAdmin(client))
    {
        CS_SetClientClanTag(client, "[VIP]"); 
    }
}

public Action:Command_SendToAll(client, args)
{
    if (IsPlayerGenericAdmin(client))
    {
        decl String:sTextToAll[1024];
        GetCmdArgString(sTextToAll, sizeof(sTextToAll));
        StripQuotes(sTextToAll);
        LogPlayerEvent(client, "say=", sTextToAll);

        new team = GetClientTeam(client);

        if(IsPlayerAlive(client) && team == 2 || team == 3)
        {
            PrintToChatAll("\x01[\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
        }
        /* Player isn't alive and have team (no spec) */
        else if(!IsPlayerAlive(client) && team == 2 || team == 3)
        {
            PrintToChatAll("\x01*NIE ŻYJE* [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
        }
        /* Player is in spectate */
        else if(!IsPlayerAlive(client) && team != 2 && team != 3)
        {
            PrintToChatAll("\x01*OBSERWATOR* [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
        }

        return Plugin_Handled;
    }
   
    return Plugin_Continue;
}

public Action:Command_SendToTeam(client, args)
{
    if (IsPlayerGenericAdmin(client))
    {
        decl String:sTextToAll[1024];
        GetCmdArgString(sTextToAll, sizeof(sTextToAll));
        StripQuotes(sTextToAll);
        LogPlayerEvent(client, "say=", sTextToAll);
        
        new team = GetClientTeam(client);

        if(IsPlayerAlive(client) && team == 2 || team == 3)
        {
            for(new i = 1; i <= MaxClients; i++)
            {
                if(IsClientInGame(i))
                {
                    new PlayersTeam = GetClientTeam(i);
                    if(PlayersTeam & team)
                    {
                        if(team == 2)
                            PrintToChat(i, "\x01(Terrorysta) [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
                        else
                            PrintToChat(i, "\x01(Antyterrorysta) [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
                    }
                }
            }
        }
        /* Player isn't alive and have team (no spec) */
        else if(!IsPlayerAlive(client) && team == 2 || team == 3)
        {
            for(new i = 1; i <= MaxClients; i++)
            {
                if(IsClientInGame(i) && !IsPlayerAlive(i))
                {
                    new PlayersTeam = GetClientTeam(i);
                    if(PlayersTeam & team)
                    {
                        if(team == 2)
                            PrintToChat(i, "\x01*NIE ŻYJE*(Terrorysta) [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
                        else
                            PrintToChat(i, "\x01*NIE ŻYJE*(Antyterrorysta) [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
                    }
                }
            }
        }
        /* Player is in spectate */
        else if(!IsPlayerAlive(client) && team != 2 && team != 3)
        {
            for(new i = 1; i <= MaxClients; i++)
            {
                if(IsClientInGame(i) && !IsPlayerAlive(i))
                {
                    new PlayersTeam = GetClientTeam(i);
                    if(PlayersTeam & team)
                    {
                        if(team == 2)
                            PrintToChat(i, "\x01*OBSERWATOR*(Terrorysta) [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
                        else
                            PrintToChat(i, "\x01*OBSERWATOR*(Antyterrorysta) [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
                    }
                }
            }
        }

        return Plugin_Handled;
    }

    return Plugin_Continue;
}

/*
@param client id

return bool
*/
bool:IsPlayerGenericAdmin(client)
{
    if (CheckCommandAccess(client, "generic_admin", ADMFLAG_RESERVATION, false))
    {
        return true;
    }

    return false;
}

How can I change "a" flag on "t"



I change ADMFLAG_RESERVATION to ADMIN_CUSTOM6
but it doesn't work. I can't compile the plugin.
Please help.

Last edited by staszek; 09-09-2014 at 11:48.
staszek is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-09-2014 , 12:02   Re: CS:GO Plugin vip - change flags
Reply With Quote #2

You can use the Overrides system to override "generic_admin" to a new flag without having to recompile the plugin.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 09-09-2014 at 12:02.
Powerlord is offline
staszek
New Member
Join Date: Sep 2014
Old 09-09-2014 , 13:11   Re: CS:GO Plugin vip - change flags
Reply With Quote #3

Like this?

Code:
Overrides

{
    "generic_admin"    "t"
}

Last edited by staszek; 09-09-2014 at 13:12.
staszek is offline
DJ Data
SourceMod Donor
Join Date: Dec 2012
Location: Switzerland
Old 09-09-2014 , 17:45   Re: CS:GO Plugin vip - change flags
Reply With Quote #4

Quote:
Originally Posted by staszek View Post
I change ADMFLAG_RESERVATION to ADMIN_CUSTOM6
but it doesn't work. I can't compile the plugin.
Please help.
Find the mistake in this quote.

Hang on.
Quote:
Originally Posted by staszek View Post
ADMFLAG_RESERVATION to ADMIN_CUSTOM6
There.
__________________
SourcePawn Coding Level: Novice

Last edited by DJ Data; 09-09-2014 at 17:45.
DJ Data is offline
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 10:09.


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