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

Undefined Symbol Error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mackid
New Member
Join Date: Apr 2012
Old 04-26-2012 , 00:30   Undefined Symbol Error
Reply With Quote #1

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;
}

Last edited by mackid; 04-26-2012 at 00:31.
mackid is offline
psychonic

BAFFLED
Join Date: May 2008
Old 04-26-2012 , 07:10   Re: Undefined Symbol Error
Reply With Quote #2

Code:
#include <sdktools>
psychonic is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 04-26-2012 , 08:40   Re: Undefined Symbol Error
Reply With Quote #3

"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.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
mackid
New Member
Join Date: Apr 2012
Old 04-26-2012 , 10:34   Re: Undefined Symbol Error
Reply With Quote #4

Wow such an easy fix I feel stupid. Thanks for the help!
mackid is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 04-26-2012 , 12:39   Re: Undefined Symbol Error
Reply With Quote #5

Quote:
Originally Posted by mackid View Post
Wow such an easy fix I feel stupid. Thanks for the help!
Don't feel stupid. We all started somewhere. If you haven't found it yet, http://docs.sourcemod.net/api is extremely useful.

Also, wrapping code that you post in [php] tags makes it much easier to read.
__________________
Dr. McKay is offline
mackid
New Member
Join Date: Apr 2012
Old 04-28-2012 , 01:39   Re: Undefined Symbol Error
Reply With Quote #6

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.
mackid is offline
Reply


Thread Tools
Display Modes

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 08:24.


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