SMF & SAMP interrogation.
#1

Hello, I have been wanting to do this for sometime now and I want to learn it now really.

I would like to know how I can set up a Latest Server Member under the Latest Forum Member and some other things which will be listed below;

- Adding there server information in to the players profile.

Thanks, Luis.
Reply
#2

Learn the basics of PHP, that should help you understand more about SMF's code arc, and help you to edit to the postbit, as for the actual integration, Carlton released an include called CSMF some time ago now, it's not 100% stable but it does the job, if you get your knowledge up maybe you can edit it to your liking. As for actual implementation, the best way to do it would be using MySQL based game-mode, that way you could maybe use the same MySQL database for your SMF forum and your SA-MP server player accounts, etc.
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=157050
Reply
#4

Since I assume I know where you're coming from, I can tell you a little about it!

The "Latest server member" is actually stored as a cached string (using Alternative PHP Cache) and displayed through Themes/THEME/BoardIndex.template.php. The cache is updated every time someone new registers in file newuser.php. The file newuser.php is called using HTTP() function which was introduced in 0.3b.

Player information can be displayed in one's profile by modifying Themes/THEME/Profile.template.php, but before some changes are necessary to be made in Sources/Load.php. Of course they key to all this is having an extra field in smf_members table which stores the player's server registration ID, and the server players table must have an extra field to store the player's member user ID.
Reply
#5

Ah, so I'd basically use HTTP(playerid, HTTP_POST, "www.url.com/forums/themes/THEME/newuser.php", "", "MyHttpResponse");, I have never worked with the HTTP function.
Reply
#6

The newuser.php is a custom made script which
1. updates cache with the new player's information
2. posts a welcome message on the new players board
3. sends the player a private message
4. you can't possibly have.
And it doesn't matter where it is located.
Reply
#7

I did attempt to make a Latest Server Member script but it kinda failed.

PHP код:
$result mysql_query("SELECT * FROM `accounts` ORDER BY `accounts`.`RegisterDate` DESC LIMIT 0, 1");
while(
$row mysql_fetch_array($result))
{
echo 
' ' 'Latest Server Member' ': ' '<b>' '<a href="http://www.foxxrp.com/testucp/player.php?user=' $row["Name"] . '">' $row["Name"] . '</a>' '</b>';

I will attempt to have a go, your way.
Reply
#8

You getting errors with the above script?
Reply
#9

Quote:
Originally Posted by -Luis
Посмотреть сообщение
I did attempt to make a Latest Server Member script but it kinda failed.

PHP код:
$result mysql_query("SELECT * FROM `accounts` ORDER BY `accounts`.`RegisterDate` DESC LIMIT 0, 1");
while(
$row mysql_fetch_array($result))
{
echo 
' ' 'Latest Server Member' ': ' '<b>' '<a href="http://www.foxxrp.com/testucp/player.php?user=' $row["Name"] . '">' $row["Name"] . '</a>' '</b>';

I will attempt to have a go, your way.
Querying for the last member every time the page is loaded will just get overwhelming. Besides opening a side MySQL connection in SMF source has only caused me trouble in the past. So when you get everything running and have the time to work on it, I'd suggest a better storage method for some information. I ain't an expert, but storing a value in memory, not in files or databases is much faster. About APC.

And there are several ways to make your PHP code better. Starting from the query and ending with the method you use to parse your returned data. This all can be done in ease:
PHP код:
$name mysql_result(mysql_query('SELECT name FROM accounts ORDER BY RegisterDate DESC LIMIT 0,1'), 0);
echo 
'Latest server member: <b><a href="http://foxxrp.com/testucp/player.php?user=' $name '">' $name '</a></b>'
Quote:
Originally Posted by Famalamalam
Посмотреть сообщение
Lol Andre, when are you releasing yours? Been waiting agesssssss.
I doubt it'll be released anytime soon. Any trouble we encounter, we'll get past it. But of course there will be a time when this will become an open sourced project so I can continue developing. But there's one major problem with it: setting up a fresh copy of the server with databases, site files and getting it integrated with SMF using PortaMx is something that would take even me many many hours on a new server. So before we get to that, the simplicity of the structure itself needs to be improved.

When I'm done solving some issues and have taken care of a lockup bug that occurs quite often, I think I will pull it off and write a tutorial or two in the tutorials part on how to create at least some integration between SMF forums and a SA-MP server.
Reply
#10

Quote:
Originally Posted by AndreT
Посмотреть сообщение
When I'm done solving some issues and have taken care of a lockup bug that occurs quite often, I think I will pull it off and write a tutorial or two in the tutorials part on how to create at least some integration between SMF forums and a SA-MP server.
Sounds good, I look forward to it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)