AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Compiler won't compile with long string (https://forums.alliedmods.net/showthread.php?t=228739)

Kia 10-26-2013 05:20

Compiler won't compile with long string
 
Hello everyone,

I wanted to add some SQL Stuff to my new plugin, and it worked fine until now, but now I've added two more tables in my SQL Query and now the Compiler gets to 25 % CPU (full single-core), generates a empty .amx file and the compiler screen stays black.

My Code :
PHP Code:

new szTemp[1024]
        
formatex(szTemp,charsmax(szTemp),"INSERT INTO `%s` ( `steamid` , `name` , `pass` , `currency` , `primary_weapon` , `primary_skin` , `primary_magazine`, `primary_bpammo` , `primary_laser` , `secondary_weapon` , `secondary_skin` , `secondary_magazine`, `secondary_bpammo` `secondary_laser` , `hatid` , `playermodel` , `tertiary_skin`) VALUES ('%s','%s','%s','%i','weapon_mp5navy', '0', '30', '60', '0', '0', '0', '0', '0', '0', '0', '1', '1');"Table_UserDataszSteamIdszQuotedNameszQuotedPassSTART_MONEY

Maybe the compiler can't handle a so long string?
If I remove the two new things it compiles fine.

DWIGHTpN 10-26-2013 05:44

Re: Compiler won't compile with long string
 
Try:
Code:

new szTemp[1024]
       
formatex(szTemp,charsmax(szTemp),
            "INSERT INTO `%s` ( `steamid` , `name` , `pass` \
            , `currency` , `primary_weapon` , `primary_skin` , \
            `primary_magazine`, `primary_bpammo` , `primary_laser` \
            , `secondary_weapon` , `secondary_skin` ,\
            `secondary_magazine`, `secondary_bpammo` \
            `secondary_laser` , `hatid` , `playermodel` , `tertiary_skin`) \
            VALUES ('%s','%s','%s','%i','weapon_mp5navy', '0', '30', '60', '0',\
            '0', '0', '0', '0', '0', '0', '1', '1');",
            Table_UserData, szSteamId, szQuotedName, szQuotedPass, START_MONEY)


Shooting King 10-26-2013 05:47

Re: Compiler won't compile with long string
 
Break the string and use add().

TheDS1337 10-26-2013 05:57

Re: Compiler won't compile with long string
 
Well, I had this problem in the past, and I created Thread about it, but now I know who case that, search in your plugin, for long lines and try to break them like DWIGHTpN said

Kia 10-26-2013 06:16

Re: Compiler won't compile with long string
 
I made two strings using add() and now it's working, thanks.

Arkshine 10-26-2013 06:28

Re: Compiler won't compile with long string
 
If you are not afraid to compile things and if for your own use, you may want give a try to compile the compiler. Allowing more characters in one line is easy to change, just a define in a file (don't remember which one).

Kia 10-26-2013 07:37

Re: Compiler won't compile with long string
 
Quote:

Originally Posted by Arkshine (Post 2053075)
If you are not afraid to compile things and if for your own use, you may want give a try to compile the compiler. Allowing more characters in one line is easy to change, just a define in a file (don't remember which one).

Thanks for that suggestion, I think I'll do that.


All times are GMT -4. The time now is 23:14.

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