Undefined Symbol Error
I searched on here and on google and I couldn't find a fix that worked for me so I'm posting this here. I'm going through the tutorial for getting started with plugins and I'm getting the following error
/home/groups/sourcemod/upload_tmp/phpiJRzEt.sp(43) : error 017: undefined symbol "SlapPlayer" I'm not sure what is causing this and I've tried reinstalling SM and using the online Compiler. Did the command for this change? Did I make a stupid mistake? Any help would be much appreciated. Also if I have the wrong sub forum let me know and I will gladly move this to wherever this does belong. #include <sourcemod> new Handle:sm_myslap_damage = INVALID_HANDLE public Plugin:myinfo = { name = "My First Plugin", author = "Me", description = "My first plugin ever", version = "1.0.0.0" } public OnPluginStart() { RegAdminCmd("sm_myslap", Command_MySlap, ADMFLAG_SLAY) sm_myslap_damage = CreateConVar("sm_myslap_damage", "5", "Default slap damage") AutoExecConfig(true, "plugin_myslap") } public Action:Command_MySlap(client, args) { new String:arg1[32], String:arg2[32] new damage = GetConVarInt(sm_myslap_damage) // get the first arg GetCmdArg(1,arg1,sizeof(arg1)) //if there are 2 or more args and second fetch is successful convert to int if (args >= 2 && GetCmdArg(2, arg2, sizeof(arg2))) { damage = StringToInt(arg2) } //try and find a matching player new target = FindTarget(client, arg1) if (target == -1) { //auto replies with fail reason return Plugin_Handled; } SlapPlayer(target, damage) new String:name[MAX_NAME_LENGTH] ShowActivity2(client, "[SM] ", "Slapped %s for %d damage!", name, damage) LogAction(client, target, "\"%L\" slapped \"%L\" (damage %d)", client, target, damage) return Plugin_Handled; } |
Re: Undefined Symbol Error
Code:
|
Re: Undefined Symbol Error
"undefined symbol" errors basically mean that the variable or function it tried to use is not known at this point. In this case you forgot to write the include statement which includes this function.
|
Re: Undefined Symbol Error
Wow such an easy fix I feel stupid. Thanks for the help!
|
Re: Undefined Symbol Error
Quote:
Also, wrapping code that you post in [php] tags makes it much easier to read. |
Re: Undefined Symbol Error
Thanks for the tip! I didn't realize one could do that, I'll make sure to do so in the future. Thanks for the link as well I hadn't found that one yet.
|
All times are GMT -4. The time now is 16:10. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.