open.mp forum
[Pawn] [HELP]How to Retrieve and Use Values from MySQL Database in SA-MP Server? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] [HELP]How to Retrieve and Use Values from MySQL Database in SA-MP Server? (/showthread.php?tid=3026)



[HELP]How to Retrieve and Use Values from MySQL Database in SA-MP Server? - dudungariska - 2025-01-05

Hi everyone,

Hi, I’m trying to make a UCP system for my SA-MP roleplay server, but I’m really new to this, and I’m stuck. My idea is that players will register on a website outside the game, and the website will save their data (like username and email) into a MySQL database. When they join the game, I want the server to get that data (like their email) and show it in something like a dialog or a
/stats command. I don’t really understand how to make the server read the data from the database and display it in-game. Can someone explain how to do this step by step?

Here’s what I’m trying to achieve:
  1. Retrieve Data: How can I fetch the player’s email from the MySQL database when they log in?
  2. Display Data: How do I show the retrieved email in a dialog or a command (like/stats)?
  3. Syncing: What’s the best way to ensure that the data in the database matches the player in-game?
I’m using XAMPP for the database and the MySQL plugin for SA-MP. If anyone has example scripts, explanations, or best practices for linking the UCP with the SA-MP server, I’d greatly appreciate it!
Thanks in advance!


RE: [HELP]How to Retrieve and Use Values from MySQL Database in SA-MP Server? - samuelmatheus0502 - 2025-01-08

https://github.com/pBlueG/SA-MP-MySQL/blob/master/example_scripts/login_system-cache.pwn

Esse exemplo é do proprio plugin do mySQL samp