again help !! :D
#1

guys is there some way to make the server connect with the web site
exsample:

When u will connect in the server automatic to kick u and tells to you "you must need to register on our site www.blahblah.com"

Thanks for the help...
Reply
#2

This sounds like a job for MySQL and PHP (PHP writes user registration infos from the website into MySQL, SA-MP accesses MySQL database and reads the infos)

It would take way too much to explain it here, and moreover i only have a basic knowledge about PHP.
Reply
#3

ok can u send me some link or pawn code of ur basic knowledge
Thanks
Reply
#4

Sorry, but it would take too much time and work, and i am just too tired and too stoned now, to write some random php stuff down. Wouldnt help you anyways
Reply
#5

Just ****** for tutorials
Reply
#6

As Mauzen said:

Check if their name exists in the Database, if not kick them. Their name = Registered on the web site.

There are other things besides PHP, so I don't know why you singled that one out but I will use that.

For a very basic registration on the web site side:

PHP код:
<?php
mysql_connect
("localhost""root""""db");
mysql_select_db("db");
?>
<html>
<head>
<title>Registration for Server</title>
</head>
<body>
<?php
if (isset($_POST['submit'])) {
    if (!
$_POST['Name'] || !$_POST['Pass']) {
        echo 
"<h1><center><font color='red'>You need to fill in both fields!</font></center></h1>";
    } else {
        
$name mysql_escape_string($_POST['Name']);
        
$pass mysql_escape_string($_POST['Pass']);
        
$Query mysql_query("SELECT username FROM users WHERE username = '".$name."'");
        if(
mysql_num_rows($Query) == 0) { //Their account is not already made, so insert it into the DB
            
echo "<h1><center><font color='green'>Account Created Successfully!</font></center></h1>";
            
$Query mysql_query("INSERT INTO users (id, username, password) VALUES ('', '".$name."', '".$pass."')")
        } else { 
//Account already exists
            
echo "<h1><center><font color='red'>This account exists already!</font></center></h1>";
        }
    }
}
?>
Enter below the required information:<br />
<form action="" method="post">
    In-Game Name: <input type="text" name="Name" size="30" /><br />
    In-Game Pass: <input type="password" name="Pass" size="30" /><br />
    Submit Info: <input type="submit" name="submit" value="Submit" /><br />
    <b>Names must be 20 Characters long!</b>
</form>
</body>
</html>
Now this is just an example, don't go using this cause its only there to show you. Obviously this would be your site as not many people would be excited to use a white blank registration page.

Now back on PAWN side:
You need to check the account name in the database and if there's a match then they can login.

pawn Код:
public OnGameModeInit() {
    mysql_connect("localhost", "root", "", "db", 1);
    return 1;
}

public OnPlayerConnect(playerid) {
    //Registration and Loggin In
    new Query[80]; format(Query, 80, "SELECT username FROM users WHERE username = '%s'", Name(playerid));
    mysql_query(Query);
    mysql_store_result();
    if (mysql_num_rows() == 1) { //They are already registered, so they can login
        SendClientMessage(playerid, COLOR_WHITE, "Your account exists. Please enter your password to proceed.");
    } else { //They are not, so kick them.
        SendClientMessage(playerid, COLOR_WHITE, "You need to register your account on our website first: http://yoursite.domain");
        Kick(playerid);
    }
    return 1;
}
Once again, this is an example only and to show you how to do it.
Learn upon this and make yours work.
Reply
#7

uhhhhh thanks muffin i apprecitate this you realy help me alot
THANKS !
Reply
#8

rafa this is nice thing to make the game be with webiste
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)