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

Disappearing models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
szogun
Senior Member
Join Date: Apr 2016
Old 05-27-2018 , 09:27   Disappearing models
Reply With Quote #1

I have a small problem with the vip plugin.
When a vip player enters the server, the weapon models disappear randomly.


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

#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo =
{
    
name "[CS:GO] VIP",
    
author "xBonio & Avgariat & Vasto_Lorde",
    
description "VIP Generator by cs-plugin.com",
    
version "1.0",
    
url "http://cs-plugin.com"
};

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 Plugin_Continue;
    
CreateTimer(1.0Timer_DelaySpawnGetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
    return 
Plugin_Continue;
}

public 
Action Timer_DelaySpawn(Handle timerany data)
{
    
int client;
    
    if ((
client GetClientOfUserId(data)) == 0)
    {
        return 
Plugin_Stop;
    }
    
    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");
    if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
    
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(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
    if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetHe) < 1GivePlayerItem(client"weapon_hegrenade");
    for(
int x 01x++)
    if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
    if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetFlash) < 1GivePlayerItem(client"weapon_flashbang");
    for(
int x 01x++)
    if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
    if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetSmoke) < 1GivePlayerItem(client"weapon_smokegrenade");
    if(
GetClientTeam(client) == CS_TEAM_CT)
    {
        for(
int x 01x++)                                            // ilosc inc
        
if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0
        if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetInc) < 1GivePlayerItem(client"weapon_incgrenade");
    }
    else if(
GetClientTeam(client) == CS_TEAM_T)
    {
        for(
int x 01x++)
        if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
        if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetMol) < 1GivePlayerItem(client"weapon_molotov");
    }
    
    return 
Plugin_Stop;
}
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);
    if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
    
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);
        if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
        
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
Mitchell
~lick~
Join Date: Mar 2010
Old 05-27-2018 , 10:07   Re: Disappearing models
Reply With Quote #2

You have a ton of copy and paste code that you should look into making one if statement. You're doing a lot of questionable stuff, like why set the value of client in the if statement instead of when you create the variable 2 lines above? And why are you dynamically getting ammo types when you can do it once and write it statically in your plugin as a variable.
Mitchell is offline
szogun
Senior Member
Join Date: Apr 2016
Old 05-27-2018 , 10:09   Re: Disappearing models
Reply With Quote #3

I do not know well about the coding, the vip plugin code was generated on the site, so please help me to make it work properly
szogun 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 03:24.


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