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

plugin compiled, no errors, but not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stuffinator
Junior Member
Join Date: Aug 2010
Location: Germany
Old 07-27-2011 , 09:55   plugin compiled, no errors, but not working
Reply With Quote #1

Hi there,

I tried to made a little test-plugin so I can get used to SourcePawn and how it all works.

The plugin was supposed to do an SQL-Query on playerdeath and look if the player who died has an entry in the database and then type something in the chat depending on the result of the query.

I don't get errors while compiling, the plugin successfully loads, but it doesn't do anything and I don't get any errors.

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

new Handle:dbase

public Plugin:myinfo 
{
    
name "Database-Test",
    
author "author",
    
description "<- Description ->",
    
version "1.0",
    
url "<- URL ->"
}

new const 
String:AUTHMETHOD_RESTRICT[] = "default"

public OnPluginStart()
{
    
CreateAuthMethod(AUTHMETHOD_RESTRICT)
    
decl String:error[255]

    if (
SQL_CheckConfig("smplugins"))
    {
        
dbase SQL_Connect("smplugins"trueerrorsizeof(error))
    }

    if (
dbase == INVALID_HANDLE)
    {
        
LogError("Could not connect to database \"smplugins\": %s"error)
        return
    }
    
    
HookEvent("player_death"EventPlayerDeath)
}

public 
Action:EventPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    
PrintToChatAll("Event-Start")
    new 
client GetClientOfUserId(GetEventInt(event"userid"))
    
    new 
String:QueryStr[512]
    new 
Handle:QueryHndl
    
new String:ClientSteamID[36]
    
    
PrintToChatAll("vor GetClientAuthString")
    
GetClientAuthString(clientClientSteamIDsizeof(ClientSteamID))
    
    
Format(QueryStr,sizeof(QueryStr),"SELECT * FROM Users WHERE STEAMID = '%s'"ClientSteamID); 
    
PrintToChatAll("vor SQL_Query")
    
QueryHndl SQL_Query(dbaseQueryStr)
    
    if (
SQL_FetchRow(QueryHndl))
    {
        
PrintToChatAll("in DB")
    }
    else
    {
        
PrintToChatAll("not in DB")
    }

As you may have noticed I tried to make some chat-output to find out until which line of code it gets until it stops working, but unfortunately I don't get any chat-message at all.

I'm sure it's just a little noob-mistake or something I just don't know yet or I haven't considered...but since there seems to be no way to debug those plugins at runtime (correct me if I'm wrong) and I already spent a few hours trying to figure out why it doesn't work, I would really appreciate every help I can get.

Thanks in advance
Stuffinator is offline
Send a message via ICQ to Stuffinator
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 07-27-2011 , 10:11   Re: plugin compiled, no errors, but not working
Reply With Quote #2

Is the plugin actually running?

Also, you don't need to include <tf2>
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
Stuffinator
Junior Member
Join Date: Aug 2010
Location: Germany
Old 07-27-2011 , 13:02   Re: plugin compiled, no errors, but not working
Reply With Quote #3

Quote:
Originally Posted by Lebson506th View Post
Is the plugin actually running?
Well if I type "sm plugins list" in the console it is listed, if that's what you mean.
Quote:
Originally Posted by Lebson506th View Post
Also, you don't need to include <tf2>
Oh yes, I tried something different before and forgot to take the include out again.
Stuffinator is offline
Send a message via ICQ to Stuffinator
mjmfighter
Member
Join Date: Jun 2010
Old 07-29-2011 , 14:48   Re: plugin compiled, no errors, but not working
Reply With Quote #4

make sure the event is right. Im assuming your making this plugin for tf2. maybe player_death isnt the right event for when a player dies in tf2 (it would make sense that it is, but you never know)
mjmfighter is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-29-2011 , 15:01   Re: plugin compiled, no errors, but not working
Reply With Quote #5

Quote:
Originally Posted by mjmfighter View Post
make sure the event is right. Im assuming your making this plugin for tf2. maybe player_death isnt the right event for when a player dies in tf2 (it would make sense that it is, but you never know)
Yeah, pretty sure it is.
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 01:52.


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