SHARE
TWEET

WBB_Connect 3.0

Hauke Aug 11th, 2013 347 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // WBB_Connect 3.0 include by Hauke Marquardt alias |-|auke - 11.08.2013
  2. // Developed with the awesome pawn IDE: PAWNit 0.8.9 Beta
  3. // Used plugins: - SyncHTTP by Hauke Marquardt
  4. /*
  5. License:
  6.         This code is free: you can redistribute it and/or modify
  7.         it under the terms of the GNU General Public License as published by
  8.         the Free Software Foundation, either version 3 of the License, or
  9.         (at your option) any later version.
  10.  
  11.         This code is distributed in the hope that it will be useful,
  12.         but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.         GNU General Public License for more details.
  15.  
  16.         You should have received a copy of the GNU General Public License
  17.         along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.         You are not allowed to copy any code from this, into your code without
  19.         naming authors name in credits!
  20.  */
  21.  
  22. #if defined _wbb_connect_included
  23.         #endinput
  24. #endif
  25.  
  26. #if !defined SYNC_HTTP_INCLUDED
  27.         #if !defined HTTP_GET
  28.                 #define HTTP_GET                                                1
  29.         #endif
  30.         #if !defined HTTP_POST
  31.                 #define HTTP_POST                                               2
  32.         #endif
  33.         native SynchronizedHTTP ( URL[ ] , Data[ ] , const Result[] , Length , Method = HTTP_POST , Timeout = 5 , EnableDebug = false );
  34.         #define SYNC_HTTP_INCLUDED
  35. #endif
  36.  
  37. #define _wbb_connect_included
  38.  
  39. #if !defined _samp_included
  40.         #include <a_samp>
  41. #endif
  42.  
  43. #if !defined _h_library_norm_included
  44.         #define PAWN_TYPE_INT                           1
  45.         #define PAWN_TYPE_FLOAT                         2
  46.         #define PAWN_TYPE_ARRAY                         3
  47.         #define _h_library_norm_included
  48. #endif
  49.  
  50. #define WBB_Connect::%0->%1( WBB_%0_%1(
  51. #define Var::%0-> Val_%0_
  52. #define PublicMethod:%1(%2) stock %1(%2)
  53. #define PrivateMethod:%1(%2) %1(%2)
  54. #if !defined LOD_CORE_HEADER_INCLUDED
  55.         #define _:%0,) _:%0)
  56. #endif
  57. #pragma unused SplitResult
  58. #define ConsoleWriteLine(%1) printf ( "\n=== WBB_Connect ===\n%s\n===================%s\n" , %1 )
  59.  
  60. #if !defined WBB_CONNECT_URL_LENGTH
  61.         #define WBB_CONNECT_URL_LENGTH                          128
  62. #endif
  63.  
  64. #if !defined WBB_CONNECT_URL_SUFFIX
  65.         #define WBB_CONNECT_URL_SUFFIX                          "?page=WBB_ConnectAPI"
  66. #endif
  67.  
  68. #if !defined WBB_CONNECT_POST_SIZE
  69.         #define WBB_CONNECT_POST_SIZE                           2048
  70. #endif
  71.  
  72. #if !defined WBB_CONNECT_MAX_POST_SIZE
  73.         #define WBB_CONNECT_MAX_POST_SIZE                       1536
  74. #endif
  75.  
  76. #if !defined WBB_CONNECT_MAX_RESULT_BUFFER
  77.         #define WBB_CONNECT_MAX_RESULT_BUFFER           768
  78. #endif
  79.  
  80. #if !defined WBB_CONNECT_TIMEOUT
  81.         #define WBB_CONNECT_TIMEOUT                                     5
  82. #endif
  83.  
  84. #if defined WBB_CONNECT_ENABLE_DEBUG
  85.         #define WBB_CONNECT_DEBUG_MODE                          1
  86. #else
  87.         #define WBB_CONNECT_DEBUG_MODE                          0
  88. #endif
  89.  
  90. #define USER_GENDER_MALE                                                1
  91. #define USER_GENDER_FEMALE                                              2
  92. #define USER_GENDER_NONE                                                0
  93. #define USER_ALREADY_EXISTS                                             -1
  94. #define EMAIL_ALREADY_EXISTS                                    0
  95.  
  96. enum WBB_Data {
  97.         bool:Initialized = false,
  98.         _:ApiURL[ WBB_CONNECT_URL_LENGTH ],
  99.         _:AuthKey[ 32 ]
  100. }
  101. stock Var::Global->System[ WBB_Data ];
  102.  
  103. PublicMethod:WBB_Initialize ( _:_ApiURL[ WBB_CONNECT_URL_LENGTH ] , _:_AuthKey[ ] ) {
  104.         new subStr[ 8 ];
  105.         strmid ( subStr , _ApiURL , 0 , 7 , sizeof subStr );
  106.         if ( !strcmp ( "http://" , subStr ) )
  107.                 strmid ( _ApiURL , _ApiURL , 7 , strlen ( _ApiURL ) , WBB_CONNECT_URL_LENGTH );
  108.         format ( Var::Global->System[ ApiURL ] , sizeof Var::Global->System[ ApiURL ] , "%s"WBB_CONNECT_URL_SUFFIX , _ApiURL );
  109.         format ( Var::Global->System[ AuthKey ] , sizeof Var::Global->System[ AuthKey ] , _AuthKey );
  110.         new buffer[ 128 ];
  111.         if ( SendAPIRequest ( "function=None" , buffer , sizeof buffer ) ) {
  112.                 Var::Global->System[ Initialized ] = true;
  113.                 ConsoleWriteLine ( "Successfully initialized!" );
  114.                 return true;
  115.         }
  116.         return false;
  117. }
  118.  
  119. PublicMethod:WBB_GetUserName ( _:UserID ) {
  120.         new buffer[ 128 ], postData[ 32 ];
  121.         if ( !Var::Global->System[ Initialized ] ) {
  122.                 ConsoleWriteLine ( "Error: Not initialized" );
  123.                 return buffer;
  124.         }
  125.         format ( postData , sizeof postData , "function=GetUserName&id=%d" , UserID );
  126.         SendAPIRequest ( postData , buffer , sizeof buffer );
  127.         return buffer;
  128. }
  129.  
  130. PublicMethod:WBB_GetUserID ( _:UserName[ ] ) {
  131.         if ( !Var::Global->System[ Initialized ] ) {
  132.                 ConsoleWriteLine ( "Error: Not initialized" );
  133.                 return 0;
  134.         }
  135.         new buffer[ 128 ], postData[ 64 ];
  136.         format ( postData , sizeof postData , "function=GetUserID&name=%s" , UserName );
  137.         SendAPIRequest ( postData , buffer , sizeof buffer );
  138.         return strval(buffer);
  139. }
  140.  
  141. PublicMethod:WBB_AddUserActivityPoints ( _:UserID , _:ActivityPoints ) {
  142.         if ( !Var::Global->System[ Initialized ] ) {
  143.                 ConsoleWriteLine ( "Error: Not initialized" );
  144.                 return false;
  145.         }
  146.         new buffer[ 128 ], postData[ 64 ];
  147.         format ( postData , sizeof postData , "function=AddUserActivityPoints&id=%d&activityPoints=%d" , UserID , ActivityPoints );
  148.         SendAPIRequest ( postData , buffer , sizeof buffer );
  149.         return true;
  150. }
  151.  
  152. PublicMethod:WBB_AddUserToGroup ( _:UserID , _:GroupID ) {
  153.         if ( !Var::Global->System[ Initialized ] ) {
  154.                 ConsoleWriteLine ( "Error: Not initialized" );
  155.                 return false;
  156.         }
  157.         new buffer[ 128 ], postData[ 64 ];
  158.         format ( postData , sizeof postData , "function=AddUserToGroup&id=%d&group=%d" , UserID , GroupID );
  159.         SendAPIRequest ( postData , buffer , sizeof buffer );
  160.         return true;
  161. }
  162.  
  163. PublicMethod:WBB_BanUser ( _:UserID , _:Reason[ ] ) {
  164.         if ( !Var::Global->System[ Initialized ] ) {
  165.                 ConsoleWriteLine ( "Error: Not initialized" );
  166.                 return false;
  167.         }
  168.         new buffer[ 128 ], postData[ 64 ];
  169.         format ( postData , sizeof postData , "function=BanUser&id=%d&reason=%s" , UserID , Reason );
  170.         SendAPIRequest ( postData , buffer , sizeof buffer );
  171.         return true;
  172. }
  173.  
  174. PublicMethod:WBB_UnbanUser ( _:UserID ) {
  175.         if ( !Var::Global->System[ Initialized ] ) {
  176.                 ConsoleWriteLine ( "Error: Not initialized" );
  177.                 return false;
  178.         }
  179.         new buffer[ 128 ], postData[ 64 ];
  180.         format ( postData , sizeof postData , "function=UnbanUser&id=%d" , UserID );
  181.         SendAPIRequest ( postData , buffer , sizeof buffer );
  182.         return true;
  183. }
  184.  
  185. PublicMethod:WBB_CheckUserPassword ( _:UserID , _:Password[ ] ) {
  186.         if ( !Var::Global->System[ Initialized ] ) {
  187.                 ConsoleWriteLine ( "Error: Not initialized" );
  188.                 return false;
  189.         }
  190.         new buffer[ 128 ], postData[ 128 ];
  191.         format ( postData , sizeof postData , "function=CheckUserPassword&id=%d&password=%s" , UserID , Password );
  192.         SendAPIRequest ( postData , buffer , sizeof buffer );
  193.         return buffer[ 0 ] == '1' ? true : false;
  194. }
  195.  
  196. PublicMethod:WBB_CloseThread ( _:ThreadID ) {
  197.         if ( !Var::Global->System[ Initialized ] ) {
  198.                 ConsoleWriteLine ( "Error: Not initialized" );
  199.                 return false;
  200.         }
  201.         new buffer[ 128 ], postData[ 64 ];
  202.         format ( postData , sizeof postData , "function=CloseThread&id=%d" , ThreadID );
  203.         SendAPIRequest ( postData , buffer , sizeof buffer );
  204.         return true;
  205. }
  206.  
  207. PublicMethod:WBB_OpenThread ( _:ThreadID ) {
  208.         if ( !Var::Global->System[ Initialized ] ) {
  209.                 ConsoleWriteLine ( "Error: Not initialized" );
  210.                 return false;
  211.         }
  212.         new buffer[ 128 ], postData[ 64 ];
  213.         format ( postData , sizeof postData , "function=OpenThread&id=%d" , ThreadID );
  214.         SendAPIRequest ( postData , buffer , sizeof buffer );
  215.         return true;
  216. }
  217.  
  218. PublicMethod:WBB_StickThread ( _:ThreadID ) {
  219.         if ( !Var::Global->System[ Initialized ] ) {
  220.                 ConsoleWriteLine ( "Error: Not initialized" );
  221.                 return false;
  222.         }
  223.         new buffer[ 128 ], postData[ 64 ];
  224.         format ( postData , sizeof postData , "function=StickThread&id=%d" , ThreadID );
  225.         SendAPIRequest ( postData , buffer , sizeof buffer );
  226.         return true;
  227. }
  228.  
  229. PublicMethod:WBB_UnstickThread ( _:ThreadID ) {
  230.         if ( !Var::Global->System[ Initialized ] ) {
  231.                 ConsoleWriteLine ( "Error: Not initialized" );
  232.                 return false;
  233.         }
  234.         new buffer[ 128 ], postData[ 64 ];
  235.         format ( postData , sizeof postData , "function=UnstickThread&id=%d" , ThreadID );
  236.         SendAPIRequest ( postData , buffer , sizeof buffer );
  237.         return true;
  238. }
  239.  
  240. PublicMethod:WBB_DisableThread ( _:ThreadID ) {
  241.         if ( !Var::Global->System[ Initialized ] ) {
  242.                 ConsoleWriteLine ( "Error: Not initialized" );
  243.                 return false;
  244.         }
  245.         new buffer[ 128 ], postData[ 64 ];
  246.         format ( postData , sizeof postData , "function=DisableThread&id=%d" , ThreadID );
  247.         SendAPIRequest ( postData , buffer , sizeof buffer );
  248.         return true;
  249. }
  250.  
  251. PublicMethod:WBB_EnableThread ( _:ThreadID ) {
  252.         if ( !Var::Global->System[ Initialized ] ) {
  253.                 ConsoleWriteLine ( "Error: Not initialized" );
  254.                 return false;
  255.         }
  256.         new buffer[ 128 ], postData[ 64 ];
  257.         format ( postData , sizeof postData , "function=EnableThread&id=%d" , ThreadID );
  258.         SendAPIRequest ( postData , buffer , sizeof buffer );
  259.         return true;
  260. }
  261.  
  262. PublicMethod:WBB_TrashThread ( _:ThreadID ) {
  263.         if ( !Var::Global->System[ Initialized ] ) {
  264.                 ConsoleWriteLine ( "Error: Not initialized" );
  265.                 return false;
  266.         }
  267.         new buffer[ 128 ], postData[ 64 ];
  268.         format ( postData , sizeof postData , "function=TrashThread&id=%d" , ThreadID );
  269.         SendAPIRequest ( postData , buffer , sizeof buffer );
  270.         return true;
  271. }
  272.  
  273. PublicMethod:WBB_RestoreThread ( _:ThreadID ) {
  274.         if ( !Var::Global->System[ Initialized ] ) {
  275.                 ConsoleWriteLine ( "Error: Not initialized" );
  276.                 return false;
  277.         }
  278.         new buffer[ 128 ], postData[ 64 ];
  279.         format ( postData , sizeof postData , "function=RestoreThread&id=%d" , ThreadID );
  280.         SendAPIRequest ( postData , buffer , sizeof buffer );
  281.         return true;
  282. }
  283.  
  284. PublicMethod:WBB_DeleteThread ( _:ThreadID ) {
  285.         if ( !Var::Global->System[ Initialized ] ) {
  286.                 ConsoleWriteLine ( "Error: Not initialized" );
  287.                 return false;
  288.         }
  289.         new buffer[ 128 ], postData[ 64 ];
  290.         format ( postData , sizeof postData , "function=DeleteThread&id=%d" , ThreadID );
  291.         SendAPIRequest ( postData , buffer , sizeof buffer );
  292.         return true;
  293. }
  294.  
  295. PublicMethod:WBB_DisablePost ( _:PostID ) {
  296.         if ( !Var::Global->System[ Initialized ] ) {
  297.                 ConsoleWriteLine ( "Error: Not initialized" );
  298.                 return false;
  299.         }
  300.         new buffer[ 128 ], postData[ 64 ];
  301.         format ( postData , sizeof postData , "function=DisablePost&id=%d" , PostID );
  302.         SendAPIRequest ( postData , buffer , sizeof buffer );
  303.         return true;
  304. }
  305.  
  306. PublicMethod:WBB_EnablePost ( _:PostID ) {
  307.         if ( !Var::Global->System[ Initialized ] ) {
  308.                 ConsoleWriteLine ( "Error: Not initialized" );
  309.                 return false;
  310.         }
  311.         new buffer[ 128 ], postData[ 64 ];
  312.         format ( postData , sizeof postData , "function=EnablePost&id=%d" , PostID );
  313.         SendAPIRequest ( postData , buffer , sizeof buffer );
  314.         return true;
  315. }
  316.  
  317. PublicMethod:WBB_TrashPost ( _:PostID ) {
  318.         if ( !Var::Global->System[ Initialized ] ) {
  319.                 ConsoleWriteLine ( "Error: Not initialized" );
  320.                 return false;
  321.         }
  322.         new buffer[ 128 ], postData[ 64 ];
  323.         format ( postData , sizeof postData , "function=TrashPost&id=%d" , PostID );
  324.         SendAPIRequest ( postData , buffer , sizeof buffer );
  325.         return true;
  326. }
  327.  
  328. PublicMethod:WBB_RestorePost ( _:PostID ) {
  329.         if ( !Var::Global->System[ Initialized ] ) {
  330.                 ConsoleWriteLine ( "Error: Not initialized" );
  331.                 return false;
  332.         }
  333.         new buffer[ 128 ], postData[ 64 ];
  334.         format ( postData , sizeof postData , "function=RestorePost&id=%d" , PostID );
  335.         SendAPIRequest ( postData , buffer , sizeof buffer );
  336.         return true;
  337. }
  338.  
  339. PublicMethod:WBB_DeletePost ( _:PostID ) {
  340.         if ( !Var::Global->System[ Initialized ] ) {
  341.                 ConsoleWriteLine ( "Error: Not initialized" );
  342.                 return false;
  343.         }
  344.         new buffer[ 128 ], postData[ 64 ];
  345.         format ( postData , sizeof postData , "function=DeletePost&id=%d" , PostID );
  346.         SendAPIRequest ( postData , buffer , sizeof buffer );
  347.         return true;
  348. }
  349.  
  350. PublicMethod:WBB_SetUserBirthday ( _:UserID , _:Day , _:Month , _:Year ) {
  351.         if ( !Var::Global->System[ Initialized ] ) {
  352.                 ConsoleWriteLine ( "Error: Not initialized" );
  353.                 return false;
  354.         }
  355.         new buffer[ 128 ], postData[ 64 ];
  356.         format ( postData , sizeof postData , "function=SetUserBirthday&id=%d&day=%d&month=%d&year=%d" , UserID , Day , Month , Year );
  357.         SendAPIRequest ( postData , buffer , sizeof buffer );
  358.         return true;
  359. }
  360.  
  361. PublicMethod:WBB_SetUserGender ( _:UserID , _:Gender ) {
  362.         if ( !Var::Global->System[ Initialized ] ) {
  363.                 ConsoleWriteLine ( "Error: Not initialized" );
  364.                 return false;
  365.         }
  366.         new buffer[ 128 ], postData[ 64 ];
  367.         format ( postData , sizeof postData , "function=SetUserGender&id=%d&gender=%d" , UserID , Gender );
  368.         SendAPIRequest ( postData , buffer , sizeof buffer );
  369.         return true;
  370. }
  371.  
  372. PublicMethod:WBB_SetUserEmail ( _:UserID , _:Email[ ] ) {
  373.         if ( !Var::Global->System[ Initialized ] ) {
  374.                 ConsoleWriteLine ( "Error: Not initialized" );
  375.                 return false;
  376.         }
  377.         new buffer[ 128 ], postData[ 128 ];
  378.         format ( postData , sizeof postData , "function=SetUserEmail&id=%d&email=%s" , UserID , Email );
  379.         SendAPIRequest ( postData , buffer , sizeof buffer );
  380.         if ( buffer[ 0 ] = '1' )
  381.                 return true;
  382.         return EMAIL_ALREADY_EXISTS;
  383. }
  384.  
  385. PublicMethod:WBB_SetUserName ( _:UserID , _:Name[ ] ) {
  386.         if ( !Var::Global->System[ Initialized ] ) {
  387.                 ConsoleWriteLine ( "Error: Not initialized" );
  388.                 return false;
  389.         }
  390.         new buffer[ 128 ], postData[ 128 ];
  391.         format ( postData , sizeof postData , "function=SetUserName&id=%d&name=%s" , UserID , Name );
  392.         SendAPIRequest ( postData , buffer , sizeof buffer );
  393.         if ( buffer[ 0 ] == '1' )
  394.                 return true;
  395.         return USER_ALREADY_EXISTS;
  396. }
  397.  
  398. PublicMethod:WBB_SetUserPassword ( _:UserID , _:Password[ ] ) {
  399.         if ( !Var::Global->System[ Initialized ] ) {
  400.                 ConsoleWriteLine ( "Error: Not initialized" );
  401.                 return false;
  402.         }
  403.         new buffer[ 128 ], postData[ 128 ];
  404.         format ( postData , sizeof postData , "function=SetUserPassword&id=%d&password=%s" , UserID , Password );
  405.         SendAPIRequest ( postData , buffer , sizeof buffer );
  406.         if ( buffer[ 0 ] == '1' )
  407.                 return true;
  408.         return false;
  409. }
  410.  
  411. PublicMethod:WBB_SetUserTitle ( _:UserID , _:Title[ ] ) {
  412.         if ( !Var::Global->System[ Initialized ] ) {
  413.                 ConsoleWriteLine ( "Error: Not initialized" );
  414.                 return false;
  415.         }
  416.         new buffer[ 128 ], postData[ 128 ];
  417.         format ( postData , sizeof postData , "function=SetUserTitle&id=%d&title=%s" , UserID , Title );
  418.         SendAPIRequest ( postData , buffer , sizeof buffer );
  419.         return true;
  420. }
  421.  
  422. PublicMethod:WBB_SetUserCustomOption ( _:UserID , _:Option[ ] , _:Value[ ] ) {
  423.         if ( !Var::Global->System[ Initialized ] ) {
  424.                 ConsoleWriteLine ( "Error: Not initialized" );
  425.                 return false;
  426.         }
  427.         new buffer[ 128 ], postData[ 64 ];
  428.         format ( postData , sizeof postData , "function=SetUserCustomOption&id=%d&option=%s&value=%s" , UserID , Option , Value );
  429.         SendAPIRequest ( postData , buffer , sizeof buffer );
  430.         return true;
  431. }
  432.  
  433. PublicMethod:WBB_RemoveUserFromGroup ( _:UserID , _:Group ) {
  434.         if ( !Var::Global->System[ Initialized ] ) {
  435.                 ConsoleWriteLine ( "Error: Not initialized" );
  436.                 return false;
  437.         }
  438.         new buffer[ 128 ], postData[ 64 ];
  439.         format ( postData , sizeof postData , "function=RemoveUserFromGroup&id=%d&group=%d" , UserID , Group );
  440.         SendAPIRequest ( postData , buffer , sizeof buffer );
  441.         if ( buffer[ 0 ] == '1' )
  442.                 return true;
  443.         return false;
  444. }
  445.  
  446. PublicMethod:WBB_SendPM ( _:UserID , _:RecipientID , _:Subject[ ] , _:Text[ ] , bool:EnableSmilies = false , bool:EnableHTML = false , bool:EnableBBCodes = false , bool:ShowSignature = false ) {
  447.         if ( !Var::Global->System[ Initialized ] ) {
  448.                 ConsoleWriteLine ( "Error: Not initialized" );
  449.                 return false;
  450.         }
  451.         new buffer[ 128 ], postData[ WBB_CONNECT_MAX_POST_SIZE ];
  452.         format ( postData , sizeof postData , "function=SendPM&id=%d&recipient=%d&subject=%s&text=%s&enableSmilies=%d&enableHtml=%d&enableBBCodes=%d&showSignature=%d" , UserID , RecipientID , Subject , Text , EnableSmilies , EnableHTML , EnableBBCodes , ShowSignature );
  453.         SendAPIRequest ( postData , buffer , sizeof buffer );
  454.         return true;
  455. }
  456.  
  457. PublicMethod:WBB_CreatePost ( _:UserID , _:ThreadID , _:Subject[ ] , _:Text[ ] , bool:Disabled = false , bool:CloseThread = false , bool:MarkAsDone = false , bool:EnableSmilies = false , bool:EnableHTML = false , bool:EnableBBCodes = false , bool:ShowSignature = false ) {
  458.         if ( !Var::Global->System[ Initialized ] ) {
  459.                 ConsoleWriteLine ( "Error: Not initialized" );
  460.                 return false;
  461.         }
  462.         new buffer[ 128 ], postData[ WBB_CONNECT_MAX_POST_SIZE ];
  463.         format ( postData , sizeof postData , "function=CreatePost&id=%d&threadID=%d&subject=%s&text=%s&disabled=%d&markAsDone=%d&closeThread=%d&enableSmilies=%d&enableHtml=%d&enableBBCodes=%d&showSignature=%d" ,
  464.                 UserID , ThreadID , Subject , Text , Disabled , MarkAsDone , CloseThread , EnableSmilies , EnableHTML , EnableBBCodes , ShowSignature );
  465.         SendAPIRequest ( postData , buffer , sizeof buffer );
  466.         return strval(buffer);
  467. }
  468.  
  469. PublicMethod:WBB_CreateThread ( _:UserID , _:BoardID , _:Prefix[ ] , _:Subject[ ] , _:Text[ ] , bool:IsImportant = false , bool:Closed = false , bool:Disabled = false , bool:CloseThread = false , bool:EnableSmilies = false , bool:EnableHTML = false , bool:EnableBBCodes = false , bool:ShowSignature = false ) {
  470.         if ( !Var::Global->System[ Initialized ] ) {
  471.                 ConsoleWriteLine ( "Error: Not initialized" );
  472.                 return false;
  473.         }
  474.         new buffer[ 128 ], postData[ WBB_CONNECT_MAX_POST_SIZE ];
  475.         format ( postData , sizeof postData , "function=CreateThread&id=%d&boardID=%d&prefix=%s&subject=%s&text=%s&isImportant=%d&closed=%d&disabled=%d&closeThread=%d&enableSmilies=%d&enableHtml=%d&enableBBCodes=%d&showSignature=%d" ,
  476.                 UserID , BoardID , Prefix , Subject , Text , IsImportant , Closed , Disabled , CloseThread , EnableSmilies , EnableHTML , EnableBBCodes , ShowSignature );
  477.         SendAPIRequest ( postData , buffer , sizeof buffer );
  478.         return strval(buffer);
  479. }
  480.  
  481. PublicMethod:WBB_CreateUser ( _:Name[ ] , _:Email[ ] , _:Password[ ] ) {
  482.         if ( !Var::Global->System[ Initialized ] ) {
  483.                 ConsoleWriteLine ( "Error: Not initialized" );
  484.                 return false;
  485.         }
  486.         new buffer[ 128 ], postData[ 128 ];
  487.         format ( postData , sizeof postData , "function=CreateUser&name=%s&email=%s&password=%s" , Name , Email , Password );
  488.         SendAPIRequest ( postData , buffer , sizeof buffer );
  489.         return strval ( buffer );
  490. }
  491.  
  492. PublicMethod:WBB_DeleteUser ( _:UserID ) {
  493.         if ( !Var::Global->System[ Initialized ] ) {
  494.                 ConsoleWriteLine ( "Error: Not initialized" );
  495.                 return false;
  496.         }
  497.         new buffer[ 128 ], postData[ 64 ];
  498.         format ( postData , sizeof postData , "function=DeleteUser&id=%d" , UserID );
  499.         SendAPIRequest ( postData , buffer , sizeof buffer );
  500.         return true;
  501. }
  502.  
  503. PublicMethod:WBB_DisableUserAvatar ( _:UserID , _:Reason[ ] ) {
  504.         if ( !Var::Global->System[ Initialized ] ) {
  505.                 ConsoleWriteLine ( "Error: Not initialized" );
  506.                 return false;
  507.         }
  508.         new buffer[ 128 ], postData[ 64 ];
  509.         format ( postData , sizeof postData , "function=DisableUserAvatar&id=%d&reason=%s" , UserID , Reason );
  510.         SendAPIRequest ( postData , buffer , sizeof buffer );
  511.         return true;
  512. }
  513.  
  514. PublicMethod:WBB_EnableUserAvatar ( _:UserID ) {
  515.         if ( !Var::Global->System[ Initialized ] ) {
  516.                 ConsoleWriteLine ( "Error: Not initialized" );
  517.                 return false;
  518.         }
  519.         new buffer[ 128 ], postData[ 64 ];
  520.         format ( postData , sizeof postData , "function=EnableUserAvatar&id=%d&reason=%s" , UserID );
  521.         SendAPIRequest ( postData , buffer , sizeof buffer );
  522.         return true;
  523. }
  524.  
  525. PublicMethod:WBB_DisableUserSignature ( _:UserID , _:Reason[ ] ) {
  526.         if ( !Var::Global->System[ Initialized ] ) {
  527.                 ConsoleWriteLine ( "Error: Not initialized" );
  528.                 return false;
  529.         }
  530.         new buffer[ 128 ], postData[ 64 ];
  531.         format ( postData , sizeof postData , "function=DisableUserSignature&id=%d&reason=%s" , UserID , Reason );
  532.         SendAPIRequest ( postData , buffer , sizeof buffer );
  533.         return true;
  534. }
  535.  
  536. PublicMethod:WBB_EnableUserSignature ( _:UserID ) {
  537.         if ( !Var::Global->System[ Initialized ] ) {
  538.                 ConsoleWriteLine ( "Error: Not initialized" );
  539.                 return false;
  540.         }
  541.         new buffer[ 128 ], postData[ 64 ];
  542.         format ( postData , sizeof postData , "function=EnableUserSignature&id=%d" , UserID );
  543.         SendAPIRequest ( postData , buffer , sizeof buffer );
  544.         return true;
  545. }
  546.  
  547. PublicMethod:WBB_GetNewestUser ( ) {
  548.         if ( !Var::Global->System[ Initialized ] ) {
  549.                 ConsoleWriteLine ( "Error: Not initialized" );
  550.                 return false;
  551.         }
  552.         new buffer[ 64 ];
  553.         SendAPIRequest ( "function=GetNewestUser" , buffer , sizeof buffer );
  554.         return strval ( buffer );
  555. }
  556.  
  557. PublicMethod:WBB_GetOldUsername ( _:UserID ) {
  558.         new buffer[ 128 ], postData[ 64 ];
  559.         if ( !Var::Global->System[ Initialized ] ) {
  560.                 ConsoleWriteLine ( "Error: Not initialized" );
  561.                 return buffer;
  562.         }
  563.         format ( postData , sizeof postData , "function=GetOldUserName&id=%d" , UserID );
  564.         SendAPIRequest ( postData , buffer , sizeof buffer );
  565.         return buffer;
  566. }
  567.  
  568. PublicMethod:WBB_GetPostCreator ( _:PostID ) {
  569.         if ( !Var::Global->System[ Initialized ] ) {
  570.                 ConsoleWriteLine ( "Error: Not initialized" );
  571.                 return false;
  572.         }
  573.         new buffer[ 128 ], postData[ 64 ];
  574.         format ( postData , sizeof postData , "function=GetPostCreator&id=%d" , PostID );
  575.         SendAPIRequest ( postData , buffer , sizeof buffer );
  576.         return strval ( buffer );
  577. }
  578.  
  579. PublicMethod:WBB_GetThreadCreator ( _:ThreadID ) {
  580.         if ( !Var::Global->System[ Initialized ] ) {
  581.                 ConsoleWriteLine ( "Error: Not initialized" );
  582.                 return false;
  583.         }
  584.         new buffer[ 128 ], postData[ 64 ];
  585.         format ( postData , sizeof postData , "function=GetThreadCreator&id=%d" , ThreadID );
  586.         SendAPIRequest ( postData , buffer , sizeof buffer );
  587.         return strval ( buffer );
  588. }
  589.  
  590. PublicMethod:WBB_GetProfileAge ( _:UserID ) {
  591.         if ( !Var::Global->System[ Initialized ] ) {
  592.                 ConsoleWriteLine ( "Error: Not initialized" );
  593.                 return false;
  594.         }
  595.         new buffer[ 128 ], postData[ 64 ];
  596.         format ( postData , sizeof postData , "function=GetProfileAge&id=%d" , UserID );
  597.         SendAPIRequest ( postData , buffer , sizeof buffer );
  598.         return strval ( buffer );
  599. }
  600.  
  601. PublicMethod:WBB_GetUserAge ( _:UserID ) {
  602.         if ( !Var::Global->System[ Initialized ] ) {
  603.                 ConsoleWriteLine ( "Error: Not initialized" );
  604.                 return false;
  605.         }
  606.         new buffer[ 128 ], postData[ 64 ];
  607.         format ( postData , sizeof postData , "function=GetUserAge&id=%d" , UserID );
  608.         SendAPIRequest ( postData , buffer , sizeof buffer );
  609.         return strval ( buffer );
  610. }
  611.  
  612. PublicMethod:WBB_GetUserAboutMe ( _:UserID ) {
  613.         new buffer[ WBB_CONNECT_MAX_RESULT_BUFFER ], postData[ 64 ];
  614.         if ( !Var::Global->System[ Initialized ] ) {
  615.                 ConsoleWriteLine ( "Error: Not initialized" );
  616.                 return buffer;
  617.         }
  618.         format ( postData , sizeof postData , "function=GetUserAboutMe&id=%d" , UserID );
  619.         SendAPIRequest ( postData , buffer , sizeof buffer );
  620.         return buffer;
  621. }
  622.  
  623. PublicMethod:WBB_GetUserActivityPoints ( _:UserID ) {
  624.         if ( !Var::Global->System[ Initialized ] ) {
  625.                 ConsoleWriteLine ( "Error: Not initialized" );
  626.                 return false;
  627.         }
  628.         new buffer[ 64 ], postData[ 64 ];
  629.         format ( postData , sizeof postData , "function=GetUserActivityPoints&id=%d" , UserID );
  630.         SendAPIRequest ( postData , buffer , sizeof buffer );
  631.         return strval ( buffer );
  632. }
  633.  
  634. PublicMethod:WBB_GetUserActivationCode ( _:UserID ) {
  635.         new buffer[ 96 ], postData[ 64 ];
  636.         if ( !Var::Global->System[ Initialized ] ) {
  637.                 ConsoleWriteLine ( "Error: Not initialized" );
  638.                 return buffer;
  639.         }
  640.         format ( postData , sizeof postData , "function=GetUserActivationCode&id=%d" , UserID );
  641.         SendAPIRequest ( postData , buffer , sizeof buffer );
  642.         return buffer;
  643. }
  644.  
  645. PublicMethod:WBB_GetUserAvatarDisableReason ( _:UserID ) {
  646.         new buffer[ 256 ], postData[ 64 ];
  647.         if ( !Var::Global->System[ Initialized ] ) {
  648.                 ConsoleWriteLine ( "Error: Not initialized" );
  649.                 return buffer;
  650.         }
  651.         format ( postData , sizeof postData , "function=GetUserAvatarDisableReason&id=%d" , UserID );
  652.         SendAPIRequest ( postData , buffer , sizeof buffer );
  653.         return buffer;
  654. }
  655.  
  656. PublicMethod:WBB_GetUserSigDisableReason ( _:UserID ) {
  657.         new buffer[ 256 ], postData[ 64 ];
  658.         if ( !Var::Global->System[ Initialized ] ) {
  659.                 ConsoleWriteLine ( "Error: Not initialized" );
  660.                 return buffer;
  661.         }
  662.         format ( postData , sizeof postData , "function=GetUserSignatureDisableReason&id=%d" , UserID );
  663.         SendAPIRequest ( postData , buffer , sizeof buffer );
  664.         return buffer;
  665. }
  666.  
  667. PublicMethod:WBB_GetUserBanReason ( _:UserID ) {
  668.         new buffer[ 256 ], postData[ 64 ];
  669.         if ( !Var::Global->System[ Initialized ] ) {
  670.                 ConsoleWriteLine ( "Error: Not initialized" );
  671.                 return buffer;
  672.         }
  673.         format ( postData , sizeof postData , "function=GetUserBanReason&id=%d" , UserID );
  674.         SendAPIRequest ( postData , buffer , sizeof buffer );
  675.         return buffer;
  676. }
  677.  
  678. PublicMethod:WBB_GetUserBirthday ( _:UserID ) {
  679.         new buffer[ 64 ], postData[ 64 ];
  680.         if ( !Var::Global->System[ Initialized ] ) {
  681.                 ConsoleWriteLine ( "Error: Not initialized" );
  682.                 return buffer;
  683.         }
  684.         format ( postData , sizeof postData , "function=GetUserBirthday&id=%d" , UserID );
  685.         SendAPIRequest ( postData , buffer , sizeof buffer );
  686.         return buffer;
  687. }
  688.  
  689. PublicMethod:WBB_GetUserCustomOption ( _:UserID , _:Option[ ] ) {
  690.         new buffer[ 64 ], postData[ 64 ];
  691.         if ( !Var::Global->System[ Initialized ] ) {
  692.                 ConsoleWriteLine ( "Error: Not initialized" );
  693.                 return buffer;
  694.         }
  695.         format ( postData , sizeof postData , "function=GetUserCustomOption&id=%d&option=%s" , UserID , Option );
  696.         SendAPIRequest ( postData , buffer , sizeof buffer );
  697.         return buffer;
  698. }
  699.  
  700. PublicMethod:WBB_GetUserEmail ( _:UserID ) {
  701.         new buffer[ 96 ], postData[ 64 ];
  702.         if ( !Var::Global->System[ Initialized ] ) {
  703.                 ConsoleWriteLine ( "Error: Not initialized" );
  704.                 return buffer;
  705.         }
  706.         format ( postData , sizeof postData , "function=GetUserEmail&id=%d" , UserID );
  707.         SendAPIRequest ( postData , buffer , sizeof buffer );
  708.         return buffer;
  709. }
  710.  
  711. PublicMethod:WBB_GetUserGender ( _:UserID ) {
  712.         if ( !Var::Global->System[ Initialized ] ) {
  713.                 ConsoleWriteLine ( "Error: Not initialized" );
  714.                 return false;
  715.         }
  716.         new buffer[ 64 ], postData[ 64 ];
  717.         format ( postData , sizeof postData , "function=GetUserGender&id=%d" , UserID );
  718.         SendAPIRequest ( postData , buffer , sizeof buffer );
  719.         return strval ( buffer );
  720. }
  721.  
  722. PublicMethod:WBB_GetUserHobbies ( _:UserID ) {
  723.         new buffer[ 128 ], postData[ 64 ];
  724.         if ( !Var::Global->System[ Initialized ] ) {
  725.                 ConsoleWriteLine ( "Error: Not initialized" );
  726.                 return buffer;
  727.         }
  728.         format ( postData , sizeof postData , "function=GetUserHobbies&id=%d" , UserID );
  729.         SendAPIRequest ( postData , buffer , sizeof buffer );
  730.         return buffer;
  731. }
  732.  
  733. PublicMethod:WBB_GetUserHomepage ( _:UserID ) {
  734.         new buffer[ 128 ], postData[ 64 ];
  735.         if ( !Var::Global->System[ Initialized ] ) {
  736.                 ConsoleWriteLine ( "Error: Not initialized" );
  737.                 return buffer;
  738.         }
  739.         format ( postData , sizeof postData , "function=GetUserHomepage&id=%d" , UserID );
  740.         SendAPIRequest ( postData , buffer , sizeof buffer );
  741.         return buffer;
  742. }
  743.  
  744. PublicMethod:WBB_GetUserLocation ( _:UserID ) {
  745.         new buffer[ 128 ], postData[ 64 ];
  746.         if ( !Var::Global->System[ Initialized ] ) {
  747.                 ConsoleWriteLine ( "Error: Not initialized" );
  748.                 return buffer;
  749.         }
  750.         format ( postData , sizeof postData , "function=GetUserLocation&id=%d" , UserID );
  751.         SendAPIRequest ( postData , buffer , sizeof buffer );
  752.         return buffer;
  753. }
  754.  
  755. PublicMethod:WBB_GetUserLostPasswordKey ( _:UserID ) {
  756.         new buffer[ 128 ], postData[ 64 ];
  757.         if ( !Var::Global->System[ Initialized ] ) {
  758.                 ConsoleWriteLine ( "Error: Not initialized" );
  759.                 return buffer;
  760.         }
  761.         format ( postData , sizeof postData , "function=GetUserLostPasswordKey&id=%d" , UserID );
  762.         SendAPIRequest ( postData , buffer , sizeof buffer );
  763.         return buffer;
  764. }
  765.  
  766. PublicMethod:WBB_GetUserOccupation ( _:UserID ) {
  767.         new buffer[ 128 ], postData[ 64 ];
  768.         if ( !Var::Global->System[ Initialized ] ) {
  769.                 ConsoleWriteLine ( "Error: Not initialized" );
  770.                 return buffer;
  771.         }
  772.         format ( postData , sizeof postData , "function=GetUserOccupation&id=%d" , UserID );
  773.         SendAPIRequest ( postData , buffer , sizeof buffer );
  774.         return buffer;
  775. }
  776.  
  777. PublicMethod:WBB_SetUserOccupation ( _:UserID , _:Occupation[ ] ) {
  778.         if ( !Var::Global->System[ Initialized ] ) {
  779.                 ConsoleWriteLine ( "Error: Not initialized" );
  780.                 return false;
  781.         }
  782.         new buffer[ 64 ], postData[ 96 ];
  783.         format ( postData , sizeof postData , "function=SetUserOccupation&id=%d&occupation=%s" , UserID , Occupation );
  784.         SendAPIRequest ( postData , buffer , sizeof buffer );
  785.         return true;
  786. }
  787.  
  788. PublicMethod:WBB_GetUserReactivationCode ( _:UserID ) {
  789.         new buffer[ 128 ], postData[ 64 ];
  790.         if ( !Var::Global->System[ Initialized ] ) {
  791.                 ConsoleWriteLine ( "Error: Not initialized" );
  792.                 return buffer;
  793.         }
  794.         format ( postData , sizeof postData , "function=GetUserReactivationCode&id=%d" , UserID );
  795.         SendAPIRequest ( postData , buffer , sizeof buffer );
  796.         return buffer;
  797. }
  798.  
  799. PublicMethod:WBB_GetUserTitle ( _:UserID ) {
  800.         new buffer[ 128 ], postData[ 64 ];
  801.         if ( !Var::Global->System[ Initialized ] ) {
  802.                 ConsoleWriteLine ( "Error: Not initialized" );
  803.                 return buffer;
  804.         }
  805.         format ( postData , sizeof postData , "function=GetUserTitle&id=%d" , UserID );
  806.         SendAPIRequest ( postData , buffer , sizeof buffer );
  807.         return buffer;
  808. }
  809.  
  810. PublicMethod:WBB_GetUserUnreadPMQuantity ( _:UserID ) {
  811.         if ( !Var::Global->System[ Initialized ] ) {
  812.                 ConsoleWriteLine ( "Error: Not initialized" );
  813.                 return false;
  814.         }
  815.         new buffer[ 64 ], postData[ 64 ];
  816.         format ( postData , sizeof postData , "function=GetUserUnreadPMQuantity&id=%d" , UserID );
  817.         SendAPIRequest ( postData , buffer , sizeof buffer );
  818.         return strval ( buffer );
  819. }
  820.  
  821. PublicMethod:WBB_GetUserOutstandingPMs ( _:UserID ) {
  822.         if ( !Var::Global->System[ Initialized ] ) {
  823.                 ConsoleWriteLine ( "Error: Not initialized" );
  824.                 return false;
  825.         }
  826.         new buffer[ 64 ], postData[ 64 ];
  827.         format ( postData , sizeof postData , "function=GetUserOutstandingPMs&id=%d" , UserID );
  828.         SendAPIRequest ( postData , buffer , sizeof buffer );
  829.         return strval ( buffer );
  830. }
  831.  
  832. PublicMethod:WBB_GetUserProfileHits ( _:UserID ) {
  833.         if ( !Var::Global->System[ Initialized ] ) {
  834.                 ConsoleWriteLine ( "Error: Not initialized" );
  835.                 return false;
  836.         }
  837.         new buffer[ 64 ], postData[ 64 ];
  838.         format ( postData , sizeof postData , "function=GetUserProfileHits&id=%d" , UserID );
  839.         SendAPIRequest ( postData , buffer , sizeof buffer );
  840.         return strval ( buffer );
  841. }
  842.  
  843. PublicMethod:WBB_GetUserRankID ( _:UserID ) {
  844.         if ( !Var::Global->System[ Initialized ] ) {
  845.                 ConsoleWriteLine ( "Error: Not initialized" );
  846.                 return false;
  847.         }
  848.         new buffer[ 64 ], postData[ 64 ];
  849.         format ( postData , sizeof postData , "function=GetUserRankID&id=%d" , UserID );
  850.         SendAPIRequest ( postData , buffer , sizeof buffer );
  851.         return strval ( buffer );
  852. }
  853.  
  854. PublicMethod:WBB_GetUserGroups ( _:UserID , _:GroupIDs[ ] , const _:ArraySize ) {
  855.         new buffer[ 96 ], postData[ 64 ], tmpGroupBuffer[ 32 ][ 8 ];
  856.         if ( !Var::Global->System[ Initialized ] ) {
  857.                 ConsoleWriteLine ( "Error: Not initialized" );
  858.                 return false;
  859.         }
  860.         format ( postData , sizeof postData , "function=GetUserGroups&id=%d" , UserID );
  861.         SendAPIRequest ( postData , buffer , sizeof buffer );
  862.        
  863.         SplitResult ( buffer , tmpGroupBuffer , ',' );
  864.         for ( new i; i < ArraySize; i++ )
  865.                 GroupIDs[ i ] = strval ( tmpGroupBuffer[ i ] );
  866.  
  867.         return true;
  868. }
  869.  
  870. PublicMethod:WBB_IsUserActivated ( _:UserID ) {
  871.         if ( !Var::Global->System[ Initialized ] ) {
  872.                 ConsoleWriteLine ( "Error: Not initialized" );
  873.                 return false;
  874.         }
  875.         new buffer[ 64 ], postData[ 64 ];
  876.         format ( postData , sizeof postData , "function=IsUserActivated&id=%d" , UserID );
  877.         SendAPIRequest ( postData , buffer , sizeof buffer );
  878.         return buffer[ 0 ] == '1' ? true : false;
  879. }
  880.  
  881. PublicMethod:WBB_IsUserAvatarDisabled ( _:UserID ) {
  882.         if ( !Var::Global->System[ Initialized ] ) {
  883.                 ConsoleWriteLine ( "Error: Not initialized" );
  884.                 return false;
  885.         }
  886.         new buffer[ 64 ], postData[ 64 ];
  887.         format ( postData , sizeof postData , "function=IsUserAvatarDisabled&id=%d" , UserID );
  888.         SendAPIRequest ( postData , buffer , sizeof buffer );
  889.         return buffer[ 0 ] == '1' ? true : false;
  890. }
  891.  
  892. PublicMethod:WBB_IsUserBanned ( _:UserID ) {
  893.         if ( !Var::Global->System[ Initialized ] ) {
  894.                 ConsoleWriteLine ( "Error: Not initialized" );
  895.                 return false;
  896.         }
  897.         new buffer[ 64 ], postData[ 64 ];
  898.         format ( postData , sizeof postData , "function=IsUserBanned&id=%d" , UserID );
  899.         SendAPIRequest ( postData , buffer , sizeof buffer );
  900.         return buffer[ 0 ] == '1' ? true : false;
  901. }
  902.  
  903. PublicMethod:WBB_IsUserInGroup ( _:UserID , _:GroupID ) {
  904.         if ( !Var::Global->System[ Initialized ] ) {
  905.                 ConsoleWriteLine ( "Error: Not initialized" );
  906.                 return false;
  907.         }
  908.         new buffer[ 64 ], postData[ 64 ];
  909.         format ( postData , sizeof postData , "function=IsUserInGroup&id=%d&group=%d" , UserID , GroupID );
  910.         SendAPIRequest ( postData , buffer , sizeof buffer );
  911.         return buffer[ 0 ] == '1' ? true : false;
  912. }
  913.  
  914. PublicMethod:WBB_IsUserOnline ( _:UserID ) {
  915.         if ( !Var::Global->System[ Initialized ] ) {
  916.                 ConsoleWriteLine ( "Error: Not initialized" );
  917.                 return false;
  918.         }
  919.         new buffer[ 64 ], postData[ 64 ];
  920.         format ( postData , sizeof postData , "function=IsUserOnline&id=%d" , UserID );
  921.         SendAPIRequest ( postData , buffer , sizeof buffer );
  922.         return buffer[ 0 ] == '1' ? true : false;
  923. }
  924.  
  925. PublicMethod:WBB_IsUserSignatureDisabled ( _:UserID ) {
  926.         if ( !Var::Global->System[ Initialized ] ) {
  927.                 ConsoleWriteLine ( "Error: Not initialized" );
  928.                 return false;
  929.         }
  930.         new buffer[ 64 ], postData[ 64 ];
  931.         format ( postData , sizeof postData , "function=IsUserSignatureDisabled&id=%d" , UserID );
  932.         SendAPIRequest ( postData , buffer , sizeof buffer );
  933.         return buffer[ 0 ] == '1' ? true : false;
  934. }
  935.  
  936. PrivateMethod:SendAPIRequest ( PostData[ ] , Result[ ] , Length ) {
  937.         new postString[ WBB_CONNECT_POST_SIZE ];
  938.         format ( postString , WBB_CONNECT_POST_SIZE , "auth_key=%s&%s" , Var::Global->System[ AuthKey ] , PostData );
  939.         new httpStatus = SynchronizedHTTP ( Var::Global->System[ ApiURL ] , postString , Result , Length , HTTP_POST , WBB_CONNECT_TIMEOUT , WBB_CONNECT_DEBUG_MODE );
  940.         #if WBB_CONNECT_DEBUG_MODE == 1
  941.         new tmpString[ 256 ];
  942.         format ( tmpString , sizeof tmpString , "DEBUG:\nDestination: %s\nData: %s\nHTTP status: %d\nResponse: %s", Var::Global->System[ ApiURL ] , postString , httpStatus , Result );
  943.         ConsoleWriteLine ( tmpString );
  944.         #endif
  945.         if ( httpStatus == 200 ) {
  946.                 if ( Result[ 0 ] == '0' ) {                     // check connection bytes
  947.                         ConsoleWriteLine ( "Error: Connection rejected. IP restriction is enabled." );
  948.                         return false;
  949.                 }
  950.                 else if ( Result[ 0 ] == '1' ) {
  951.                         ConsoleWriteLine ( "Error: Connection rejected. Wrong authentication key." );
  952.                         return false;
  953.                 }
  954.                 else if ( Result[ 0 ] == '2' ) {
  955.                         if ( Result[ 1 ] == '0' ) {             // check execution bytes
  956.                                 strdel ( Result , 0 , 3 );
  957.                                 new tmpStr[ 256 ];
  958.                                 format ( tmpStr , sizeof tmpStr , "Error: API request could not be executed.\nReason: %s", Result );
  959.                                 ConsoleWriteLine ( tmpStr );
  960.                                 return false;
  961.                         }
  962.                         else if ( Result[ 1 ] == '1' ) {
  963.                                 strdel ( Result , 0 , 3 );
  964.                                 return true;
  965.                         }
  966.                 }
  967.                 new tmpStr[ 256 ];
  968.                 format ( tmpStr , sizeof tmpStr , "Error: Internal error. Connection bytes: %s", Result[ 0 ] );
  969.                 ConsoleWriteLine ( tmpStr );
  970.                 return false;
  971.         }
  972.         else {
  973.                 new tmpStr[ 256 ];
  974.                 format ( tmpStr , sizeof tmpStr , "Error: Bad response from server: %d", httpStatus );
  975.                 ConsoleWriteLine ( tmpStr );
  976.                 return false;
  977.         }
  978. }
  979.  
  980. PrivateMethod:SplitResult ( String[ ] , Result[ ][ ] , Delimiter = ';' ) {
  981.         new currentSplit = 0, offset = 0;
  982.         for ( new i; i < strlen ( String ); i++ ) {
  983.                 if ( String[ i ] == Delimiter ) {
  984.                         Result[ currentSplit ][ offset  ] = EOS;
  985.                         currentSplit++;
  986.                         offset = 0;
  987.                         continue;
  988.                 }
  989.                 else {
  990.                         Result[ currentSplit ][ offset ] = String[ i ];
  991.                 }
  992.                 offset++;
  993.         }
  994. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top