Raised This Month: $ Target: $400
 0% 

Unknown funciton??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bobby3
Member
Join Date: Apr 2011
Old 06-21-2011 , 10:34   Unknown funciton??
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <sqlx>
#include <ammopacks.inc>
#define PLUGIN "BBsql"
#define VERSION "1.0"
#define AUTHOR "Grim"
// Ur Mysql Information
new Host[]     = "localhost"
new User[]    = "root"
new Pass[]     = ""
new Db[]     = "cs"

new Handle:g_SqlTuple
new g_Error[512]

new 
ammopacks[33]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
   
  
   
    
    
set_task(1.0"MySql_Init"// set a task to activate the mysql_init
}
public 
MySql_Init()
{
    
// we tell the API that this is the information we want to connect to,
    // just not yet. basically it's like storing it in global variables
    
g_SqlTuple SQL_MakeDbTuple(Host,User,Pass,Db)
   
    
// ok, we're ready to connect
    
new ErrorCode,Handle:SqlConnection SQL_Connect(g_SqlTuple,ErrorCode,g_Error,charsmax(g_Error))
    if(
SqlConnection == Empty_Handle)
        
// stop the plugin with an error message
        
set_fail_state(g_Error)
       
    new 
Handle:Queries
    
// we must now prepare some random queries
    
Queries SQL_PrepareQuery(SqlConnection,"CREATE TABLE IF NOT EXISTS basebuilders (steamid varchar(32),ammopacks INT(11))")
    if(!
SQL_Execute(Queries))
    {
        
// if there were any problems
        
SQL_QueryError(Queries,g_Error,charsmax(g_Error))
        
set_fail_state(g_Error)
       
    }
    
    
// close the handle
    
SQL_FreeHandle(Queries)
   
    
// you free everything with SQL_FreeHandle
    
SQL_FreeHandle(SqlConnection)   
}
public 
plugin_end()
{
    
// free the tuple - note that this does not close the connection,
    // since it wasn't connected in the first place
    
SQL_FreeHandle(g_SqlTuple)
}
 
 
public 
Load_MySql(id)
{
    new 
szSteamId[32], szTemp[512]
    
get_user_authid(idszSteamIdcharsmax(szSteamId))
    
    new 
Data[1]
    
Data[0] = id
    
    
//we will now select from the table `jailbreak` where the steamid match
    
format(szTemp,charsmax(szTemp),"SELECT * FROM `basebuilders` WHERE (`basebuilders`.`steamid` = '%s')"szSteamId)
    
SQL_ThreadQuery(g_SqlTuple,"register_client",szTemp,Data,1)
}
public 
register_client(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    if(
FailState == TQUERY_CONNECT_FAILED)
    {
        
log_amx("Load - Could not connect to SQL database.  [%d] %s"ErrcodeError)
    }
    else if(
FailState == TQUERY_QUERY_FAILED)
    {
        
log_amx("Load Query failed. [%d] %s"ErrcodeError)
    }
    new 
id
    id 
Data[0]
    
    if(
SQL_NumResults(Query) < 1
    {
        
//.if there are no results found
        
        
new szSteamId[32]
        
get_user_authid(idszSteamIdcharsmax(szSteamId)) // get user's steamid
        
        //  if its still pending we can't do anything with it
        
if (equal(szSteamId,"ID_PENDING"))
            return 
PLUGIN_HANDLED
            
        
new szTemp[512]
        
        
// now we will insturt the values into our table.
        
format(szTemp,charsmax(szTemp),"INSERT INTO `jailbreak` ( `steamid` , `jbpacks`)VALUES ('%s','0');",szSteamId)
        
SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp)
    } 
    else 
    {
        
// if there are results found
        
ammopacks[id]         = SQL_ReadResult(Query1)
 
BB_set_user_ap(id,ammopacks[id]);
    }
    
    return 
PLUGIN_HANDLED
}
public 
Save_MySql(id)
{
 
ammopacks[id]=BB_get_user_ap(id);
    new 
szSteamId[32], szName[32], szTemp[512]
    
get_user_authid(idszSteamIdcharsmax(szSteamId))
    
    
// Here we will update the user hes information in the database where the steamid matches.
    
format(szTemp,charsmax(szTemp),"UPDATE `jailbreak` SET `jbpacks` = '%i' WHERE `jailbreak`.`steamid` = '%s';",ammopacks[id], szSteamId)
    
SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp)
}
 
public 
IgnoreHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    
SQL_FreeHandle(Query)
    
    return 
PLUGIN_HANDLED
}
public 
client_putinserver(id)
{
    
Load_MySql(id)
}
public 
client_disconnect(id)
{
    
Save_MySql(id)

Im getting a wierd error?? in the log...
Quote:
L 06/21/2011 - 15:219: [AMXX] Plugin "bbexp.amxx" failed to load: Plugin uses an unknown function (name "BB_get_user_ap") - check your modules.ini.
Can some1 tell me what the hell is this??
i tried adding ammopacks in modulo.ini...
bobby3 is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 06-21-2011 , 11:07   Re: Unknown funciton??
Reply With Quote #2

remove .inc from #include <ammopacks.inc>
jimaway is offline
bobby3
Member
Join Date: Apr 2011
Old 06-21-2011 , 11:24   Re: Unknown funciton??
Reply With Quote #3

Its the same -.-

Last edited by bobby3; 06-21-2011 at 15:23.
bobby3 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-21-2011 , 12:10   Re: Unknown funciton??
Reply With Quote #4

The plugin/module that handles native "BB_get_user_ap()" isn't running.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
bobby3
Member
Join Date: Apr 2011
Old 06-21-2011 , 15:23   Re: Unknown funciton??
Reply With Quote #5

Quote:
Originally Posted by drekes View Post
The plugin/module that handles native "BB_get_user_ap()" isn't running.
Then how should i fix this problem???
bobby3 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-21-2011 , 15:30   Re: Unknown funciton??
Reply With Quote #6

Quote:
Originally Posted by bobby3 View Post
Then how should i fix this problem???
Get the module or plugin that contains that function and make sure it is running.
__________________
fysiks is online now
bobby3
Member
Join Date: Apr 2011
Old 06-21-2011 , 17:10   Re: Unknown funciton??
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
Get the module or plugin that contains that function and make sure it is running.
Only idiots like me trys to run natives from other plugins which arent activates DAm your good...
bobby3 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 23:30.


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