[Tutorial] Post To your vBulletin Forums IG!!!(works)
#1

Hello, SA-MP, This is my first ever tutorial. It may take alot of "work" if you are new to PAWN, etc. If you would like to test this I recommend 000Webhost and vBulletin setup, WARNING: do not get NULLED vBulletin as 000Webhost could block your IP from accessing their free services.
1.Create a file called post_from_ingame.php and drag it into your vBulletin Directory. mine is /forum/. This is the PHP code that you will put in the file that you created (post_from_ingame.php)
PHP код:
<?php
    date_default_timezone_set 
("Europe/Amsterdam"); // Server time
    
require './global.php';
    require 
'./includes/class_dm.php';
    require 
'./includes/class_dm_threadpost.php';
    require 
'./includes/functions_databuild.php';
    
$threaddm = new vB_DataManager_Thread_FirstPost($vbulletinERRTYPE_STANDARD);
    
$post_userid 0// Guest
    
$userid 0// No user
    
$user_name $_POST['name'] . ' (SA-MP)';
    
$allow_smilie '1';
    
$visible '1';
    
    
$forum_id = !!!!!CHANGE_ME!!!!!; // Set the board id here. For example, my 'report discussions' board is ID 28, so I'd put 28. forum/forumdisplay.php?28-Report-discussion (28 is the ID)
    
    //Thread post formatting
    
$post_text = (string)strip_tags('In-game name:[indent]    ' $_POST['name'] .'[/indent]    Server time:[indent]    ' strftime("%l:%M:%S %p") . '    [/indent]    Explanation:[indent]' . (string)strip_tags($_POST['posttext']) . '[/indent]');
    
//$_POST['posttext'] - posttext is what is sent in-game
    //format(string, sizeof(string), "name=%s&posttext=%s", name, params);
    
    //Thread title formatting
    //$title = 'New post from in-game';
    
$title '[' strftime("%H:%M:%S") . '] Report from ' $_POST['name'];
    
$threaddm->do_set('forumid'$forum_id);
    
$threaddm->do_set('postuserid'$post_userid);
    
$threaddm->do_set('userid'$userid);
    
$threaddm->do_set('username'$user_name);
    
$threaddm->do_set('pagetext'$post_text);
    
$threaddm->do_set('title'$title);
    
$threaddm->do_set('allowsmilie'$allow_smilie);
    
$threaddm->do_set('visible'$visible);
    
$threaddm->save();
    
build_forum_counters($forum_id);
    
    die(
"Report posted!");
?>
Now save that.

2.Go to your Script and add this > [pawn]#include a_http[pawn] NOTE: Make sure it is under #include <a_samp>

3.Add this to your script under a function ( I like to use dcmd )
pawn Код:
new string[128];
new name[32];
GetPlayerName(playerid, name, 32);
format(string, sizeof(string), "name=%s&posttext=%s", name, params);
HTTP(playerid, HTTP_POST, "link-to-post_from_ingame.php-file", string, "MyHTMLError");

3a
If you want to change what is sent to the forum, you can change format(string, sizeof(string), "name=%s&posttext=%s", name, params);. For example:
pawn Код:
if(Kills[playerid] == 500) format(string, sizeof(string), "name=%s&kills=%d", name, Kills[playerid]);
NOTE: If customized, be sure to edit the post_from_ingame.php file:
PHP код:
$post_text = (string)strip_tags('$_POST['name'] . ' just got 500 kills! 
Well done to him!'
); // Thread post
$title '[' strftime("%H:%M:%S") . '] - ' $_POST['name'] . ' just got 500 kills!'// Thread title 
NOTE: change the link-to-post_from_ingame.php-file part!
(My example would be domain.com/forum/post_from_ingame.php - you don't need the preceding http://)

And the MyHTMLError function:
pawn Код:
forward MyHTMLError(index, response_code, data[]);
public MyHTMLError(index, response_code, data[])
{
    new
        buffer[ 128 ];
    if(response_code == 200) //Did the request work?????
    {
        //Yes!
        format(buffer, sizeof(buffer), "%s", data);
        SendClientMessage(index, 0xFFFFFFFF, buffer);
    }
}
die("Report posted!"); in the PHP file will send "Report posted!" to the game server, which will then be formatted as 'buffer' and sent to index (the player).
Go to your config.php and add this to the bottom:
PHP код:
define('SKIP_REFERRER_CHECK'true); 
Now Execute your Function!.

IF I helped you, you could help me by REPing me
NOTE : GENERALLY POSTED BY [FMJ]PowerSurge I just explained further
Reply


Messages In This Thread
Post to your vBulletin forum using an in-game function MORE EXPLAINED - by Mriss - 26.01.2014, 08:08
Re: Post To your vBulletin Forums IG!!!(works) - by Infinity - 26.01.2014, 08:13

Forum Jump:


Users browsing this thread: 1 Guest(s)