AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Huge Amount of Debugging, Require Assistance (https://forums.alliedmods.net/showthread.php?t=135680)

Sagenth 08-18-2010 15:16

Huge Amount of Debugging, Require Assistance
 
Somebody please help me with the error 017s first
I have spent one and a half days combining bits and pieces of 3 mods.

I made sure I accounted for all the different states, I made sure my calls and variables were spelled the same consistently. I really don't know why I am getting an undefined symbol error on just about everything.

/groups/sourcemod/upload_tmp/textBQbgjr.sp(86) : error 100: function prototypes do not match
/groups/sourcemod/upload_tmp/textBQbgjr.sp(87) : error 017: undefined symbol "OnPlayerDeath"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(97) : error 017: undefined symbol "ReadConfig"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(102) : error 017: undefined symbol "CheckName"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(142) : error 017: undefined symbol "reset_listening"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(148) : error 017: undefined symbol "check_alive"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(152) : error 017: undefined symbol "check_dead"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(160) : error 017: undefined symbol "reset_listening"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(138) : warning 204: symbol is assigned a value that is never used: "dead_talk"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(170) : error 017: undefined symbol "CheckName"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(198) : error 010: invalid function or declaration
/groups/sourcemod/upload_tmp/textBQbgjr.sp(232) : warning 217: loose indentation
/groups/sourcemod/upload_tmp/textBQbgjr.sp(232) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textBQbgjr.sp(232) : error 017: undefined symbol "OnPlayerDeath"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(234) : warning 219: local variable "client" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/textBQbgjr.sp(235) : warning 219: local variable "maxplayers" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/textBQbgjr.sp(236) : warning 219: local variable "dead_talk" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/textBQbgjr.sp(237) : warning 219: local variable "client_team" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/textBQbgjr.sp(285) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textBQbgjr.sp(285) : warning 221: label name "bool" shadows tag name
/groups/sourcemod/upload_tmp/textBQbgjr.sp(285) : error 017: undefined symbol "CheckName"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(299) : warning 225: unreachable code
/groups/sourcemod/upload_tmp/textBQbgjr.sp(299) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textBQbgjr.sp(299) : warning 221: label name "bool" shadows tag name
/groups/sourcemod/upload_tmp/textBQbgjr.sp(299) : error 017: undefined symbol "ReadConfig"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(330) : warning 225: unreachable code
/groups/sourcemod/upload_tmp/textBQbgjr.sp(330) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textBQbgjr.sp(330) : error 017: undefined symbol "check_alive"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(332) : warning 219: local variable "maxplayers" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/textBQbgjr.sp(334) : warning 219: local variable "client_team" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/textBQbgjr.sp(335) : warning 219: local variable "dead_talk" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/textBQbgjr.sp(341) : error 017: undefined symbol "entity_distance_stock"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(390) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textBQbgjr.sp(390) : error 017: undefined symbol "check_dead"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(392) : warning 219: local variable "maxplayers" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/textBQbgjr.sp(394) : warning 219: local variable "client_team" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/textBQbgjr.sp(395) : warning 219: local variable "dead_talk" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/textBQbgjr.sp(443) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textBQbgjr.sp(443) : error 017: undefined symbol "reset_listening"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(445) : warning 219: local variable "maxplayers" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/textBQbgjr.sp(456) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textBQbgjr.sp(456) : warning 221: label name "Float" shadows tag name
/groups/sourcemod/upload_tmp/textBQbgjr.sp(456) : error 017: undefined symbol "entity_distance_stock"
/groups/sourcemod/upload_tmp/textBQbgjr.sp(463) : error 017: undefined symbol "ent1"

467 Lines:
Code:

/*Collected and Merged by Sagenth
August 2010

I saw two plugins that I felt needed to be as one
Oh boi the logic trees
*/

// Developed by <eVa>Dog
// July 2008
// http://www.theville.org
//
// DESCRIPTION:
// This plugin lets players talk to the other side even if all talk is not on
//
// CHANGELOG:
// - 7.5.2008 Version 1.0.100
//  Initial Release'
// - 7.25.2008 Version 1.0.101
//  Add cvar to remove messages
// - 8.25.2008 Version 1.0.102
//  Add cvar to define default status (courtesy of RM Hamster)

/*
  VOICE PROXIMITY
  Created by tehSensei AKA Han [BlackWatch]
  blackwatch.clanservers.com
 
  DESCRIPTION
  This plugin forces voice communication only to players within a certain
  radius of the speaker, which makes it so you cannot communicate to
  players accross the map; but rather within "speaking range," which is a
  distance defined in a cvar. If alltalk is on, players will hear players from
  the opposite team if within proximity, but the dead are silent to them. 
  If alltalk is off, it's the same, except you cannot hear the other
  team.  Likewise, the dead can only talk to other dead.  Only tested in
  Day of Defeat:Source, but I don't see why it wouldn't work in TF2 or CSS.
 
  Credits:
  Wilson [29th ID] original amx script
  k2joyride help with functionality
*/

#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION                "1.1.030"
#define SPEAK_NORMAL                0
#define SPEAK_ALL                2

new Handle:Cvar_Msgs = INVALID_HANDLE
new Handle:Cvar_Def = INVALID_HANDLE
new Handle:Cvar_DeadTalk = INVALID_HANDLE
new Handle:Cvar_Proximity = INVALID_HANDLE

new Handle:Cvar_allprox = INVALID_HANDLE
new Handle:Cvar_distance = INVALID_HANDLE
new Handle:Cvar_interval = INVALID_HANDLE

new cl_AllTalk[65]
new lines = 0
new String:permitted[65]

public Plugin:myinfo =
{
        name = "All-Talk & Team Proximity",
        author = "Sagenth, Original Authors (tehSensei AKA Han [BlackWatch] & <eVa>StrontiumDog & Mister_Magotchi)",
        description = "Allows players to disable alltalk client side & have proximity team talk",
        version = PLUGIN_VERSION,
}

public OnPluginStart()
{       
        CreateConVar("sm_VoiceChat", PLUGIN_VERSION, "SM Voice Chat Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY)
        Cvar_Msgs = CreateConVar("vc_notify", "1", " 0 - disables messages, 1 - chat text message", FCVAR_PLUGIN)
        Cvar_Def = CreateConVar("vc_alltalk", "1", "Sets whether the default for the client is teamtalk or alltalk.", FCVAR_PLUGIN)
        Cvar_DeadTalk = CreateConVar("vc_deadtalk", "1", "Sets enables/disables dead players talking to the living", FCVAR_PLUGIN)
        Cvar_Proximity  = CreateConVar("vc_proximity", "1","Enables Voice Proximity Plugin",FCVAR_PLUGIN)
       
        Cvar_allprox  = CreateConVar("vc_pr_alltalk", "0", "Enables Voice proximity over alltalk aswell, applies alltalk to dead when disabled", FCVAR_PLUGIN)
        Cvar_distance = CreateConVar("vc_pr_distance", "1000","Sets the distance voices can be transmitted",FCVAR_PLUGIN)
        Cvar_interval = CreateConVar("vc_pr_interval",".2","Sets the delay between area checks",FCVAR_PLUGIN)
       
        CreateTimer(GetConVarInt(Cvar_interval) * 1.0, Timer_UpdateListeners, _, TIMER_REPEAT)
       
        RegConsoleCmd("voiceall", admin_talktoserver, " - Lets players talk to the other side even if all talk is not on")
        HookEvent("player_spawn", OnPlayerSpawn)
        HookEvent("player_death", OnPlayerDeath)
}

public OnMapStart()
{
        for(new i = 0; i < lines; i++)
        {
                strcopy(permitted[i], sizeof(permitted[]), "")
        }
        lines = 0
        ReadConfig()
}

public OnClientPutInServer(client)
{
        if ((GetConVarInt(Cvar_Def) && CheckName(client)) || (GetConVarInt(Cvar_Def)))
        {
                cl_AllTalk[client] = 1
                SetClientListeningFlags(client, SPEAK_ALL)
        }
}
public Action:Timer_UpdateListeners(Handle:timer)
{
/*States
=======================
Legend including default values
-----------------
Promiximity On/Off First Bit(1)
Alltalk On/Off Second Bit(11)
Alltalk Proximity On/Off Third Bit(110)
~~~
Client Status Alive/Dead Fourth Bit(1101)
########################
0xxx - Timer Action ends after one operation
1xxx - Timer executes loops
~~~~~~~~~~~
110x - Player talking to Everyone

1111 - Live Player talking to All Players in Range
1011 - Live Player talking only to Team Mates in Range
1001 - Live Player talking to all Team Mates

1110 - Dead Player talking to All Dead Players
10x0 - Dead Player talking only to Dead Team Mates
*/
        if(GetConVarInt(Cvar_Proximity) >= 0)
        {//1xxx
                new maxplayers = GetMaxClients()
                new allprox = GetConVarInt(Cvar_allprox)
                new dead_talk = GetConVarInt(Cvar_DeadTalk)
               
                for (new client = 1; client<=maxplayers; client++)
                {
                        if((cl_AllTalk[client] == 1) && (allprox == 0))
                        {//110x
                                reset_listening(client)
                        }
                        else
                        {
                                if(IsPlayerAlive(client))
                                {//1xx1
                                        check_alive(client)
                                }
                                else
                                {//1xx0
                                        check_dead(client)
                                }
                        }
                }
                if(GetConVarInt(Cvar_Proximity) == 0)
                {//0xxx
                        for (new client = 1; client<=maxplayers; client++)
                        {
                                reset_listening(client)
                        }
                        SetConVarInt(Cvar_Proximity, -1)
                }
        }
}
public Action:admin_talktoserver(client, args)
{       
        new dead_talk = GetConVarInt(Cvar_DeadTalk)
       
        if (CheckName(client))
                if(cl_AllTalk[client] == 1)
                {
                        cl_AllTalk[client] = 0
                        if(((GetConVarInt(Cvar_allprox) == 0) || (GetConVarInt(Cvar_Proximity) == 0)) && (dead_talk == 1))
                        {//100x w/ Dead Talk ON
                                SetClientListeningFlags(client, SPEAK_NORMAL)
                        }
                        if (GetConVarInt(Cvar_Msgs) == 1)
                        {
                                PrintToChat(client,"\x01\x04[SM] Client-Side All Talk disabled. Team Talk Enabled")
                        }
                        return Plugin_Handled
                }
                else if(cl_AllTalk[client] == 0)
                {
                        cl_AllTalk[client] = 1
                        if(((GetConVarInt(Cvar_allprox) == 0) || (GetConVarInt(Cvar_Proximity) == 0)) && (dead_talk == 1))
                        {//110x
                                SetClientListeningFlags(client, SPEAK_ALL)
                        }
                        if (GetConVarInt(Cvar_Msgs) == 1)
                        {
                                PrintToChat(client,"\x01\x04[SM] Client-Side All Talk enabled. Team Talk Disabled")
                        }
                        return Plugin_Handled
                }
        return Plugin_Continue
}9

public OnPlayerSpawn(Handle:event)
{
        new client = GetClientOfUserId(GetEventInt(event, "userid"))
        new maxplayers = GetMaxClients()
        new dead_talk = GetConVarInt(Cvar_DeadTalk)
        new client_team = GetClientTeam(client)
       
        if((GetConVarInt(Cvar_Proximity) != 1) && (dead_talk == 0))
        {
                if(cl_AllTalk[client] == 1)
                {
                        for (new id = 1; id <= maxplayers ; id++)
                        {
                                SetListenOverride(client, id, Listen_Yes)
                        }
                }
                else
                {       
                        for (new id = 1; id <= maxplayers ; id++)
                        {
                                if(client_team == GetClientTeam(id))
                                {
                                        SetListenOverride(client, id, Listen_Yes)
                                }
                                else
                                {
                                        SetListenOverride(client, id, Listen_No)
                                }
                }
        }
}

public OnPlayerDeath(Handle:event)
{
        new client = GetClientOfUserId(GetEventInt(event, "userid"))
        new maxplayers = GetMaxClients()
        new dead_talk = GetConVarInt(Cvar_DeadTalk)
        new client_team = GetClientTeam(client)
       
        if((GetConVarInt(Cvar_Proximity) != 1) && (dead_talk == 0))
        {
                if(cl_AllTalk[client] == 1)
                {
                        for (new id = 1; id <= maxplayers ; id++)
                        {
                                if(IsClientInGame(id) && id != client)
                                {
                                        if(!IsPlayerAlive(id))
                                        {//Dead Player talking to All Dead Players
                                                SetListenOverride(client, id, Listen_Yes)
                                        }
                                        else
                                        {//Not Dead Yet
                                                SetListenOverride(client, id, Listen_No)
                                        }
                                }
                        }
                }
                else
                {       
                        for (new id = 1; id <= maxplayers ; id++)
                        {
                                if(IsClientInGame(id) && id != client)
                                {
                                        if(!IsPlayerAlive(id))
                                        {
                                                if(client_team == GetClientTeam(id))
                                                {//Dead Player talking to Dead Team Mates
                                                        SetListenOverride(client, id, Listen_Yes)
                                                }
                                                else
                                                {//Not the Same Team
                                                        SetListenOverride(client, id, Listen_No)
                                                }
                                        }
                                        else
                                        {//Not Dead Yet
                                                SetListenOverride(client, id, Listen_No)
                                        }
                                }
                        }
                }
        }
}

public bool:CheckName(client)
{
        for (new i = 0; i < lines; i++)
        {
                new String:clientName[64]
                GetClientName(client,clientName,64)
                if(StrContains(clientName, permitted[i], false) != -1)
                {
                        return true
                }       
        }
        return false
}

public bool:ReadConfig()
{
        new String:fileName[128]
       
        BuildPath(Path_SM, fileName, sizeof(fileName), "configs/voice/sm_VoiceChat.cfg")
        new Handle:file = OpenFile(fileName, "rt")
        if (file == INVALID_HANDLE)
        {
                LogError("Could not open config file: %s", fileName)
                return false
        }
        while (!IsEndOfFile(file))
        {
                decl String:line[64]
                if (!ReadFileLine(file, line, sizeof(line)))
                {
                        break
                }
                TrimString(line)
                ReplaceString(line, 64, " ", "")
                if (strlen(line) == 0 || (line[0] == '/' && line[1] == '/'))
                {
                        continue
                }
                strcopy(permitted[lines], sizeof(permitted[]), line)
                lines++
        }
        CloseHandle(file)
        return true
}

public check_alive(client)
{//1xx1
        new maxplayers = GetMaxClients()
        //new allprox = GetConVarInt(Cvar_allprox)
        new client_team = GetClientTeam(client)
        new dead_talk = GetConVarInt(Cvar_DeadTalk)
       
        for (new id = 1; id <= maxplayers ; id++)
        {
                if (IsClientInGame(id) && (id != client))
                {
                        if(entity_distance_stock(client, id) <= GetConVarInt(Cvar_distance))
                        {
                                if(dead_talk == 1)
                                {
                                        if(cl_AllTalk[client] == 1)
                                        {//1111
                                        //Player In Range/ or Dead
                                                SetListenOverride(client, id, Listen_Yes)
                                        }
                                        else if(client_team == GetClientTeam(id))
                                        {//1011
                                        //Team Mate In Range/ or Dead
                                                SetListenOverride(client, id, Listen_Yes)
                                        }
                                        else
                                        {//Not the Same team
                                                SetListenOverride(client, id, Listen_No)
                                        }
                                }
                                else if(IsPlayerAlive(id))
                                {
                                        if(cl_AllTalk[client] == 1)
                                        {//1111
                                        //Live Player In Range
                                                SetListenOverride(client, id, Listen_Yes)
                                        }
                                        else if(client_team == GetClientTeam(id))
                                        {//1011
                                        //Live Team Mate In Range
                                                SetListenOverride(client, id, Listen_Yes)
                                        }
                                        else
                                        {//Not the Same Team
                                                SetListenOverride(client, id, Listen_No)
                                        }
                                }
                                else
                                {//Dead w/ DeadTalk Off
                                        SetListenOverride(client, id, Listen_No)
                                }
                        }
                        else
                        {//Out Of Range
                                SetListenOverride(client, id, Listen_No)
                        }
                }
        }       
}

public check_dead(client)
{//1xx0
        new maxplayers = GetMaxClients()
        //new allprox = GetConVarInt(Cvar_allprox)
        new client_team = GetClientTeam(client)
        new dead_talk = GetConVarInt(Cvar_DeadTalk)
       
        for (new id = 1; id <= maxplayers ; id++)
        {
                if(IsClientInGame(id) && (id != client))
                {
                        if(dead_talk == 1)
                        {
                                if(cl_AllTalk[client] == 1)
                                {//1110
                                //Dead Player talking to Server
                                        SetListenOverride(client, id, Listen_Yes)
                                }
                                else if(client_team == GetClientTeam(id))
                                {//10x0
                                //Dead Player talking to ALL Team Mates
                                        SetListenOverride(client, id, Listen_Yes)
                                }
                                else
                                {//Not the Same Team
                                        SetListenOverride(client, id, Listen_No)
                                }
                        }
                        else if(!IsPlayerAlive(id))
                        {
                                if(cl_AllTalk[client] == 1)
                                {//1110
                                //Dead Player talking to All Dead Players
                                        SetListenOverride(client, id, Listen_Yes)
                                }
                                else if(client_team == GetClientTeam(id))
                                {//10x0
                                //Dead Player talking to Dead Team Mates
                                        SetListenOverride(client, id, Listen_Yes)
                                }
                                else
                                {//Not the Same Team
                                        SetListenOverride(client, id, Listen_No)
                                }
                        }
                        else
                        {//Not Dead Yet
                                SetListenOverride(client, id, Listen_No)
                        }
                }
        }
}

public reset_listening(client)
{
        new maxplayers = GetMaxClients()
        for (new id = 1; id <= maxplayers ; id++)
        {
                if (IsClientInGame(id) && id != client)
                {
                        SetListenOverride(client, id, Listen_Default)
                }
        }

}

stock Float:entity_distance_stock(ent1, ent2)
{
        new Float:orig1[3]
        new Float:orig2[3]
        new orig
 
        orig = FindSendPropOffs("CBasePlayer", "m_vecOrigin")//sm_dump_netprops
        GetEntDataVector(ent1, orig, orig1)
        GetEntDataVector(ent2, orig, orig2)
 
        return GetVectorDistance(orig1, orig2)
}


RedRobster 08-18-2010 15:29

Re: Huge Amount of Debugging, Require Assistance
 
Wrong section :)

Sagenth 08-18-2010 15:53

Re: Huge Amount of Debugging, Require Assistance
 
Okay I found the right section I think, I can't delete this though I don't think.


All times are GMT -4. The time now is 21:59.

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