Raised This Month: $ Target: $400
 0% 

Few questions from idiot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bittersweet
Veteran Member
Join Date: May 2012
Old 10-27-2012 , 09:49   Re: Few questions from idiot
Reply With Quote #1

Quote:
Originally Posted by LambdaLambda View Post
coz i'm idiot. Thanks.

One more, and last one.

IMO, this should check if in table pfield_content is filled in field_11, and if it's client's steamid. And if there is filled in, to get member_id. And then if it has found steamid in there to send as a true, or if not to send as a false. The point is, it doesn't work. It do connects to database etc. And the error console says is "[0] Line 529, testytest.sp::ForumAccount()"
PHP Code:
bool:ForumAccount(client)
{
    if (
IsClientInGame(client))
    {
        new 
String:steamid[50];
        
GetClientAuthString(clientsteamidsizeof(steamid))
        new 
String:sqlstring[200];
        
Format(sqlstringsizeof(sqlstring), "SELECT member_id FROM pfields_content WHERE field_11 = %s "steamid);
        
SQL_LockDatabase(dbconipb);
        new 
Handle:sql SQL_Query(dbconipbsqlstring);
        new 
forumek_bool SQL_GetRowCount(sql);
        
CloseHandle(sql);
        
SQL_UnlockDatabase(dbconipb);
        
        if (
forumek_bool)
        {
            return 
true;
        }
        else
        {
            return 
false;
        }
    }
    
    return 
true;

What's wrong in here?
I think putting single quotes around the %s like this might fix it:

Format(sqlstring, sizeof(sqlstring), "SELECT member_id FROM pfields_content WHERE field_11 = '%s' ", steamid);

Edit: And yes, I mean single quotes ('), not the backtick (`)
__________________
Thank you in advance for your help

My plugins:
[CS:S] BOT Swat | [ANY] CVAR Randomizer | [CS:S] SM CS:S Tag Beta | [CS:S] Bot2Player
Awesome & Crucial plugins by other people:
[CS:S/CS:GO] GunGame | [UMC3] Ultimate Mapchooser | [ANY] Server Crontab | [ANY] SM ForceCamera

Last edited by Bittersweet; 10-27-2012 at 09:54. Reason: clarification
Bittersweet is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 10-31-2012 , 12:45   Re: Few questions from idiot
Reply With Quote #2

Yh, i did that. And it does return nothing. But i'm sure there is in database that steamid, because i was setting it myself.

Edit
is it matter, if the field_11 in table pfields_content is type text, not varchar like it was before?

Last edited by LambdaLambda; 10-31-2012 at 12:47.
LambdaLambda is offline
Bittersweet
Veteran Member
Join Date: May 2012
Old 10-31-2012 , 20:17   Re: Few questions from idiot
Reply With Quote #3

Quote:
Originally Posted by LambdaLambda View Post
Yh, i did that. And it does return nothing. But i'm sure there is in database that steamid, because i was setting it myself.

Edit
is it matter, if the field_11 in table pfields_content is type text, not varchar like it was before?
I'm not sure about that. It may depend on what version of MySQL you are using. I'm using 5.5 and use queries that have the '%s' in them that work. Why don't you give the error output again, and then give that line from the code, so we can look at the code line causing the error.

Edit: And I'm just assuming that field_11 is the name of a field in your table. If the 11th field/column has a different name, try using the actual name where field_11 is in the query.
__________________
Thank you in advance for your help

My plugins:
[CS:S] BOT Swat | [ANY] CVAR Randomizer | [CS:S] SM CS:S Tag Beta | [CS:S] Bot2Player
Awesome & Crucial plugins by other people:
[CS:S/CS:GO] GunGame | [UMC3] Ultimate Mapchooser | [ANY] Server Crontab | [ANY] SM ForceCamera

Last edited by Bittersweet; 10-31-2012 at 20:19.
Bittersweet is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 11-01-2012 , 05:47   Re: Few questions from idiot
Reply With Quote #4

I'm using 5.X, probably 5.2.X, because its IPBoard 3.2.3's database. (not sure right now, would have to check it but my tech guy is offline right now)

The point is, it doesn't shows me any errors. Server just crash or do nothing. It shows me that, something is wrong on this part of code that i gave to you.

Yh, the field_11 is the table's name.

here's how it looks like(screenshot) Click! Click!


Maybe i'll tell you what i wanted to do.


Using script that i gave to you before (Loyality point system) i wanted to make required account on forum, with filled in steam_id to buy a slot.

So i did it like, changed this:
PHP Code:
public MenuRS(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        new 
String:info[32];
        
GetMenuItem(menuparam2infosizeof(info));
        
        new 
lp GetLP(param1)
        
        switch(
StringToInt(info))
        {
            case 
1:
            {
                if (
lp >= price_rs_1day)
                {
                    
RemoveLP(param1price_rs_1day)
                    
GiveRS(param11440);
                    
                    if (
IsClientInGame(param1))
                    {
                        
PrintToChat(param1"\x04[LP]\x01 You have bought RS! If Server is full, connect by console to use your reserved slot.")
                    }
                }
                else 
                {
                    
PrintToChat(param1"\x04[LP]\x01 You have %i lp, but you need %i for 1 Day RS!"lpprice_rs_1day);
                }
            }
            case 
2:........ 
to this:
PHP Code:
public MenuRS(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        new 
String:info[32];
        
GetMenuItem(menuparam2infosizeof(info));
        
        new 
lp GetLP(param1)
        new 
forum ForumAccount(param1)
        
        switch(
StringToInt(info))
        {
            case 
1:
            {
                if (
forum)
                {
                    if (
lp >= price_rs_1day)
                    {
                        
RemoveLP(param1price_rs_1day)
                        
GiveRS(param11440);
                    
                        if (
IsClientInGame(param1))
                        {
                            
PrintToChat(param1"\x04[LP]\x01 You have bought RS! If Server is full, connect by console to use your reserved slot.")
                        }
                    }
                    else 
                    {
                        
PrintToChat(param1"\x04[LP]\x01 You have %i lp, but you need %i for 1 Day RS!"lpprice_rs_1day);
                    }
                }
                else
                {
                    
PrintToChat(param1"You don't have account on our forum, don't you? You need it to buy a slot.");
                }                
            }
            case 
2:........ 
I'm sure it does connect to IPBoard's database, because it doesn't print to console or serverlog any errors about it, it just says that something is wrong in these lines i gave to you.

Was trying few tricks i knew, but i'm shitty scripter and obviously it didn't work.

thanks for your help, btw. ;)

Last edited by LambdaLambda; 11-01-2012 at 05:52.
LambdaLambda is offline
Bittersweet
Veteran Member
Join Date: May 2012
Old 11-01-2012 , 08:57   Re: Few questions from idiot
Reply With Quote #5

Quote:
Originally Posted by LambdaLambda View Post
new forum = ForumAccount(param1)
Sorry my English. Deleting posts from your own thread where you are asking for help seems very foolish...or trollish.
__________________
Thank you in advance for your help

My plugins:
[CS:S] BOT Swat | [ANY] CVAR Randomizer | [CS:S] SM CS:S Tag Beta | [CS:S] Bot2Player
Awesome & Crucial plugins by other people:
[CS:S/CS:GO] GunGame | [UMC3] Ultimate Mapchooser | [ANY] Server Crontab | [ANY] SM ForceCamera
Bittersweet is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 11-01-2012 , 09:26   Re: Few questions from idiot
Reply With Quote #6

Yh, it may look like it. Sorry bout that. I just didn't want to write post under post, so i did join two at one.

But why did you quote this part of the code? IMO, its okay. I said ForumAccount(client) to send true if it has found anything and to send false if it doesn't. So i had to use it in if() to check it in that part i needed it.
LambdaLambda is offline
Bittersweet
Veteran Member
Join Date: May 2012
Old 11-01-2012 , 09:44   Re: Few questions from idiot
Reply With Quote #7

Quote:
Originally Posted by LambdaLambda View Post
Yh, it may look like it. Sorry bout that. I just didn't want to write post under post, so i did join two at one.

But why did you quote this part of the code? IMO, its okay. I said ForumAccount(client) to send true if it has found anything and to send false if it doesn't. So i had to use it in if() to check it in that part i needed it.
Copy & paste the entire code from the plugin in one block.
__________________
Thank you in advance for your help

My plugins:
[CS:S] BOT Swat | [ANY] CVAR Randomizer | [CS:S] SM CS:S Tag Beta | [CS:S] Bot2Player
Awesome & Crucial plugins by other people:
[CS:S/CS:GO] GunGame | [UMC3] Ultimate Mapchooser | [ANY] Server Crontab | [ANY] SM ForceCamera
Bittersweet is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 11-01-2012 , 16:15   Re: Few questions from idiot
Reply With Quote #8

Here we go!

I bet it's one of these silly mistakes.

Edit
Oh my god, sorry bout that. Coz of too much work at one time did upload not that file. In the moment will upload the working .sp file and the .smx compiled on my PC. Again sorry.
Attached Files
File Type: smx slociki.smx (9.8 KB, 60 views)
File Type: sp Get Plugin or Get Source (lp_light.sp - 135 views - 17.3 KB)

Last edited by LambdaLambda; 11-01-2012 at 19:36.
LambdaLambda is offline
Bittersweet
Veteran Member
Join Date: May 2012
Old 11-01-2012 , 19:06   Re: Few questions from idiot
Reply With Quote #9

When I try to compile your .sp, I get this output:
Code:
SourcePawn Compiler 1.4.2
Copyright (c) 1997-2006, ITB CompuPhase, (C)2004-2008 AlliedModders, LLC

D:\MY_PLUGINS\Example Plugins\lp_light.sp(29) : error 017: undefined symbol "LP_VERSION"
D:\MY_PLUGINS\Example Plugins\lp_light.sp(93) : warning 219: local variable "auth" shadows a variable at a preceding level
D:\MY_PLUGINS\Example Plugins\lp_light.sp(100) : error 100: function prototypes do not match
D:\MY_PLUGINS\Example Plugins\lp_light.sp(108) : error 010: invalid function or declaration
D:\MY_PLUGINS\Example Plugins\lp_light.sp(108) : warning 221: label name "Handle" shadows tag name
D:\MY_PLUGINS\Example Plugins\lp_light.sp(108) : warning 203: symbol is never used: "Handle"
D:\MY_PLUGINS\Example Plugins\lp_light.sp(108) : error 010: invalid function or declaration
D:\MY_PLUGINS\Example Plugins\lp_light.sp(108 -- 110) : error 010: invalid function or declaration
D:\MY_PLUGINS\Example Plugins\lp_light.sp(108 -- 110) : fatal error 127: too many error messages on one line

Compilation aborted.
6 Errors.
Those are line numbers in the (). I'm not sure why you aren't seeing these? You should compile on your local computer, and upload the .smx. That way you'll know the code is error free.
__________________
Thank you in advance for your help

My plugins:
[CS:S] BOT Swat | [ANY] CVAR Randomizer | [CS:S] SM CS:S Tag Beta | [CS:S] Bot2Player
Awesome & Crucial plugins by other people:
[CS:S/CS:GO] GunGame | [UMC3] Ultimate Mapchooser | [ANY] Server Crontab | [ANY] SM ForceCamera
Bittersweet is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 11-01-2012 , 19:36   Re: Few questions from idiot
Reply With Quote #10

I'm using my local compiler and it works. You wanted me to upload the code, so i did.

Sorry, did upload wrong file. Now you have it in post #18 working. Really sorry, m8.
LambdaLambda 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 11:43.


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