Raised This Month: $40 Target: $400
 10% 

Restrict flag vip


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
szogun
Senior Member
Join Date: Apr 2016
Old 02-18-2018 , 08:12   Restrict flag vip
Reply With Quote #1

Hello
I have an error with the vip code, namely when it activates everyone gets privileges

PHP Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>

#pragma semicolon 1
#pragma newdecls required


char tag[64] = "VIP";

int offsetHe;
int offsetFlash;
int offsetSmoke;
int offsetInc;
int offsetMol;
public 
void OnPluginStart()
{
    
HookEvent("bomb_planted"EventBombPlanted);
    
HookEvent("bomb_defused"EventBombDefused);
    
HookEvent("player_spawn"PlayerSpawn);
    
HookEvent("player_death"PlayerDeath);
}
public 
void OnMapStart()
{
    
int entindex;

    
entindex CreateEntityByName("weapon_hegrenade");
    
DispatchSpawn(entindex);
    
offsetHe GetEntProp(entindexProp_Send"m_iPrimaryAmmoType");
    
AcceptEntityInput(entindex"Kill");

    
entindex CreateEntityByName("weapon_flashbang");
    
DispatchSpawn(entindex);
    
offsetFlash GetEntProp(entindexProp_Send"m_iPrimaryAmmoType");
    
AcceptEntityInput(entindex"Kill");

    
entindex CreateEntityByName("weapon_smokegrenade");
    
DispatchSpawn(entindex);
    
offsetSmoke GetEntProp(entindexProp_Send"m_iPrimaryAmmoType");
    
AcceptEntityInput(entindex"Kill");

    
entindex CreateEntityByName("weapon_incgrenade");
    
DispatchSpawn(entindex);
    
offsetInc GetEntProp(entindexProp_Send"m_iPrimaryAmmoType");
    
AcceptEntityInput(entindex"Kill");
    
    
entindex CreateEntityByName("weapon_molotov");
    
DispatchSpawn(entindex);
    
offsetMol GetEntProp(entindexProp_Send"m_iPrimaryAmmoType");
    
AcceptEntityInput(entindex"Kill");

}

public 
Action PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    if(!
IsPlayerVIP(client)) return;
    if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
        
SetEntProp(clientProp_Send"m_ArmorValue"100);
    if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
        
SetEntProp(clientProp_Send"m_bHasHelmet"1);
    
int money GetEntProp(clientProp_Send"m_iAccount");
    
SetEntProp(clientProp_Send"m_iAccount"money+200);
    if(
GetClientTeam(client) == CS_TEAM_CT)
        if(
GetEntProp(clientProp_Send"m_bHasDefuser") == 0GivePlayerItem(client"item_defuser");
    for(
int x 01x++)
        if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetHe) < 1GivePlayerItem(client"weapon_hegrenade");
    for(
int x 01x++)
        if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetFlash) < 1GivePlayerItem(client"weapon_flashbang");
    for(
int x 01x++)
        if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetSmoke) < 1GivePlayerItem(client"weapon_smokegrenade");
    if(
GetClientTeam(client) == CS_TEAM_CT)
    {
        for(
int x 01x++)                                            // ilosc inc 
            
if(GetEntProp(clientProp_Send"m_iAmmo"_offsetInc) < 1GivePlayerItem(client"weapon_incgrenade");
    }
    else if(
GetClientTeam(client) == CS_TEAM_T)
    {
        for(
int x 01x++)
            if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetMol) < 1GivePlayerItem(client"weapon_molotov");
    }
}
public 
Action PlayerDeath(Handle event, const char[] namebool dontBroadcast)
{
    
int attacker GetClientOfUserId(GetEventInt(event"attacker"));
    if(!
IsValidPlayer(attacker) || !IsPlayerVIP(attacker)) return;
    
int health GetClientHealth(attacker);
    
SetEntityHealth(attackerhealth+5);
    
int money GetEntProp(attackerProp_Send"m_iAccount");
    
SetEntProp(attackerProp_Send"m_iAccount"money+100);
    
bool headshot GetEventBool(event"headshot"false);
    if(
headshot)
    {
        
health GetClientHealth(attacker);
        
SetEntityHealth(attackerhealth+10);
        
money GetEntProp(attackerProp_Send"m_iAccount");
        
SetEntProp(attackerProp_Send"m_iAccount"money+150);
    }
    if(
GetClientHealth(attacker) > 100)
                
SetEntityHealth(attacker100);
}

public 
Action EventBombPlanted(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
int money GetEntProp(clientProp_Send"m_iAccount");
    if(
IsPlayerVIP(client))
        
SetEntProp(clientProp_Send"m_iAccount"money+150);
}
public 
Action EventBombDefused(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
int money GetEntProp(clientProp_Send"m_iAccount");
    if(
IsPlayerVIP(client))
        
SetEntProp(clientProp_Send"m_iAccount"money+150);
}

public 
void OnClientPostAdminCheck(int client)
{
    if(
IsPlayerVIP(client))
    {
            
        
PrintToChatAll(" %s \x03%N\x01 \x01"tagclient);
    }
}

stock bool IsValidPlayer(int client)
{
    if(
client >= && client <= MaxClients && IsClientInGame(client) && !IsFakeClient(client) && !IsClientSourceTV(client))
        return 
true;
    return 
false;
}
stock bool IsPlayerVIP(int client)
{
    if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM6))
        return 
true;
    return 
false;

szogun is offline
 


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 20:06.


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