Raised This Month: $51 Target: $400
 12% 

Check for brush condition before use?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NeonHeights
Member
Join Date: Dec 2012
Old 03-09-2015 , 22:41   Check for brush condition before use?
Reply With Quote #1

Could anyone help me with modifying my server teleport code so that players using the "sm_donatorroom" command must be standing within a func_respawnroom brush in-order for the teleport to take place? & if they arent standing in one, they have a message relayed to them telling them they cannot use the command in that location.


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

new Float:g_SpawnCoordBlue[3] = {384.0, -192.052.0}; 
new 
Float:g_SpawnCoordRed[3] = {384.0192.052.0}; 
new 
Float:g_SkyboxCoord[3] = {736.03296.01844.0}; 
new 
Float:g_PortalRoomCoord[3] = {-3904.00.0, -172.0};
new 
Float:g_DonatorRoomCoord[3] = {1376.02304.04436.0};
new 
Float:g_DoomRoomCoord[3] = {176.00.0292.0};


public 
OnPluginStart() { 
    
RegAdminCmd("sm_spawn"Command_GotoSpawnADMFLAG_GENERIC); 
    
RegAdminCmd("sm_skybox"Command_GotoSkyboxADMFLAG_GENERIC);
    
RegAdminCmd("sm_portalroom"Command_GotoPortalRoomADMFLAG_GENERIC);
    
RegAdminCmd("sm_donatorroom"Command_GotoDonatorRoomADMFLAG_GENERIC);
    
RegAdminCmd("sm_doomroom"Command_GotoDoomRoomADMFLAG_ROOT);
}

public 
Action:Command_GotoSpawn(clientargs) { 
    if (!
IsPlayerAlive(client)) { 
        
ReplyToCommand(client"[SM] You must be alive to use this command."); 
        return 
Plugin_Handled
    }
    if (
GetClientTeam(client) == 2) {
        
TeleportEntity(clientg_SpawnCoordRedNULL_VECTORNULL_VECTOR); 
    } else if (
GetClientTeam(client) == 3) {
        
TeleportEntity(clientg_SpawnCoordBlueNULL_VECTORNULL_VECTOR); 
    }
    return 
Plugin_Handled


public 
Action:Command_GotoSkybox(clientargs) { 
    if (!
IsPlayerAlive(client)) { 
        
ReplyToCommand(client"[SM] You must be alive to use this command."); 
        return 
Plugin_Handled
    } 
    
TeleportEntity(clientg_SkyboxCoordNULL_VECTORNULL_VECTOR); 
    return 
Plugin_Handled
}

public 
Action:Command_GotoPortalRoom(clientargs) { 
    if (!
IsPlayerAlive(client)) { 
        
ReplyToCommand(client"[SM] You must be alive to use this command."); 
        return 
Plugin_Handled
    } 
    
TeleportEntity(clientg_PortalRoomCoordNULL_VECTORNULL_VECTOR); 
    return 
Plugin_Handled
}

public 
Action:Command_GotoDonatorRoom(clientargs) { 
    if (!
IsPlayerAlive(client)) { 
        
ReplyToCommand(client"[SM] You must be alive to use this command."); 
        return 
Plugin_Handled
    } 
    
TeleportEntity(clientg_DonatorRoomCoordNULL_VECTORNULL_VECTOR); 
    return 
Plugin_Handled
}

public 
Action:Command_GotoDoomRoom(clientargs) { 
    if (!
IsPlayerAlive(client)) { 
        
ReplyToCommand(client"[SM] You must be alive to use this command."); 
        return 
Plugin_Handled
    } 
    
TeleportEntity(clientg_DoomRoomCoordNULL_VECTORNULL_VECTOR); 
    return 
Plugin_Handled

__________________
NeonHeights is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 03-10-2015 , 01:20   Re: Check for brush condition before use?
Reply With Quote #2

You need to sdkhook starttouch /endtouch the respawnrooms to track, i dont know if there is a netprop to tell if s player is in one.. Might be a internal function you can call that respects the enabled/disabled/team and such, idk.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
NeonHeights
Member
Join Date: Dec 2012
Old 03-10-2015 , 21:02   Re: Check for brush condition before use?
Reply With Quote #3

Just hooked Touch and EndTouch functions to func_respawnroom brushes. Other then needing to reload the map for the plugin to register the spawns properly, its working well. Thanks!
__________________
NeonHeights 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 09:10.


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