Звук в начале раунда

Тема в разделе "Запросы", создана пользователем criminalist, 26 янв 2011.

  1. criminalist

    criminalist

    Сообщения:
    191
    Симпатии:
    20
    Вопрос к тем кто уже пишет плагины под соурсмод,
    Мне нужен код который заставит проигрывать звук для терористов в начале раунда,
    думаю для знающих людей не проблему :)
     
  2. fallen1994

    fallen1994

    Сообщения:
    2.347
    Симпатии:
    544
    именно для терров? а что так мало сказал, может там рандомные звуки для них и тд.. )
     
  3. criminalist

    criminalist

    Сообщения:
    191
    Симпатии:
    20
    Нет никаких рандомных звуков только для теров звук sound/vip.wav и все)

    я просто хотел не много доделать пдагин VIP который автор не сможет еще месяц закончить (

    PHP:
    #pragma semicolon 1
    #include <sourcemod>
    #include <sdktools>
    #include <sdkhooks>

    /* Defines */
    #define PLUGIN_VERSION    "1.0g"
    #define DESCRIPTION        "Creates VIP style gameplay on AS_ maps. Protect the VIP, Team :3"

    /* Globals */
    new g_VIPIndex = -1;
    new 
    g_VIPChanceArray[MAXPLAYERS+1];
    new 
    g_VIPLastChosen;
    new 
    g_MoneyInt;

    new 
    String:g_team_list[16][64]; // HLX:CE Support
    new String:Small1[][] = {"models/player/vip/small2/vip.dx80.vtx""models/player/vip/small2/vip.dx90.vtx""models/player/vip/small2/vip.mdl""models/player/vip/small2/vip.phy""models/player/vip/small2/vip.sw.vtx""models/player/vip/small2/vip.vvd""materials/models/player/vip/small1/erdim_cylmap.vmt""materials/models/player/vip/small1/erdim_cylmap.vtf""materials/models/player/vip/small1/erdim_facemap.vmt""materials/models/player/vip/small1/eyeball_l.vmt""materials/models/player/vip/small1/eyeball_l.vtf""materials/models/player/vip/small1/eyeball_r.vmt""materials/models/player/vip/small1/eyeball_r.vtf""materials/models/player/vip/small1/UrbanTemp.vmt""materials/models/player/vip/small1/UrbanTemp.vtf"};
    new 
    String:StaticVIPModel[] = {"models/player/vip/small2/vip.mdl"};

    new 
    bool:g_bTimeChanged;
    new 
    bool:g_bGotResQCoords;
    new 
    bool:g_bRoundEnd;
    new 
    bool:g_bIsModEnabled;
    new 
    bool:g_bInitialized;

    new 
    Float:g_fAddedTime;
    new 
    Float:g_fVIPResQ1Min[3], Float:g_fVIPResQ1Max[3];
    new 
    Float:g_fVIPResQ2Min[3], Float:g_fVIPResQ2Max[3];
    new 
    Float:g_fVIPResQdTele[3];

    new 
    Handle:g_hVIPCoords1        =    INVALID_HANDLE;
    new 
    Handle:g_hVIPCoords2        =    INVALID_HANDLE;
    new 
    Handle:g_hVIPCoordsTele        =    INVALID_HANDLE;
    new 
    Handle:g_hRoundTime            =    INVALID_HANDLE;
    new 
    Handle:g_hRoundTimer        =    INVALID_HANDLE;
    new 
    Handle:g_hFreezeTime        =    INVALID_HANDLE;
    new 
    Handle:g_hTerminateRound    =    INVALID_HANDLE;
    new 
    Handle:g_hGameConfiguration    =    INVALID_HANDLE;

    public 
    Plugin:myinfo =
    {
        
    name         =        "VIPMod",            // http://www.thesixtyone.com/s/KkzxBiqbs4C/
        
    author        =        "Kyle Sanderson"
        
    description    =        DESCRIPTION
        
    version        =        PLUGIN_VERSION
        
    url            =        "http://SourceMod.net"
    };

    public 
    OnConfigsExecuted()
    {
        
    decl String:MapName[64];
        
    GetCurrentMap(MapNamesizeof(MapName));
        if(
    strncmp(MapName"as_"3) != 0)
        {
            return;
        }
        
    VIPMod_Start();
    }

    public 
    OnClientDisconnect(client)
    {
        if(
    client == g_VIPIndex)
        {
            
    PrintToChatAll("\x04[VIPMod]\x03 The VIP (\x04%N\x03) has disconnected."g_VIPIndex);
            
    LogPlyrPlyrEvent(0g_VIPIndex"triggered""VIP_Killed"); // HLX:CE Support
            
    FireRoundEnd(0);
        }
    }

    public 
    VIPMod_Start()
    {
        
    AddCommandListeners(1);
        
    EventHooks(1);
        
    GetTeams();     // HLX:CE Support
        
    SDKHooks(1);
        
    RoundTime(1);
        
    ModelsSounds(1);
        
    CreateTimer(0.4CheckVIPPosition_TIMER_REPEAT TIMER_FLAG_NO_MAPCHANGE);
        
    g_bIsModEnabled true;
        if(!
    g_bInitialized)
        {
            
    InitialStart();
        }
    }

    public 
    InitialStart()
    {
        
    g_hVIPCoords1 CreateConVar("vip_escapezone""0""VIP Rescue Zone"FCVAR_PLUGIN);
        
    g_hVIPCoords2 CreateConVar("vip_escapezone2""0""VIP Rescue Zone2"FCVAR_PLUGIN);
        
    g_hVIPCoordsTele CreateConVar("vip_teleport""0""VIP Teleport"FCVAR_PLUGIN);
        
    CreateConVar("vip_version"PLUGIN_VERSIONDESCRIPTIONFCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
        
    g_hGameConfiguration LoadGameConfigFile("plugin.VIPMod");
        
        
    // Prep the SDKCall for "TerminateRound".
        
    StartPrepSDKCall(SDKCall_GameRules);
        
    PrepSDKCall_SetFromConf(g_hGameConfigurationSDKConf_Signature"TerminateRound");
        
    PrepSDKCall_AddParameter(SDKType_FloatSDKPass_Plain);
        
    PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
        
    g_hTerminateRound EndPrepSDKCall();
        
    g_MoneyInt FindSendPropInfo("CCSPlayer""m_iAccount");
        
    g_bInitialized true;
    }

    public 
    AddCommandListeners(Status)
    {
        switch(
    Status)
        {
            case 
    0:
            {
                
    RemoveCommandListener(RestrictBuyCommand"buy");
                
    RemoveCommandListener(RestrictBuyCommand"autobuy");
                
    RemoveCommandListener(RestrictBuyCommand"rebuy");
            }
            
            case 
    1:
            {
                
    AddCommandListener(RestrictBuyCommand"buy");
                
    AddCommandListener(RestrictBuyCommand"autobuy");
                
    AddCommandListener(RestrictBuyCommand"rebuy");
            }
        }
    }

    public 
    Action:RestrictBuyCommand(client, const String:command[], argc)
    {
        if(
    client == g_VIPIndex)
        {
            
    PrintToChat(client"\x04[VIPMod]\x03 You can't buy anything!");
            return 
    Plugin_Handled;
        }
        return 
    Plugin_Continue;
    }

    public 
    OnMapEnd()
    {
        if(!
    g_bIsModEnabled)
        {
            return;
        }
        
        
    AddCommandListeners(0);
        
    SDKHooks(0);
        
    EventHooks(0);
        
    RoundTime(0);
        
    VipCoordinates(0);
        
    VIPSelection(0);
        
    g_bRoundEnd false;
        
    g_bIsModEnabled false;
    }

    public 
    SDKHooks(Status)
    {
        switch(
    Status)
        {
            case 
    0:
            {
                
    SDKUnhook(FindEntityByClassname(0"cs_player_manager"), SDKHook_ThinkPostCSPlayerManagerThinkPost);
            }
            
            case 
    1:
            {
                
    SDKHook(FindEntityByClassname(0"cs_player_manager"), SDKHook_ThinkPostCSPlayerManagerThinkPost);
            }
        }
    }

    public 
    ModelsSounds(Status)
    {
        switch(
    Status)
        {
            case 
    0:
            {
                
    // Happy Dance!
            
    }
            case 
    1:
            {
                new 
    Size sizeof(Small1)-1;
                for(new 
    ii<=Sizei++)
                {
                    
    AddFileToDownloadsTable(Small1[i]);
                    
    PrecacheModel(Small1[i]);
                }
                
    PrecacheSound("radio/vip.wav");
            }
        }
    }

    public 
    EventHooks(Status)
    {
        switch(
    Status)
        {
            case 
    0:
            {
                
    UnhookEvent("player_death",    OnPlayerDeath,    EventHookMode_Pre);
                
    UnhookEvent("round_start",    OnRoundStart,    EventHookMode_PostNoCopy);
                
    UnhookEvent("round_end",    OnRoundEnd,        EventHookMode_Pre);
            }
            
            case 
    1:
            {
                
    HookEvent("player_death",    OnPlayerDeath,    EventHookMode_Pre);
                
    HookEvent("round_start",    OnRoundStart,    EventHookMode_PostNoCopy);
                
    HookEvent("round_end",        OnRoundEnd,        EventHookMode_Pre);
            }
        }
    }

    public 
    Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
    {
        new 
    killed GetClientOfUserId(GetEventInt(event"userid"));
        if (
    killed == g_VIPIndex)
        {
            new 
    attacker GetClientOfUserId(GetEventInt(event"attacker"));
            
    PrintToChatAll("\x04[VIPMod] %N\x03 has Assassinated the \x04VIP\x03 (\x04%N\x03)."attackerkilled);
            
    LogPlyrPlyrEvent(attackerg_VIPIndex"triggered""VIP_Killed"); // HLX:CE Logging Support
            
    FireRoundEnd(0);
        }
        return 
    Plugin_Continue;
    }

    public 
    FireRoundEnd(Status)
    {
        switch (
    Status)
        {
            case 
    0:
            {
                
    SDKCall(g_hTerminateRound4.02);        // The VIP has been assassinated!
                
    SetCash(2);
            }
            
            case 
    1:
            {
                
    SDKCall(g_hTerminateRound4.01);        // The VIP has escaped!
                
    SetCash(3);
            }
            
            case 
    2:
            {
                
    SDKCall(g_hTerminateRound4.014);    // The VIP has not escaped!
                
    SetCash(2);
            }
        }
    }

    public 
    Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
    {
        if(
    g_VIPIndex != -1)
        {
            
    SDKUnhook(g_VIPIndexSDKHook_OnTakeDamageOnClientTakeDamage); // http://www.thesixtyone.com/s/7kQaXbb9bLT/
            
    SDKUnhook(g_VIPIndexSDKHook_WeaponCanUseOnWeaponCanUse);
        }
        
        if(!
    g_bGotResQCoords)
        {
            
    VipCoordinates(1);
        }
        
    VIPSelection(0);
        
    VIPSelection(1);
        if(
    g_VIPIndex 0)
        
    PrintCenterText(g_VIPIndex"You are the VIP");
        
    CheckTime();
        
    RoundTime(2);
        
    g_bRoundEnd false;
        return 
    Plugin_Continue;
    }

    public 
    SetCash(Status)
    {
        new 
    PlayerAlive;
        switch(
    Status)
        {
            case 
    2:
            {
                for(new 
    1<=MaxClientsi++)
                {
                    if(
    IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 2)
                    {
                        
    PlayerAlive IsPlayerAlive(i);
                        switch(
    PlayerAlive)
                        {
                            case 
    0:
                            {
                                
    SetEntData(ig_MoneyIntGetEntData(ig_MoneyInt4)+15004);
                            }
                            
                            case 
    1:
                            {
                                
    SetEntData(ig_MoneyIntGetEntData(ig_MoneyInt4)+30004);
                            }
                        }
                    }
                }
            }
            case 
    3:
            {
                for(new 
    1<=MaxClientsi++)
                {
                    if(
    IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 3)
                    {
                        
    PlayerAlive IsPlayerAlive(i);
                        switch(
    PlayerAlive)
                        {
                            case 
    0:
                            {
                                
    SetEntData(ig_MoneyIntGetEntData(ig_MoneyInt4)+15004);
                            }
                            
                            case 
    1:
                            {
                                
    SetEntData(ig_MoneyIntGetEntData(ig_MoneyInt4)+30004);
                            }
                        }
                    }
                }
            }
        }
    }

    public 
    Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
    {
        
    g_bRoundEnd true;
        return 
    Plugin_Continue;
    }

    public 
    VIPSelection(Status)
    {
        switch (
    Status)
        {
            case 
    0
            {
                
    g_VIPIndex = -1;
                for (new 
    0<= MaxClientsi++)
                {
                    
    g_VIPChanceArray[i] = 0;
                }
            }
            
            case 
    1:
            {
                new 
    PlayerCount 0;
                if(
    GetRealClientCount(2) <= 1)
                {
                    for (new 
    1i<=MaxClientsi++)
                    {
                        if (
    IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && !IsFakeClient(i) && GetClientTeam(i) == 3)
                        {
                            
    g_VIPChanceArray[PlayerCount] = i;
                            
    PlayerCount++;
                        }
                    }
                    
                    if (
    PlayerCount == 0)
                    {
                        
    g_VIPIndex = -1;
                        
    g_VIPLastChosen = -1;
                        return;
                    }
                    
                    
    g_VIPIndex g_VIPChanceArray[GetRandomInt(0PlayerCount-1)];
                    
    SetVIPPlayer(g_VIPIndex);
                    
    g_VIPLastChosen GetClientUserId(g_VIPIndex);
                    return;
                }

                for (new 
    1i<=MaxClientsi++)
                {
                    if (
    IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && !IsFakeClient(i) && GetClientUserId(i) != g_VIPLastChosen && GetClientTeam(i) == 3)
                    {
                        
    g_VIPChanceArray[PlayerCount] = i;
                        
    PlayerCount++;
                    }
                }
                
                if (
    PlayerCount == 0)
                {
                    
    g_VIPIndex = -1;
                    
    g_VIPLastChosen = -1;
                    return;
                }
                
                
    g_VIPIndex g_VIPChanceArray[GetRandomInt(0PlayerCount-1)];
                
    g_VIPLastChosen GetClientUserId(g_VIPIndex);
                
    SetVIPPlayer(g_VIPIndex);
            }
        }
    }

    public 
    SetVIPPlayer(client)
    {
        
    SetEntProp(clientProp_Send"m_iHealth"200);
        
    SetEntProp(clientProp_Send"m_bHasHelmet"1);
        
    SetEntProp(clientProp_Send"m_ArmorValue"50);
        
    SDKHook(clientSDKHook_WeaponCanUseOnWeaponCanUse);
        if(!
    IsModelPrecached(StaticVIPModel))
        {
            
    ThrowError("You've forgotten to install the base archive!");
            return;
        }
        
    SetEntityModel(clientStaticVIPModel);
    }

    public 
    Action:CheckVIPPosition(Handle:timer)
    {
        if(
    g_VIPIndex <= 0)
        {
            return 
    Plugin_Handled;
        }
        
        if(
    IsClientConnected(g_VIPIndex) && IsClientInGame(g_VIPIndex) && IsPlayerAlive(g_VIPIndex) && !g_bRoundEnd)
        {
            
    decl Float:VIPPos[3];
            
    GetClientAbsOrigin(g_VIPIndexVIPPos);
            if(
    IsPointInLocation(VIPPosg_fVIPResQ1Ming_fVIPResQ1Max))
            {
                if(
    g_fVIPResQdTele[0] != && g_fVIPResQdTele[1] != && g_fVIPResQdTele[2] != 0)
                {
                    
    TeleportEntity(g_VIPIndexg_fVIPResQdTeleNULL_VECTORNULL_VECTOR);
                }
                
    SetEntProp(g_VIPIndexProp_Data"m_MoveType"MOVETYPE_NONE);
                
    SDKHook(g_VIPIndexSDKHook_OnTakeDamageOnClientTakeDamage);
                
    LogPlayerEvent(g_VIPIndex"triggered""VIP_Escaped"); // HLX:CE Logging Support
                
    FireRoundEnd(1);
            }
            if(
    IsPointInLocation(VIPPosg_fVIPResQ2Ming_fVIPResQ2Max))
            {
                if(
    g_fVIPResQdTele[0] != && g_fVIPResQdTele[1] != && g_fVIPResQdTele[2] != 0)
                {
                    
    TeleportEntity(g_VIPIndexg_fVIPResQdTeleNULL_VECTORNULL_VECTOR);
                }
                
    SetEntProp(g_VIPIndexProp_Data"m_MoveType"MOVETYPE_NONE);
                
    SDKHook(g_VIPIndexSDKHook_OnTakeDamageOnClientTakeDamage);
                
    LogPlayerEvent(g_VIPIndex"triggered""VIP_Escaped"); // HLX:CE Logging Support
                
    FireRoundEnd(1);
            }
        }
        return 
    Plugin_Continue;
    }

    public 
    CSPlayerManagerThinkPost(entity)
    {
        if (
    g_VIPIndex != -1)
        {
            if(
    IsClientConnected(g_VIPIndex) && IsClientInGame(g_VIPIndex) && IsPlayerAlive(g_VIPIndex))
            {
                
    SetEntProp(entityProp_Send"m_iPlayerVIP"g_VIPIndex);
            }
        }
    }

    public 
    Action:OnWeaponCanUse(clientweapon)
    {
        
    decl String:WeaponName[14];
        
    GetEdictClassname(weaponWeaponNamesizeof(WeaponName));
        
    ReplaceString(WeaponNamesizeof(WeaponName), "weapon_"""false);
        if(!
    StrEqual(WeaponName"knife") && !StrEqual(WeaponName"usp"))
        {
            return 
    Plugin_Handled;
        }
        return 
    Plugin_Continue;
    }

    public 
    VipCoordinates(Status)
    {
        switch (
    Status)
        {
            case 
    0:
            {
                
    SetConVarString(g_hVIPCoords1"0");
                
    SetConVarString(g_hVIPCoords2"0");
                for(new 
    i<= 2i++)
                {
                    
    g_fVIPResQ1Min[i] = 0.0;
                    
    g_fVIPResQ1Max[i] = 0.0;
                    
    g_fVIPResQ2Min[i] = 0.0;
                    
    g_fVIPResQ2Max[i] = 0.0;
                }
                
    g_bGotResQCoords false;
            }
            
            case 
    1:
            {
                
    g_hVIPCoords1 FindConVar("vip_escapezone");
                if(
    g_hVIPCoords1 != INVALID_HANDLE)
                {
                    
    decl String:Coords1[256], String:VIPCoordsArray1[6][8];
                    
    GetConVarString(g_hVIPCoords1Coords1sizeof(Coords1));
                    
    ReplaceString(Coords1sizeof(Coords1), "  "" ");
                    
    ExplodeString(Coords1" "VIPCoordsArray1sizeof(VIPCoordsArray1), sizeof(VIPCoordsArray1[]));
                    for(new 
    i<= 5i++)
                    {
                        switch(
    i)
                        {
                            case 
    012:
                            {
                                
    g_fVIPResQ1Min[i] = StringToFloat(VIPCoordsArray1[i]);
                            }
                    
                            case 
    345:
                            {
                                
    g_fVIPResQ1Max[i-3] = StringToFloat(VIPCoordsArray1[i]);
                            }
                        }
                    }
                }
        
                
    g_hVIPCoords2 FindConVar("vip_escapezone2");
                if(
    g_hVIPCoords2 != INVALID_HANDLE)
                {
                    
    decl String:Coords2[256], String:VIPCoordsArray2[6][8];
                    
    GetConVarString(g_hVIPCoords2Coords2sizeof(Coords2));
                    
    ReplaceString(Coords2sizeof(Coords2), "  "" ");
                    
    ExplodeString(Coords2" "VIPCoordsArray2sizeof(VIPCoordsArray2), sizeof(VIPCoordsArray2[]));
                    for(new 
    i<= 5i++)
                    {
                        switch(
    i)
                        {
                            case 
    012:
                            {
                                
    g_fVIPResQ2Min[i] = StringToFloat(VIPCoordsArray2[i]);
                            }
                    
                            case 
    345:
                            {
                                
    g_fVIPResQ2Max[i-3] = StringToFloat(VIPCoordsArray2[i]);
                            }
                        }
                    }
                }
        
                
    g_hVIPCoordsTele FindConVar("vip_teleport");
                if(
    g_hVIPCoordsTele != INVALID_HANDLE)
                {
                    
    decl String:CoordsTele[256], String:VIPCoordsTeleArray[3][8];
                    
    GetConVarString(g_hVIPCoordsTeleCoordsTelesizeof(CoordsTele));
                    
    ReplaceString(CoordsTelesizeof(CoordsTele), "  "" ");
                    
    ExplodeString(CoordsTele" "VIPCoordsTeleArraysizeof(VIPCoordsTeleArray), sizeof(VIPCoordsTeleArray[]));
                    for(new 
    i<= 2i++)
                    {
                        
    g_fVIPResQdTele[i] = StringToFloat(VIPCoordsTeleArray[i]);
                    }
                }
        
                if((
    g_fVIPResQ1Min[0] == 0) && (g_fVIPResQ2Min[0] == 0) && (g_fVIPResQ1Min[1] == 0) && (g_fVIPResQ1Max[2] == 0))
                {
                    
    PrintToChatAll("\x04[VIPMod]\x03 Sorry, I was unable to get any rescue coordinates for this map. Bug?");
                    
    PrintToServer("[VIPMod] Sorry, I was unable to get any rescue coordinates for this map. Bug?");
                    return;
                }
                
    g_bGotResQCoords true;
            }
        }
    }

    public 
    RoundTime(Status)
    {
        switch (
    Status)
        {
            case 
    0:
            {
                if(
    g_hRoundTimer != INVALID_HANDLE)
                {
                    
    KillTimer(g_hRoundTimer);
                    
    g_hRoundTimer INVALID_HANDLE;
                }
                
    UnhookConVarChange(g_hRoundTimeOnTimeChange);
                
    UnhookConVarChange(g_hFreezeTimeOnTimeChange);
            }
            
            case 
    1:
            {
                
    g_hRoundTime FindConVar("mp_roundtime");
                
    g_hFreezeTime FindConVar("mp_freezetime");
                
    g_fAddedTime = (GetConVarFloat(g_hRoundTime)*60 GetConVarFloat(g_hFreezeTime));
                
    HookConVarChange(g_hRoundTimeOnTimeChange);
                
    HookConVarChange(g_hFreezeTimeOnTimeChange);
            }
            
            case 
    2:
            {
                if (
    g_hRoundTimer != INVALID_HANDLE)
                {
                    
    KillTimer(g_hRoundTimer);
                    
    g_hRoundTimer INVALID_HANDLE;
                }
                
    g_hRoundTimer CreateTimer(g_fAddedTimeRoundTimeTimer_TIMER_FLAG_NO_MAPCHANGE);
            }
        }
    }

    public 
    OnTimeChange(Handle:cvar, const String:oldvalue[], const String:newvalue[])
    {
        
    g_bTimeChanged true;
    }

    public 
    CheckTime()
    {
        if(
    g_bTimeChanged)
        {
            
    g_fAddedTime = (GetConVarFloat(g_hRoundTime)*60 GetConVarFloat(g_hFreezeTime));
            
    g_bTimeChanged false;
        }
    }

    public 
    Action:RoundTimeTimer(Handle:timer)
    {
        
    LogPlayerEvent(0"triggered""VIP_NotEscaped"); // HLX:CE Logging Support - There's no support for this from Source? o.O
        
    FireRoundEnd(2);
        
    g_hRoundTimer INVALID_HANDLE;
    }

    public 
    Action:OnClientTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
    {
        return 
    Plugin_Handled;
    }

    stock GetRealClientCount(Status)
    {
        new 
    Count;
        switch(
    Status)
        {
            case 
    2:
            {
                for(new 
    1<=MaxClientsi++)
                {
                    if (
    IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == 2)
                    {
                        
    Count++;
                    }
                }
            }
            
            case 
    3:
            {
                for(new 
    1<=MaxClientsi++)
                {
                    if (
    IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == 3)
                    {
                        
    Count++;
                    }
                }
            }
        }
        return 
    Count;
    }

    /* Huge Thanks to Zombie:Reloaded and Richard Helgeby for explaining this to me ages ago */
    bool:IsPointInLocation(Float:point[3], Float:min[3], Float:max[3])
    {
        
    // Cache to avoid re-indexing arrays.
        
    new Float:posX point[0];
        new 
    Float:posY point[1];
        new 
    Float:posZ point[2];
        
    // Check if within x boundaries.
        
    if ((posX >= min[0]) && (posX <= max[0]))
        {
            
    // Check if within y boundaries.
            
    if ((posY >= min[1]) && (posY <= max[1]))
            {
                
    // Check if within x boundaries.
                
    if ((posZ >= min[2]) && (posZ <= max[2]))
                {
                    
    // The point is within the location boundaries.
                    
    return true;
                }
            }
        }
        
        
    // The point is outside the location boundaries.
        
    return false;
    }

    /* HLX:CE Support - Thanks Psychonic! */
    stock GetTeams(bool:insmod false)
    {
        if (!
    insmod)
        {
            new 
    max_teams_count GetTeamCount();
            for (new 
    team_index 0; (team_index max_teams_count); team_index++)
            {
                
    decl Stringteam_name[64];
                
    GetTeamName(team_indexteam_namesizeof(team_name));

                if (
    strcmp(team_name"") != 0)
                {
                    
    g_team_list[team_index] = team_name;
                }
            }
        }
        else
        {
            
    // they really need to get their act together... GetTeamName() would be awesome since they can't even keep their team indexes consistent
            
    decl String:mapname[64];
            
    GetCurrentMap(mapnamesizeof(mapname));
            if (
    strcmp(mapname"ins_karam") == || strcmp(mapname"ins_baghdad") == 0)
            {
                
    g_team_list[1] = "Iraqi Insurgents";
                
    g_team_list[2] = "U.S. Marines";
            }
            else
            {
                
    g_team_list[1] = "U.S. Marines";
                
    g_team_list[2] = "Iraqi Insurgents";
            }
            
    g_team_list[0] = "Unassigned";
            
    g_team_list[3] = "SPECTATOR";
        }
    }

    stock LogPlayerEvent(client, const String:verb[], const String:event[], bool:display_location false, const String:properties[] = "")
    {
        if (
    IsValidPlayer(client))
        {
            
    decl String:player_authid[32];
            if (!
    GetClientAuthString(clientplayer_authidsizeof(player_authid)))
            {
                
    strcopy(player_authidsizeof(player_authid), "UNKNOWN");
            }

            if (
    display_location)
            {
                
    decl Float:player_origin[3];
                
    GetClientAbsOrigin(clientplayer_origin);
                
    LogToGame("\"%N<%d><%s><%s>\" %s \"%s\"%s (position \"%d %d %d\")"clientGetClientUserId(client), player_authidg_team_list[GetClientTeam(client)], verbeventpropertiesRoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2])); 
            }
            else
            {
                
    LogToGame("\"%N<%d><%s><%s>\" %s \"%s\"%s"clientGetClientUserId(client), player_authidg_team_list[GetClientTeam(client)], verbeventproperties); 
            }
        }
    }

    stock LogPlyrPlyrEvent(clientvictim, const String:verb[], const String:event[], bool:display_location false, const String:properties[] = "")
    {
        if (
    IsValidPlayer(client) && IsValidPlayer(victim))
        {
            
    decl String:player_authid[32];
            if (!
    GetClientAuthString(clientplayer_authidsizeof(player_authid)))
            {
                
    strcopy(player_authidsizeof(player_authid), "UNKNOWN");
            }
            
    decl String:victim_authid[32];
            if (!
    GetClientAuthString(victimvictim_authidsizeof(victim_authid)))
            {
                
    strcopy(victim_authidsizeof(victim_authid), "UNKNOWN");
            }
            
            if (
    display_location)
            {
                
    decl Float:player_origin[3];
                
    GetClientAbsOrigin(clientplayer_origin);
                
                
    decl Float:victim_origin[3];
                
    GetClientAbsOrigin(victimvictim_origin);
                
                
    LogToGame("\"%N<%d><%s><%s>\" %s \"%s\" against \"%N<%d><%s><%s>\"%s (position \"%d %d %d\") (victim_position \"%d %d %d\")"clientGetClientUserId(client), player_authidg_team_list[GetClientTeam(client)], verbeventvictimGetClientUserId(victim), victim_authidg_team_list[GetClientTeam(victim)], propertiesRoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); 
            }
            else
            {
                
    LogToGame("\"%N<%d><%s><%s>\" %s \"%s\" against \"%N<%d><%s><%s>\"%s"clientGetClientUserId(client), player_authidg_team_list[GetClientTeam(client)], verbeventvictimGetClientUserId(victim), victim_authidg_team_list[GetClientTeam(victim)], properties); 
            }
        }
    }

    stock IsValidPlayer(client)
    {
        if (
    client && client <= MaxClients && IsClientInGame(client))
        {
            return 
    true;
        }
        return 
    false;
    }
     
  4. maza511

    maza511

    Сообщения:
    927
    Симпатии:
    456
    PHP:
    #pragma semicolon 1 
    #include <sourcemod> 
    #include <sdktools> 
    #include <sdkhooks> 

    /* Defines */ 
    #define PLUGIN_VERSION    "1.0g" 
    #define DESCRIPTION        "Creates VIP style gameplay on AS_ maps. Protect the VIP, Team :3" 

    /* Globals */ 
    new g_VIPIndex = -1
    new 
    g_VIPChanceArray[MAXPLAYERS+1]; 
    new 
    g_VIPLastChosen
    new 
    g_MoneyInt

    new 
    String:g_team_list[16][64]; // HLX:CE Support 
    new String:Small1[][] = {"models/player/vip/small2/vip.dx80.vtx""models/player/vip/small2/vip.dx90.vtx""models/player/vip/small2/vip.mdl""models/player/vip/small2/vip.phy""models/player/vip/small2/vip.sw.vtx""models/player/vip/small2/vip.vvd""materials/models/player/vip/small1/erdim_cylmap.vmt""materials/models/player/vip/small1/erdim_cylmap.vtf""materials/models/player/vip/small1/erdim_facemap.vmt""materials/models/player/vip/small1/eyeball_l.vmt""materials/models/player/vip/small1/eyeball_l.vtf""materials/models/player/vip/small1/eyeball_r.vmt""materials/models/player/vip/small1/eyeball_r.vtf""materials/models/player/vip/small1/UrbanTemp.vmt""materials/models/player/vip/small1/UrbanTemp.vtf"}; 
    new 
    String:StaticVIPModel[] = {"models/player/vip/small2/vip.mdl"}; 

    new 
    bool:g_bTimeChanged
    new 
    bool:g_bGotResQCoords
    new 
    bool:g_bRoundEnd
    new 
    bool:g_bIsModEnabled
    new 
    bool:g_bInitialized

    #define MAX_FILE_LEN 256

    new String:sound[PLATFORM_MAX_PATH] = "vip.wav";

    new 
    Float:g_fAddedTime
    new 
    Float:g_fVIPResQ1Min[3], Float:g_fVIPResQ1Max[3]; 
    new 
    Float:g_fVIPResQ2Min[3], Float:g_fVIPResQ2Max[3]; 
    new 
    Float:g_fVIPResQdTele[3]; 

    new 
    Handle:g_hVIPCoords1        =    INVALID_HANDLE
    new 
    Handle:g_hVIPCoords2        =    INVALID_HANDLE
    new 
    Handle:g_hVIPCoordsTele        =    INVALID_HANDLE
    new 
    Handle:g_hRoundTime            =    INVALID_HANDLE
    new 
    Handle:g_hRoundTimer        =    INVALID_HANDLE
    new 
    Handle:g_hFreezeTime        =    INVALID_HANDLE
    new 
    Handle:g_hTerminateRound    =    INVALID_HANDLE
    new 
    Handle:g_hGameConfiguration    =    INVALID_HANDLE

    public 
    Plugin:myinfo 

        
    name         =        "VIPMod",            // http://www.thesixtyone.com/s/KkzxBiqbs4C/ 
        
    author        =        "Kyle Sanderson",  
        
    description    =        DESCRIPTION,  
        
    version        =        PLUGIN_VERSION,  
        
    url            =        "http://SourceMod.net" 
    }; 

    public 
    OnConfigsExecuted() 

        
    decl String:MapName[64]; 
        
    GetCurrentMap(MapNamesizeof(MapName)); 
        if(
    strncmp(MapName"as_"3) != 0
        { 
            return; 
        } 
        
    VIPMod_Start(); 
        
    decl String:buffer[MAX_FILE_LEN];
        
    Format(buffersizeof(buffer), "sound/%s"sound);
        
    AddFileToDownloadsTable(buffer);
        
    PrecacheSound("vip.wav"true);


    public 
    OnClientDisconnect(client

        if(
    client == g_VIPIndex
        { 
            
    PrintToChatAll("\x04[VIPMod]\x03 The VIP (\x04%N\x03) has disconnected."g_VIPIndex); 
            
    LogPlyrPlyrEvent(0g_VIPIndex"triggered""VIP_Killed"); // HLX:CE Support 
            
    FireRoundEnd(0); 
        } 


    public 
    VIPMod_Start() 

        
    AddCommandListeners(1); 
        
    EventHooks(1); 
        
    GetTeams();     // HLX:CE Support 
        
    SDKHooks(1); 
        
    RoundTime(1); 
        
    ModelsSounds(1); 
        
    CreateTimer(0.4CheckVIPPosition_TIMER_REPEAT TIMER_FLAG_NO_MAPCHANGE); 
        
    g_bIsModEnabled true
        if(!
    g_bInitialized
        { 
            
    InitialStart(); 
        } 


    public 
    InitialStart() 

        
    g_hVIPCoords1 CreateConVar("vip_escapezone""0""VIP Rescue Zone"FCVAR_PLUGIN); 
        
    g_hVIPCoords2 CreateConVar("vip_escapezone2""0""VIP Rescue Zone2"FCVAR_PLUGIN); 
        
    g_hVIPCoordsTele CreateConVar("vip_teleport""0""VIP Teleport"FCVAR_PLUGIN); 
        
    CreateConVar("vip_version"PLUGIN_VERSIONDESCRIPTIONFCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY); 
        
    g_hGameConfiguration LoadGameConfigFile("plugin.VIPMod"); 
         
        
    // Prep the SDKCall for "TerminateRound". 
        
    StartPrepSDKCall(SDKCall_GameRules); 
        
    PrepSDKCall_SetFromConf(g_hGameConfigurationSDKConf_Signature"TerminateRound"); 
        
    PrepSDKCall_AddParameter(SDKType_FloatSDKPass_Plain); 
        
    PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain); 
        
    g_hTerminateRound EndPrepSDKCall(); 
        
    g_MoneyInt FindSendPropInfo("CCSPlayer""m_iAccount"); 
        
    g_bInitialized true


    public 
    AddCommandListeners(Status

        switch(
    Status
        { 
            case 
    0
            { 
                
    RemoveCommandListener(RestrictBuyCommand"buy"); 
                
    RemoveCommandListener(RestrictBuyCommand"autobuy"); 
                
    RemoveCommandListener(RestrictBuyCommand"rebuy"); 
            } 
             
            case 
    1
            { 
                
    AddCommandListener(RestrictBuyCommand"buy"); 
                
    AddCommandListener(RestrictBuyCommand"autobuy"); 
                
    AddCommandListener(RestrictBuyCommand"rebuy"); 
            } 
        } 


    public 
    Action:RestrictBuyCommand(client, const String:command[], argc

        if(
    client == g_VIPIndex
        { 
            
    PrintToChat(client"\x04[VIPMod]\x03 You can't buy anything!"); 
            return 
    Plugin_Handled
        } 
        return 
    Plugin_Continue


    public 
    OnMapEnd() 

        if(!
    g_bIsModEnabled
        { 
            return; 
        } 
         
        
    AddCommandListeners(0); 
        
    SDKHooks(0); 
        
    EventHooks(0); 
        
    RoundTime(0); 
        
    VipCoordinates(0); 
        
    VIPSelection(0); 
        
    g_bRoundEnd false
        
    g_bIsModEnabled false


    public 
    SDKHooks(Status

        switch(
    Status
        { 
            case 
    0
            { 
                
    SDKUnhook(FindEntityByClassname(0"cs_player_manager"), SDKHook_ThinkPostCSPlayerManagerThinkPost); 
            } 
             
            case 
    1
            { 
                
    SDKHook(FindEntityByClassname(0"cs_player_manager"), SDKHook_ThinkPostCSPlayerManagerThinkPost); 
            } 
        } 


    public 
    ModelsSounds(Status

        switch(
    Status
        { 
            case 
    0
            { 
                
    // Happy Dance! 
            

            case 
    1
            { 
                new 
    Size sizeof(Small1)-1
                for(new 
    ii<=Sizei++) 
                { 
                    
    AddFileToDownloadsTable(Small1[i]); 
                    
    PrecacheModel(Small1[i]); 
                } 
                
    PrecacheSound("radio/vip.wav"); 
            } 
        } 


    public 
    EventHooks(Status

        switch(
    Status
        { 
            case 
    0
            { 
                
    UnhookEvent("player_death",    OnPlayerDeath,    EventHookMode_Pre); 
                
    UnhookEvent("round_start",    OnRoundStart,    EventHookMode_PostNoCopy); 
                
    UnhookEvent("round_end",    OnRoundEnd,        EventHookMode_Pre); 
            } 
             
            case 
    1
            { 
                
    HookEvent("player_death",    OnPlayerDeath,    EventHookMode_Pre); 
                
    HookEvent("round_start",    OnRoundStart,    EventHookMode_PostNoCopy); 
                
    HookEvent("round_end",        OnRoundEnd,        EventHookMode_Pre); 
            } 
        } 


    public 
    Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast

        new 
    killed GetClientOfUserId(GetEventInt(event"userid")); 
        if (
    killed == g_VIPIndex
        { 
            new 
    attacker GetClientOfUserId(GetEventInt(event"attacker")); 
            
    PrintToChatAll("\x04[VIPMod] %N\x03 has Assassinated the \x04VIP\x03 (\x04%N\x03)."attackerkilled); 
            
    LogPlyrPlyrEvent(attackerg_VIPIndex"triggered""VIP_Killed"); // HLX:CE Logging Support 
            
    FireRoundEnd(0); 
        } 
        return 
    Plugin_Continue


    public 
    FireRoundEnd(Status

        switch (
    Status
        { 
            case 
    0
            { 
                
    SDKCall(g_hTerminateRound4.02);        // The VIP has been assassinated! 
                
    SetCash(2); 
            } 
             
            case 
    1
            { 
                
    SDKCall(g_hTerminateRound4.01);        // The VIP has escaped! 
                
    SetCash(3); 
            } 
             
            case 
    2
            { 
                
    SDKCall(g_hTerminateRound4.014);    // The VIP has not escaped! 
                
    SetCash(2); 
            } 
        } 


    public 
    Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast

        new 
    client GetClientOfUserId(GetEventInt(event"userid"));
        if(
    g_VIPIndex != -1
        { 
            
    SDKUnhook(g_VIPIndexSDKHook_OnTakeDamageOnClientTakeDamage); // http://www.thesixtyone.com/s/7kQaXbb9bLT/ 
            
    SDKUnhook(g_VIPIndexSDKHook_WeaponCanUseOnWeaponCanUse); 
        } 
         
        if(!
    g_bGotResQCoords
        { 
            
    VipCoordinates(1); 
        } 
        
    VIPSelection(0); 
        
    VIPSelection(1); 
        if(
    g_VIPIndex 0
        
    PrintCenterText(g_VIPIndex"You are the VIP"); 
        
    CheckTime(); 
        
    RoundTime(2); 
        
    g_bRoundEnd false;  
        
        if (
    GetClientTeam(client) == 2)
        {
            
    EmitSoundToClient(clientsound);
        } 
        
        return 
    Plugin_Continue;


    public 
    SetCash(Status

        new 
    PlayerAlive
        switch(
    Status
        { 
            case 
    2
            { 
                for(new 
    1<=MaxClientsi++) 
                { 
                    if(
    IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 2
                    { 
                        
    PlayerAlive IsPlayerAlive(i); 
                        switch(
    PlayerAlive
                        { 
                            case 
    0
                            { 
                                
    SetEntData(ig_MoneyIntGetEntData(ig_MoneyInt4)+15004); 
                            } 
                             
                            case 
    1
                            { 
                                
    SetEntData(ig_MoneyIntGetEntData(ig_MoneyInt4)+30004); 
                            } 
                        } 
                    } 
                } 
            } 
            case 
    3
            { 
                for(new 
    1<=MaxClientsi++) 
                { 
                    if(
    IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 3
                    { 
                        
    PlayerAlive IsPlayerAlive(i); 
                        switch(
    PlayerAlive
                        { 
                            case 
    0
                            { 
                                
    SetEntData(ig_MoneyIntGetEntData(ig_MoneyInt4)+15004); 
                            } 
                             
                            case 
    1
                            { 
                                
    SetEntData(ig_MoneyIntGetEntData(ig_MoneyInt4)+30004); 
                            } 
                        } 
                    } 
                } 
            } 
        } 


    public 
    Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast

        
    g_bRoundEnd true
        return 
    Plugin_Continue


    public 
    VIPSelection(Status

        switch (
    Status
        { 
            case 
    0:  
            { 
                
    g_VIPIndex = -1
                for (new 
    0<= MaxClientsi++) 
                { 
                    
    g_VIPChanceArray[i] = 0
                } 
            } 
             
            case 
    1
            { 
                new 
    PlayerCount 0
                if(
    GetRealClientCount(2) <= 1
                { 
                    for (new 
    1i<=MaxClientsi++) 
                    { 
                        if (
    IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && !IsFakeClient(i) && GetClientTeam(i) == 3
                        { 
                            
    g_VIPChanceArray[PlayerCount] = i
                            
    PlayerCount++; 
                        } 
                    } 
                     
                    if (
    PlayerCount == 0
                    { 
                        
    g_VIPIndex = -1
                        
    g_VIPLastChosen = -1
                        return; 
                    } 
                     
                    
    g_VIPIndex g_VIPChanceArray[GetRandomInt(0PlayerCount-1)]; 
                    
    SetVIPPlayer(g_VIPIndex); 
                    
    g_VIPLastChosen GetClientUserId(g_VIPIndex); 
                    return; 
                } 

                for (new 
    1i<=MaxClientsi++) 
                { 
                    if (
    IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && !IsFakeClient(i) && GetClientUserId(i) != g_VIPLastChosen && GetClientTeam(i) == 3
                    { 
                        
    g_VIPChanceArray[PlayerCount] = i
                        
    PlayerCount++; 
                    } 
                } 
                 
                if (
    PlayerCount == 0
                { 
                    
    g_VIPIndex = -1
                    
    g_VIPLastChosen = -1
                    return; 
                } 
                 
                
    g_VIPIndex g_VIPChanceArray[GetRandomInt(0PlayerCount-1)]; 
                
    g_VIPLastChosen GetClientUserId(g_VIPIndex); 
                
    SetVIPPlayer(g_VIPIndex); 
            } 
        } 


    public 
    SetVIPPlayer(client

        
    SetEntProp(clientProp_Send"m_iHealth"200); 
        
    SetEntProp(clientProp_Send"m_bHasHelmet"1); 
        
    SetEntProp(clientProp_Send"m_ArmorValue"50); 
        
    SDKHook(clientSDKHook_WeaponCanUseOnWeaponCanUse); 
        if(!
    IsModelPrecached(StaticVIPModel)) 
        { 
            
    ThrowError("You've forgotten to install the base archive!"); 
            return; 
        } 
        
    SetEntityModel(clientStaticVIPModel); 


    public 
    Action:CheckVIPPosition(Handle:timer

        if(
    g_VIPIndex <= 0
        { 
            return 
    Plugin_Handled
        } 
         
        if(
    IsClientConnected(g_VIPIndex) && IsClientInGame(g_VIPIndex) && IsPlayerAlive(g_VIPIndex) && !g_bRoundEnd
        { 
            
    decl Float:VIPPos[3]; 
            
    GetClientAbsOrigin(g_VIPIndexVIPPos); 
            if(
    IsPointInLocation(VIPPosg_fVIPResQ1Ming_fVIPResQ1Max)) 
            { 
                if(
    g_fVIPResQdTele[0] != && g_fVIPResQdTele[1] != && g_fVIPResQdTele[2] != 0
                { 
                    
    TeleportEntity(g_VIPIndexg_fVIPResQdTeleNULL_VECTORNULL_VECTOR); 
                } 
                
    SetEntProp(g_VIPIndexProp_Data"m_MoveType"MOVETYPE_NONE); 
                
    SDKHook(g_VIPIndexSDKHook_OnTakeDamageOnClientTakeDamage); 
                
    LogPlayerEvent(g_VIPIndex"triggered""VIP_Escaped"); // HLX:CE Logging Support 
                
    FireRoundEnd(1); 
            } 
            if(
    IsPointInLocation(VIPPosg_fVIPResQ2Ming_fVIPResQ2Max)) 
            { 
                if(
    g_fVIPResQdTele[0] != && g_fVIPResQdTele[1] != && g_fVIPResQdTele[2] != 0
                { 
                    
    TeleportEntity(g_VIPIndexg_fVIPResQdTeleNULL_VECTORNULL_VECTOR); 
                } 
                
    SetEntProp(g_VIPIndexProp_Data"m_MoveType"MOVETYPE_NONE); 
                
    SDKHook(g_VIPIndexSDKHook_OnTakeDamageOnClientTakeDamage); 
                
    LogPlayerEvent(g_VIPIndex"triggered""VIP_Escaped"); // HLX:CE Logging Support 
                
    FireRoundEnd(1); 
            } 
        } 
        return 
    Plugin_Continue


    public 
    CSPlayerManagerThinkPost(entity

        if (
    g_VIPIndex != -1
        { 
            if(
    IsClientConnected(g_VIPIndex) && IsClientInGame(g_VIPIndex) && IsPlayerAlive(g_VIPIndex)) 
            { 
                
    SetEntProp(entityProp_Send"m_iPlayerVIP"g_VIPIndex); 
            } 
        } 


    public 
    Action:OnWeaponCanUse(clientweapon

        
    decl String:WeaponName[14]; 
        
    GetEdictClassname(weaponWeaponNamesizeof(WeaponName)); 
        
    ReplaceString(WeaponNamesizeof(WeaponName), "weapon_"""false); 
        if(!
    StrEqual(WeaponName"knife") && !StrEqual(WeaponName"usp")) 
        { 
            return 
    Plugin_Handled
        } 
        return 
    Plugin_Continue


    public 
    VipCoordinates(Status

        switch (
    Status
        { 
            case 
    0
            { 
                
    SetConVarString(g_hVIPCoords1"0"); 
                
    SetConVarString(g_hVIPCoords2"0"); 
                for(new 
    i<= 2i++) 
                { 
                    
    g_fVIPResQ1Min[i] = 0.0
                    
    g_fVIPResQ1Max[i] = 0.0
                    
    g_fVIPResQ2Min[i] = 0.0
                    
    g_fVIPResQ2Max[i] = 0.0
                } 
                
    g_bGotResQCoords false
            } 
             
            case 
    1
            { 
                
    g_hVIPCoords1 FindConVar("vip_escapezone"); 
                if(
    g_hVIPCoords1 != INVALID_HANDLE
                { 
                    
    decl String:Coords1[256], String:VIPCoordsArray1[6][8]; 
                    
    GetConVarString(g_hVIPCoords1Coords1sizeof(Coords1)); 
                    
    ReplaceString(Coords1sizeof(Coords1), "  "" "); 
                    
    ExplodeString(Coords1" "VIPCoordsArray1sizeof(VIPCoordsArray1), sizeof(VIPCoordsArray1[])); 
                    for(new 
    i<= 5i++) 
                    { 
                        switch(
    i
                        { 
                            case 
    012
                            { 
                                
    g_fVIPResQ1Min[i] = StringToFloat(VIPCoordsArray1[i]); 
                            } 
                     
                            case 
    345
                            { 
                                
    g_fVIPResQ1Max[i-3] = StringToFloat(VIPCoordsArray1[i]); 
                            } 
                        } 
                    } 
                } 
         
                
    g_hVIPCoords2 FindConVar("vip_escapezone2"); 
                if(
    g_hVIPCoords2 != INVALID_HANDLE
                { 
                    
    decl String:Coords2[256], String:VIPCoordsArray2[6][8]; 
                    
    GetConVarString(g_hVIPCoords2Coords2sizeof(Coords2)); 
                    
    ReplaceString(Coords2sizeof(Coords2), "  "" "); 
                    
    ExplodeString(Coords2" "VIPCoordsArray2sizeof(VIPCoordsArray2), sizeof(VIPCoordsArray2[])); 
                    for(new 
    i<= 5i++) 
                    { 
                        switch(
    i
                        { 
                            case 
    012
                            { 
                                
    g_fVIPResQ2Min[i] = StringToFloat(VIPCoordsArray2[i]); 
                            } 
                     
                            case 
    345
                            { 
                                
    g_fVIPResQ2Max[i-3] = StringToFloat(VIPCoordsArray2[i]); 
                            } 
                        } 
                    } 
                } 
         
                
    g_hVIPCoordsTele FindConVar("vip_teleport"); 
                if(
    g_hVIPCoordsTele != INVALID_HANDLE
                { 
                    
    decl String:CoordsTele[256], String:VIPCoordsTeleArray[3][8]; 
                    
    GetConVarString(g_hVIPCoordsTeleCoordsTelesizeof(CoordsTele)); 
                    
    ReplaceString(CoordsTelesizeof(CoordsTele), "  "" "); 
                    
    ExplodeString(CoordsTele" "VIPCoordsTeleArraysizeof(VIPCoordsTeleArray), sizeof(VIPCoordsTeleArray[])); 
                    for(new 
    i<= 2i++) 
                    { 
                        
    g_fVIPResQdTele[i] = StringToFloat(VIPCoordsTeleArray[i]); 
                    } 
                } 
         
                if((
    g_fVIPResQ1Min[0] == 0) && (g_fVIPResQ2Min[0] == 0) && (g_fVIPResQ1Min[1] == 0) && (g_fVIPResQ1Max[2] == 0)) 
                { 
                    
    PrintToChatAll("\x04[VIPMod]\x03 Sorry, I was unable to get any rescue coordinates for this map. Bug?"); 
                    
    PrintToServer("[VIPMod] Sorry, I was unable to get any rescue coordinates for this map. Bug?"); 
                    return; 
                } 
                
    g_bGotResQCoords true
            } 
        } 


    public 
    RoundTime(Status

        switch (
    Status
        { 
            case 
    0
            { 
                if(
    g_hRoundTimer != INVALID_HANDLE
                { 
                    
    KillTimer(g_hRoundTimer); 
                    
    g_hRoundTimer INVALID_HANDLE
                } 
                
    UnhookConVarChange(g_hRoundTimeOnTimeChange); 
                
    UnhookConVarChange(g_hFreezeTimeOnTimeChange); 
            } 
             
            case 
    1
            { 
                
    g_hRoundTime FindConVar("mp_roundtime"); 
                
    g_hFreezeTime FindConVar("mp_freezetime"); 
                
    g_fAddedTime = (GetConVarFloat(g_hRoundTime)*60 GetConVarFloat(g_hFreezeTime)); 
                
    HookConVarChange(g_hRoundTimeOnTimeChange); 
                
    HookConVarChange(g_hFreezeTimeOnTimeChange); 
            } 
             
            case 
    2
            { 
                if (
    g_hRoundTimer != INVALID_HANDLE
                { 
                    
    KillTimer(g_hRoundTimer); 
                    
    g_hRoundTimer INVALID_HANDLE
                } 
                
    g_hRoundTimer CreateTimer(g_fAddedTimeRoundTimeTimer_TIMER_FLAG_NO_MAPCHANGE); 
            } 
        } 


    public 
    OnTimeChange(Handle:cvar, const String:oldvalue[], const String:newvalue[]) 

        
    g_bTimeChanged true


    public 
    CheckTime() 

        if(
    g_bTimeChanged
        { 
            
    g_fAddedTime = (GetConVarFloat(g_hRoundTime)*60 GetConVarFloat(g_hFreezeTime)); 
            
    g_bTimeChanged false
        } 


    public 
    Action:RoundTimeTimer(Handle:timer

        
    LogPlayerEvent(0"triggered""VIP_NotEscaped"); // HLX:CE Logging Support - There's no support for this from Source? o.O 
        
    FireRoundEnd(2); 
        
    g_hRoundTimer INVALID_HANDLE


    public 
    Action:OnClientTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype

        return 
    Plugin_Handled


    stock GetRealClientCount(Status

        new 
    Count
        switch(
    Status
        { 
            case 
    2
            { 
                for(new 
    1<=MaxClientsi++) 
                { 
                    if (
    IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == 2
                    { 
                        
    Count++; 
                    } 
                } 
            } 
             
            case 
    3
            { 
                for(new 
    1<=MaxClientsi++) 
                { 
                    if (
    IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == 3
                    { 
                        
    Count++; 
                    } 
                } 
            } 
        } 
        return 
    Count


    /* Huge Thanks to Zombie:Reloaded and Richard Helgeby for explaining this to me ages ago */ 
    bool:IsPointInLocation(Float:point[3], Float:min[3], Float:max[3]) 

        
    // Cache to avoid re-indexing arrays. 
        
    new Float:posX point[0]; 
        new 
    Float:posY point[1]; 
        new 
    Float:posZ point[2]; 
        
    // Check if within x boundaries. 
        
    if ((posX >= min[0]) && (posX <= max[0])) 
        { 
            
    // Check if within y boundaries. 
            
    if ((posY >= min[1]) && (posY <= max[1])) 
            { 
                
    // Check if within x boundaries. 
                
    if ((posZ >= min[2]) && (posZ <= max[2])) 
                { 
                    
    // The point is within the location boundaries. 
                    
    return true
                } 
            } 
        } 
         
        
    // The point is outside the location boundaries. 
        
    return false


    /* HLX:CE Support - Thanks Psychonic! */ 
    stock GetTeams(bool:insmod false

        if (!
    insmod
        { 
            new 
    max_teams_count GetTeamCount(); 
            for (new 
    team_index 0; (team_index max_teams_count); team_index++) 
            { 
                
    decl Stringteam_name[64]; 
                
    GetTeamName(team_indexteam_namesizeof(team_name)); 

                if (
    strcmp(team_name"") != 0
                { 
                    
    g_team_list[team_index] = team_name
                } 
            } 
        } 
        else 
        { 
            
    // they really need to get their act together... GetTeamName() would be awesome since they can't even keep their team indexes consistent 
            
    decl String:mapname[64]; 
            
    GetCurrentMap(mapnamesizeof(mapname)); 
            if (
    strcmp(mapname"ins_karam") == || strcmp(mapname"ins_baghdad") == 0
            { 
                
    g_team_list[1] = "Iraqi Insurgents"
                
    g_team_list[2] = "U.S. Marines"
            } 
            else 
            { 
                
    g_team_list[1] = "U.S. Marines"
                
    g_team_list[2] = "Iraqi Insurgents"
            } 
            
    g_team_list[0] = "Unassigned"
            
    g_team_list[3] = "SPECTATOR"
        } 


    stock LogPlayerEvent(client, const String:verb[], const String:event[], bool:display_location false, const String:properties[] = ""

        if (
    IsValidPlayer(client)) 
        { 
            
    decl String:player_authid[32]; 
            if (!
    GetClientAuthString(clientplayer_authidsizeof(player_authid))) 
            { 
                
    strcopy(player_authidsizeof(player_authid), "UNKNOWN"); 
            } 

            if (
    display_location
            { 
                
    decl Float:player_origin[3]; 
                
    GetClientAbsOrigin(clientplayer_origin); 
                
    LogToGame("\"%N<%d><%s><%s>\" %s \"%s\"%s (position \"%d %d %d\")"clientGetClientUserId(client), player_authidg_team_list[GetClientTeam(client)], verbeventpropertiesRoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]));  
            } 
            else 
            { 
                
    LogToGame("\"%N<%d><%s><%s>\" %s \"%s\"%s"clientGetClientUserId(client), player_authidg_team_list[GetClientTeam(client)], verbeventproperties);  
            } 
        } 


    stock LogPlyrPlyrEvent(clientvictim, const String:verb[], const String:event[], bool:display_location false, const String:properties[] = ""

        if (
    IsValidPlayer(client) && IsValidPlayer(victim)) 
        { 
            
    decl String:player_authid[32]; 
            if (!
    GetClientAuthString(clientplayer_authidsizeof(player_authid))) 
            { 
                
    strcopy(player_authidsizeof(player_authid), "UNKNOWN"); 
            } 
            
    decl String:victim_authid[32]; 
            if (!
    GetClientAuthString(victimvictim_authidsizeof(victim_authid))) 
            { 
                
    strcopy(victim_authidsizeof(victim_authid), "UNKNOWN"); 
            } 
             
            if (
    display_location
            { 
                
    decl Float:player_origin[3]; 
                
    GetClientAbsOrigin(clientplayer_origin); 
                 
                
    decl Float:victim_origin[3]; 
                
    GetClientAbsOrigin(victimvictim_origin); 
                 
                
    LogToGame("\"%N<%d><%s><%s>\" %s \"%s\" against \"%N<%d><%s><%s>\"%s (position \"%d %d %d\") (victim_position \"%d %d %d\")"clientGetClientUserId(client), player_authidg_team_list[GetClientTeam(client)], verbeventvictimGetClientUserId(victim), victim_authidg_team_list[GetClientTeam(victim)], propertiesRoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2]));  
            } 
            else 
            { 
                
    LogToGame("\"%N<%d><%s><%s>\" %s \"%s\" against \"%N<%d><%s><%s>\"%s"clientGetClientUserId(client), player_authidg_team_list[GetClientTeam(client)], verbeventvictimGetClientUserId(victim), victim_authidg_team_list[GetClientTeam(victim)], properties);  
            } 
        } 


    stock IsValidPlayer(client

        if (
    client && client <= MaxClients && IsClientInGame(client)) 
        { 
            return 
    true
        } 
        return 
    false
     
  5. criminalist

    criminalist

    Сообщения:
    191
    Симпатии:
    20
    Сыпет в логи
    PHP:
    L 01/26/2011 16:32:33SourceMod error session started
    L 01
    /26/2011 16:32:33Info (map "as_oilrig_wk") (file "errors_20110126.log")
    L 01/26/2011 16:32:33: [SMNative "GetClientTeam" reportedClient index 0 is invalid
    L 01
    /26/2011 16:32:33: [SMDisplaying call stack trace for plugin "VIPMod.smx":
    L 01/26/2011 16:32:33: [SM]   [0]  Line 274VIPMod.sp::OnRoundStart()
    L 01/26/2011 16:32:45: [SMNative "GetClientTeam" reportedClient index 0 is invalid
    L 01
    /26/2011 16:32:45: [SMDisplaying call stack trace for plugin "VIPMod.smx":
    L 01/26/2011 16:32:45: [SM]   [0]  Line 274VIPMod.sp::OnRoundStart()
    L 01/26/2011 16:33:39: [SMNative "GetClientTeam" reportedClient index 0 is invalid
    L 01
    /26/2011 16:33:39: [SMDisplaying call stack trace for plugin "VIPMod.smx":
    L 01/26/2011 16:33:39: [SM]   [0]  Line 274VIPMod.sp::OnRoundStart()
    L 01/26/2011 16:35:04: [SMNative "GetClientTeam" reportedClient index 0 is invalid
    L 01
    /26/2011 16:35:04: [SMDisplaying call stack trace for plugin "VIPMod.smx":
    L 01/26/2011 16:35:04: [SM]   [0]  Line 274VIPMod.sp::OnRoundStart()

    Еще извиняюсь дико не T а CT должен звук проигратся но думаю тут не особо важно) но все таки не роигрывается звук.
     
    Последнее редактирование: 26 янв 2011
  6. maza511

    maza511

    Сообщения:
    927
    Симпатии:
    456
    Вот урок:
    http://hlmod.ru/forum/stati-i-manualy/2309-uroki-skriptinga-urok-2-sobytiya-events.html
    Вот пример скачки и прокеша звука:
    http://hlmod.ru/forum/zaprosy/2714-admin-connect.html#post14800

    Как мне сказали на alliedmods.net. Ты должен все делать сам!
    Если не умеешь делать - Ты платишь!

    Оффтоп
     
    Andrey нравится это.
  7. criminalist

    criminalist

    Сообщения:
    191
    Симпатии:
    20
    Мдэ, зачем тогда форумы ? )
     
  8. Andrey

    Andrey Администратор

    Сообщения:
    3.234
    Симпатии:
    3.509
    Оффтоп
     
  9. criminalist

    criminalist

    Сообщения:
    191
    Симпатии:
    20
    Я понял вашу политику больше не буду спрашивать и отвечать тоже просто буду читать.

    И да чуть не забыл Тему на форуме переименуйте а то как то она с вашей политикой не сопадает.
     
  10. Andrey

    Andrey Администратор

    Сообщения:
    3.234
    Симпатии:
    3.509
    Оффтоп
     
  11. criminalist

    criminalist

    Сообщения:
    191
    Симпатии:
    20
    Я и делаю сам раз помощи ни какой, займет чуть больше времени но тем не менее.
    На форуме котором такое отношение тоже не особо много толку.
     
  12. fallen1994

    fallen1994

    Сообщения:
    2.347
    Симпатии:
    544
    тогда проваливай отсюда и забудь про этот форум, он не для тебя!
    нашёлся тут король =\
     
  13. ferest2

    ferest2

    Сообщения:
    52
    Симпатии:
    3
    Оффтоп
     
  14. maza511

    maza511

    Сообщения:
    927
    Симпатии:
    456
    Тебе сдесь больше помогли даже чем на alliedmods.net =)))))))))
    http://forums.alliedmods.net/showthread.php?t=148519
     
  15. criminalist

    criminalist

    Сообщения:
    191
    Симпатии:
    20
    Куда мир катится:( спасибо за помощь разобрался сам.
     
  16. criminalist

    criminalist

    Сообщения:
    191
    Симпатии:
    20
    Король тут ты я смотрю умник, указывать будет своим одноклассникам что делать.
     
  17. tooshkan4uk

    tooshkan4uk http://cssrus.ru

    Сообщения:
    423
    Симпатии:
    369
    Оффтоп