Raised This Month: $ Target: $400
 0% 

[CS:GO] Zombie Plague 1.2.1 (Updated 01-Mar-2023)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
emialcaraz
Member
Join Date: Oct 2016
Location: Argentina
Old 02-23-2017 , 07:35   Re: [CS:GO] Release: Zombie Plague 6.7
Reply With Quote #11

Hi gubka, will be nice if you can make a countdown for STUCK because people abuses of it.
For example, press STUCK and after 5 or 10 seconds teleport it. Here the code:
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <zombieplague>

#pragma newdecls required

/**
 * Record plugin info.
 **/
public Plugin UnStuck =
{
    
name            "[ZP] Addon: UnStuck",
    
author          "qubka (Nikita Ushakov)",     
    
description     "Addon for unstucking player and teleport them on respawn point",
    
version         "1.0",
    
url             "https://forums.alliedmods.net/showthread.php?t=290657"
}

// Array to store spawn origin
float gOrigin[MAXPLAYERS+1][3];

/**
 * Plugin is loading.
 **/
public void OnPluginStart(/*void*/)
{
    
// Create a command
    
RegConsoleCmd("zstuck"Command_Unstuck"Unstuck player from the another entity.");
    
    
// Hook spawn event
    
    
HookEvent("player_spawn"EventPlayerSpawnEventHookMode_Post);
}

/**
 * Handles the zstuck command. Unstuck player from the another entity.
 * 
 * @param clientIndex        The client index.
 * @param iArguments        The number of arguments that were in the argument string.
 **/ 
public Action Command_Unstuck(int clientIndexint iArguments)
{
    
#pragma unused clientIndex
    
    // Validate client
    
if(!IsPlayerExist(clientIndex))
    {
        return;
    }
    
    
/* 
     * Checks to see if a player would collide with MASK_SOLID. (i.e. they would be stuck)
     * Inflates player mins/maxs a little bit for better protection against sticking.
     * Thanks to Andersso for the basis of this function.
     */
    
    // Initialize vector variables
    
float flOrigin[3];
    
float flMax[3]; 
    
float flMin[3]; 

    
// Get client's location
    
GetClientAbsOrigin(clientIndexflOrigin);
    
    
// Get the client's min and max size vector
    
GetClientMins(clientIndexflMin);
    
GetClientMaxs(clientIndexflMax);

    
// Starts up a new trace hull using a global trace result and a customized trace ray filter
    
TR_TraceHullFilter(flOriginflOriginflMinflMaxMASK_SOLIDFilterStuckclientIndex);

    
// Returns if there was any kind of collision along the trace ray
    
if(TR_DidHit())
    {
        
// Teleport player back on the previus spawn point
        //TeleportEntity(clientIndex, gOrigin[clientIndex], NULL_VECTOR, NULL_VECTOR);
        
CreateTimer(5.0teleportclientIndex);
        
PrintToChat(clientIndex"\x04[ZOMBIE PLAGUE]\x03 in 5 seconds you will be teleported.");
    }
    else
    {
        
// Emit fail sound
        
ClientCommand(clientIndex"play buttons/button11.wav");    
    }
}


public 
Action teleport(Handle hTimerany clientIndex)
{
TeleportEntity(clientIndexgOrigin[clientIndex], NULL_VECTORNULL_VECTOR);

}
/**
 * Event callback (player_spawn)
 * The player is spawning.
 * 
 * @param gEventHook        The event handle.
 * @param gEventName        The name of the event.
 * @dontBroadcast           If true, event is broadcasted to all clients, false if not.
 **/
public Action EventPlayerSpawn(Event gEventHook, const char[] gEventNamebool dontBroadcast)
{
    
// Get real player index from event key
    
int clientIndex GetClientOfUserId(GetEventInt(gEventHook"userid")); 

    
#pragma unused clientIndex
    
    // Validate client
    
if(!IsPlayerExist(clientIndex))
    {
        return;
    }
    
    
// Get client's position
    
GetClientAbsOrigin(clientIndexgOrigin[clientIndex]);
}


/*
 * Trace filtering functions
 */

 
/**
 * Trace filter.
 *
 * @param clientIndex        The client index.
 * @param contentsMask        The contents mask.
 * @param victimIndex        The victim index.
 **/
public bool FilterStuck(int clientIndexint contentsMaskany victimIndex
{
    return (
clientIndex != victimIndex);

I tested that code and works perfectly.

Here i make a new extra item: https://forums.alliedmods.net/showthread.php?t=294249 look it!

Last edited by emialcaraz; 02-23-2017 at 10:35.
emialcaraz is offline
 



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 23:32.


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