Szerző Téma: Login/register  (Megtekintve 532 alkalommal)

Nem elérhető shadee

  • 1073
    • Profil megtekintése
Login/register
« Dátum: 2012. augusztus 08. - 00:55:01 »
0 Show voters
üdv,mi lehet a hiba?h kell definiálni?bárhogy megprobáltam,nemjó
WarNing:
 
C:\\Users\\Dawee\\Desktop\\SeeRPG Reloaded International\\gamemodes\\RP.pwn(185) : warning 203: symbol is never used: \"login\"
C:\\Users\\Dawee\\Desktop\\SeeRPG Reloaded International\\gamemodes\\RP.pwn(185) : warning 203: symbol is never used: \"register\"

Nem elérhető Flash

  • 5726
  • (っ◕‿◕)っ
    • Profil megtekintése
Login/register
« Válasz #1 Dátum: 2012. augusztus 08. - 00:56:16 »
0 Show voters
#define register 5000
#define login      5001

Login/register
« Válasz #2 Dátum: 2012. augusztus 08. - 00:58:24 »
0 Show voters
nem a definícióval van baj, hanem használva nincs. valamit elírtál.

Nem elérhető shadee

  • 1073
    • Profil megtekintése
Login/register
« Válasz #3 Dátum: 2012. augusztus 08. - 01:00:21 »
0 Show voters
Idézetet írta: bencarter007 date=1344380304\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"25719\" data-ipsquote-contentclass=\"forums_Topic
nem a definícióval van baj, hanem használva nincs. valamit elírtál.
 
itt a Scriptem:
 
//munkák:login/register definiálása,Adatbázisba a Username,Password,Money,Score-t lementeni....ennyi egyenlore
#include <a_samp>
#include <a_mysql>
#include <sscanf>
/*Röviditések*/
#define SCM SendClientMessage
main()
{
print(\"\");
}
/* SZINEK       */
#define COLOR_KEK 0x4f7ad6AA
#define green 0x1fab07AA
#define red 0xf05757AA
/*Csatlakozás */
#define MustLogin                                                               true//Change this to false, if you dont want to make them login when they connect
#define SQL_Host                                                    \"asd\"
#define SQL_User                                                    \"asd\"
#define SQL_Password                                                 \"asd\"
#define SQL_Database                                                  \"asd\"
enum PlayerInfo
{
Username[23],
Password,
Logged,
Money,
Score
}
new PInfo[MAX_PLAYERS][PlayerInfo];
 
public OnGameModeInit()
{
mysql_query( \"CREATE TABLE IF NOT EXIST Users ( \\
`Username` varchar(24) NOT NULL, \\
`Password` int(40) NOT NULL, \\
`Money` int(9) NOT NULL, \\
`Score` int(9) NOT NULL)\");
SetGameModeText(\"GothamRPG v1.0.0\");
mysql_connect(SQL_Host,SQL_User,SQL_Password,SQL_Database);
mysql_debug(1);
if(mysql_ping() == 1)
     {
         mysql_debug(1);
    printf(\"[MYSQL]:Csatlakozás megtörtént! Host:%s | Adatbázis:%s\", SQL_Host,SQL_Database);
}
else
{
    printf(\"[MYSQL]:Csatlakozás sikertelen! Host:%s | Adatbázis:%s\", SQL_Host,SQL_Database);
}
return 1;
}
public OnGameModeExit()
{
mysql_close();
print(\"SQL csatlakozás megszakadt!\");
}
public OnPlayerConnect(playerid)
{
static
    Query[100];
format( Query, sizeof Query, \"SELECT `Username` FROM `Users` WHERE `Username` = \'%s\'\", GetPName( playerid ) );
mysql_query( Query );
mysql_store_result();
if( mysql_num_rows() != 0 )
SendClientMessage( playerid, COLOR_KEK, \"» You are registered! Please use /login <password>\");
else
    SendClientMessage( playerid, COLOR_KEK, \"» You are not register! Please use /register <password>\");
mysql_free_result();
return 1;
}
public OnPlayerDisconnect(playerid)
{
PInfo[playerid][Logged] = 0;
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
CMD:register( playerid,params[] )
{
if(PInfo[playerid][Logged] == 1) return SendClientMessage( playerid, red, \"» \"CBLUE\"You are already logged in!\");
static
    Query[100];
format( Query, sizeof Query, \"SELECT `Username` FROM `Users` WHERE `Username` = \'%s\'\", GetPName( playerid ) );
mysql_query( Query );
mysql_store_result();
if( mysql_num_rows() != 0 ) return SendClientMessage( playerid, red, \"» \"CYELLOW\"Your account already exists! Please use /login <password>\"),mysql_free_result();
if( strlen( params ) > 23 || strlen( params ) < 0) return SendClientMessage( playerid, red, \"Your password cannot exceed 23 characters!1!!111\"),mysql_free_result();
new password = udb_hash( params );
format( Query, sizeof Query,\"INSERT INTO `Users` (`Username`, `Password`, `Money`, `Score`) VALUES (\'%s\', \'%i\', \'%i\', \'%i\')\",
GetPName( playerid ),
password,
GetPlayerMoney( playerid ),
GetPlayerScore( playerid ));
if( mysql_query( Query ))
{
    SendClientMessage( playerid, red, \"» \"green\"You have been successfully registered!\" );
    PInfo[playerid][Logged] = 1;
}
else
    SendClientMessage( playerid, red, \"» Some error occured. Please contact the server owner!\");
return 1;
}
 
CMD:login( playerid, params[] )
{
    if(PInfo[playerid][Logged] == 1) return SendClientMessage( playerid, red, \"» \"CBLUE\"You are already logged in!\");
static
    Query[100];
format( Query, sizeof Query, \"SELECT `Username` FROM `Users` WHERE `Username` = \'%s\'\", GetPName( playerid ) );
mysql_query( Query );
mysql_store_result();
if( mysql_num_rows() == 0 ) return SendClientMessage( playerid, red, \"» \"CYELLOW\"Your account does not exist! Use /register <password>\"),mysql_free_result();
if( strlen( params ) > 23 || strlen( params ) < 0) return SendClientMessage( playerid, red, \"Your password cannot exceed 23 characters!1!!111\"),mysql_free_result();
    new password = udb_hash( params );
format( Query, sizeof Query, \"SELECT `Username` FROM `Users` WHERE `Username` = \'%s\' AND `Password` = \'%i\'\",GetPName( playerid ), password);
mysql_query( Query );
mysql_store_result();
if(mysql_num_rows() == 0)
{
    SendClientMessage( playerid, red, \"» \"CYELLOW\"Wrong password!\");
}
else
{
    format( Query, sizeof Query, \"SELECT * FROM `Users` WHERE `Username` = \'%s\'\",GetPName( playerid ));
if(mysql_query( Query ))
{
    mysql_store_result();
    mysql_fetch_row_format( Query );
    sscanf(Query,\"e<p<|>s[23]iiii>\",PInfo[playerid]);
    PInfo[playerid][Logged] = 1;
    GivePlayerMoney( playerid, PInfo[playerid][Money] );
    SetPlayerScore( playerid, PInfo[playerid][score] );
}
else
    SendClientMessage( playerid, red, \"» Some error occured. Please contact the server owner!\");
}
mysql_free_result();
return 1;
}
stock GetPName( playerid )
{
new
pName[24];
GetPlayerName( playerid, pName, sizeof pName );
return pName;
}
stock udb_hash(buf[])
{
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal