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

Restrict flag vip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
szogun
Senior Member
Join Date: Apr 2016
Old 02-18-2018 , 07: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
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-19-2018 , 01:26   Re: Restrict flag vip
Reply With Quote #2

Lets start at the top.

Wth are you creating entities on map start to cache offsets?

This probably fails on a real map change.

Set your cache variables to -1. Then get the offset if the variable == -1
__________________
Neuro Toxin 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:46.


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