Raised This Month: $ Target: $400
 0% 

plugin compiled, no errors, but not working


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 21:30.


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