View Single Post
bally
Senior Member
Join Date: Aug 2015
Old 12-21-2015 , 13:22   Re: [CS:GO] Random bomb give ?
Reply With Quote #2

Quote:
Originally Posted by valio_skull View Post
I have this plugin that doesn't allow terrorists to plant the bomb until the last minute:
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <cstrike>
#include <sdktools>
#include <sdkhooks>

#define LAST_C4_TIME 60

float g_flNextC4PlantTime;

public 
void OnPluginStart() {
    
HookEvent("round_start"OnRoundStartEventHookMode_Post);
}

public 
void OnRoundStart(Event event, const char[] namebool dontBroadcast) {
    
g_flNextC4PlantTime GetGameTime() + float(GameRules_GetProp("m_iRoundTime") - LAST_C4_TIME);
}

public 
Action OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon, &subtype, &cmdnum, &tickcount, &seedmouse[2])
{
    if (
IsPlayerAlive(client))
    {
        if (
GetEntPropEnt(clientProp_Data"m_hActiveWeapon") == GetPlayerWeaponSlot(clientCS_SLOT_C4) && GetGameTime() < g_flNextC4PlantTime)
        {
            
PrintHintText(client"<font color='00ff00'>You can't plant the bomb until the last minute of the round.</font>");
            if (
buttons IN_ATTACK)
            {
                
buttons &= ~IN_ATTACK;
            }
            if (
buttons IN_USE)
            {
                
buttons &= ~IN_USE;
            }
            if (
GetGameTime() == 60)
            {
                
PrintHintTextToAll("<font color='#00ff00'><b>You can plant the bomb.</b></font>");
            }
        }
    }

But I need it to give the bomb to a random player in the last 60 seconds.
Thanks
EDIT: I need it to announce through PrintHintText who got the bomb
for loop for all client index and GetRandomInt and GiveBomb??
__________________
Perhaps my lack of faith was my undoing,

Last edited by bally; 12-21-2015 at 13:22.
bally is offline