New Member
|
02-26-2011
, 11:19
Error Compiling Plugin
|
#1
|
I'm trying to get this plugin to compile, but I keep getting a bunch of errors. Basically what this plugin does is it makes the say_team function appear to everyone and they're able to talk to each other through the server. Then the say function is limited with a range. You can also turn off the say_team function by a cvar command. Well here is the code and errors.
Code:
#include <amxmisc>
#include <engine>
#include <fun>
#include <dbi>
#include <tsx>
public plugin_init() {
register_plugin("NRP Chat","1.0","Harbu")
register_clcmd("say_team","handle_teamsay")
register_clcmd("say","handle_say")
register_cvar("sv_ooc","1")
register_cvar("sv_cnn","1")
}
public handle_teamsay(id)
{
new Speech[300]
read_args(Speech, 299)
remove_quotes(Speech)
if(equali(Speech,"")) return PLUGIN_HANDLED
new name[33]
get_user_name(id,name,sizeof(name))
if(get_cvar_num("sv_ooc") <= 0) {
client_print(id,print_chat,"[TalkArea] OOC is currently Disabled!^n")
return PLUGIN_HANDLED
}
trim(Speech)
format(Speech,299,"^n%s: (( %s ))^n",name,Speech)
remove_quotes(Speech)
client_print(id,print_chat,Speech)
overhear(id,-1,Speech,0,1,0)
return PLUGIN_HANDLED
}
public handle_say(id)
{
new Speech[300], arg[32], arg2[32]
read_args(Speech, 299)
remove_quotes(Speech)
if(equali(Speech,"")) return PLUGIN_HANDLED
parse(Speech,arg,31,arg2,31)
new name[33]
get_user_name(id,name,sizeof(name))
if(equali(Speech,"ooc",3)) // Out of Character, Everyone will hear it!
{
if(get_cvar_num("sv_ooc") <= 0) {
client_print(id,print_chat,"[TalkArea] OOC is currently Disabled!^n")
return PLUGIN_HANDLED
}
replace(Speech,299,"ooc","")
trim(Speech)
format(Speech,299,"^n%s: (( %s ))^n",name,Speech)
remove_quotes(Speech)
client_print(id,print_chat,Speech)
overhear(id,-1,Speech,0,1,0)
if( get_cvar_num( "rp_printconsole" ) == 1 ) server_print( Speech )
return PLUGIN_HANDLED
}
if(equali(Speech,"/me",3)) // And ME Action similar to IRC (Harbu eats a carrot)
{
if(!is_user_alive(id)) return PLUGIN_HANDLED
replace(Speech,299,"/me","")
trim(Speech)
format(Speech,299,"^n(Action) %s %s^n",name,Speech)
remove_quotes(Speech)
client_print(id,print_chat,Speech)
overhear(id,400,Speech,0,0,0)
if( get_cvar_num( "rp_printconsole" ) == 1 ) server_print( Speech )
return PLUGIN_HANDLED
}
if(equali(Speech,"cnn",3)) // Used for news flashes
{
if(g_cnntime[id] == 1) {
client_print(id,print_chat,"[TalkArea] Wait a while before sending a new CNN message!^n")
return PLUGIN_HANDLED
}
if(get_cvar_num("sv_cnn") <= 0) {
client_print(id,print_chat,"[TalkArea] CNN is currently Disabled!^n")
return PLUGIN_HANDLED
}
replace(Speech,299,"cnn","")
trim(Speech)
format(Speech,299,"^n<NEWSFLASH> - %s: (( %s ))^n",name,Speech)
remove_quotes(Speech)
client_print(id,print_chat,Speech)
overhear(id,-1,Speech,1,1,0)
client_cmd(id,"speak ^"fvox/alert^"")
g_cnntime[id] = 1
if( get_cvar_num( "rp_printconsole" ) == 1 ) server_print( Speech )
return PLUGIN_HANDLED
}
if(equali(Speech,"shout",5)) // Shouting messages cover a large distance
{
if(!is_user_alive(id)) return PLUGIN_HANDLED
replace(Speech,299,"shout","")
trim(Speech)
strtoupper(Speech)
format(Speech,299,"^n(Shout) %s: %s^n",name,Speech)
remove_quotes(Speech)
client_print(id,print_chat,Speech)
overhear(id,800,Speech,0,0,0)
if( get_cvar_num( "rp_printconsole" ) == 1 ) server_print( Speech )
return PLUGIN_HANDLED
}
if(equali(Speech,"quiet",5)) // Quiet messages can only be heard by people next to you
{
if(!is_user_alive(id)) return PLUGIN_HANDLED
replace(Speech,299,"quiet","")
trim(Speech)
strtolower(Speech)
format(Speech,299,"^n(Whisper) %s: %s^n",name,Speech)
remove_quotes(Speech)
client_print(id,print_chat,Speech)
overhear(id,80,Speech,0,0,0)
if( get_cvar_num( "rp_printconsole" ) == 1 ) server_print( Speech )
return PLUGIN_HANDLED
}
if(equali(Speech,"steamid",7)) // Automaticly prints your steamid
{
if(!is_user_alive(id)) return PLUGIN_HANDLED
new authid[32]
get_user_authid(id,authid,31)
format(Speech,299,"^n(SteamID) %s: %s^n",name,authid)
remove_quotes(Speech)
client_print(id,print_chat,Speech)
overhear(id,300,Speech,0,0,0)
if( get_cvar_num( "rp_printconsole" ) == 1 ) server_print( Speech )
return PLUGIN_HANDLED
}
if(equali(Speech,"/com",4)) // Intercom Radio for MCPD and MCMD
{
if(!is_user_alive(id)) return PLUGIN_HANDLED
replace(Speech,299,"/com","")
trim(Speech)
if( get_cvar_num( "rp_capscom" ) == 1 ) strtoupper(Speech)
format(Speech,299,"^n(Intercom) %s: <%s>^n",name,Speech)
remove_quotes(Speech)
com_message(id,Speech)
if( get_cvar_num( "rp_printconsole" ) == 1 ) server_print( Speech )
return PLUGIN_HANDLED
}
if(equali(Speech,"sms",3)) // Text Messages for phone
{
if(!is_user_alive(id)) return PLUGIN_HANDLED
replace(Speech,299,arg2,"")
replace(Speech,299,"sms","")
new target = cmd_target(id,arg2,0)
if(!target) return PLUGIN_HANDLED
format(Speech,299,"^n(SMS) %s:%s^n",name,Speech)
remove_quotes(Speech)
sms_message(id,Speech,target)
if( get_cvar_num( "rp_printconsole" ) == 1 ) server_print( Speech )
return PLUGIN_HANDLED
}
if(equali(Speech,"/phone",6) || equali(Speech,"phone",5) || equali(Speech,"/call",5) || equali(Speech,"/answer",7) || equali(Speech,"/hangup",7))
{
if(!is_user_alive(id)) return PLUGIN_HANDLED
set_weapon_kungfu(id)
set_task(0.1,"Phonemenu",id)
return PLUGIN_HANDLED
}
if(equali(Speech,"advert",6))
{
if(g_adstatus[id] == 1)
{
//Checks to make sure you have not used CNN in 5 seconds.
if(g_cnntime[id] == 0)
{
//If you have not, format it, send it, and reset the array.
g_cnntime[id]= 1
replace(Speech,299,"advert","")
trim(Speech)
format(Speech,299,"(ADVERT) - %s: (( %s ))^n",name,Speech)
remove_quotes(Speech)
client_print(id,print_chat,Speech)
overhear(id,-1,Speech,0,0,1)
if( get_cvar_num( "rp_printconsole" ) == 1 ) server_print( Speech )
return PLUGIN_HANDLED
}
client_print(id,print_chat,"[ADVERTISING] You can't send message now^n")
return PLUGIN_HANDLED
}
else
{
client_print(id,print_chat,"* ADVERTISING IS DISABLED^n")
return PLUGIN_HANDLED
}
}
if(g_phone[id] > 0)
{
if(!is_user_alive(id)) return PLUGIN_HANDLED
new name2[33], Speech2[300]
get_user_name(g_phone[id],name2,sizeof(name2))
format(Speech2,299,"^n(%s's Phone): %s^n",name2,Speech)
client_print(g_phone[id],print_chat,Speech2)
client_print(id,print_chat,"^n%s: %s^n",name,Speech)
format(Speech,299,"^n%s: %s^n",name,Speech)
remove_quotes(Speech)
overhear(id,300,Speech,0,0,0)
overhear(g_phone[id],200,Speech2,0,0,0)
return PLUGIN_HANDLED
}
else
{
if(!is_user_alive(id)) return PLUGIN_HANDLED
format(Speech,299,"^n%s: %s^n",name,Speech)
client_print(id,print_chat,Speech)
overhear(id,300,Speech,0,0,0)
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
Code:
/tmp/text5u9g4E.sma(34) : error 017: undefined symbol "overhear"
/tmp/text5u9g4E.sma(61) : error 017: undefined symbol "overhear"
/tmp/text5u9g4E.sma(75) : error 017: undefined symbol "overhear"
/tmp/text5u9g4E.sma(83) : error 017: undefined symbol "g_cnntime"
/tmp/text5u9g4E.sma(83) : warning 215: expression has no effect
/tmp/text5u9g4E.sma(83) : error 001: expected token: ";", but found "]"
/tmp/text5u9g4E.sma(83) : error 029: invalid expression, assumed zero
/tmp/text5u9g4E.sma(83) : fatal error 107: too many error messages on one line
|
|