[GameMode] Clean, Simple MySQL GM..
#21

what if player forgets his or her password? how to i change it in MysQl database?
Also, what does md5 means?
Reply
#22

MD5 is way of hashing passwords, that way it protects their passwords from others to see.

You can't change the passwords from DB

pawn Код:
CMD:changeppass(playerid, params[])
{
    if(PVar[playerid][pLevel] >= 4)
    {
        new
            EscPass[40],
            Query[128],
            iStr[80],
            PID;
           
        if(sscanf(params, "us[40]", PID, params)) return SendClientMessage(playerid, -1, ""#CRED"Usage: "#CORANGE"/ChangePPass < Player ID > < New Password >");
       
        if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_RED, "That user is not connected!");
       
        mysql_real_escape_string(params, EscPass);
        format(Query, sizeof(Query), "UPDATE `playerinfo` SET `password` = md5('%s') WHERE `user` = '%s'", EscPass, pName(PID));
        mysql_query(Query);
       
        format(iStr, sizeof(iStr), ""#CDGREEN"Admin: %s(%d) has changed your pass to: "#CBLUE"%s", pName(playerid), playerid, params);
        SendClientMessage(PID, -1, iStr);
        return 1;
    }
    else return SendClientMessage(playerid, COLOR_RED, "Only admin level 4 + can use that command!");
}
^ Admin command.
Reply
#23

Thanks alot, but why not tho? its just a variable just like all others.
Player commands does not work
Reply
#24

I have a question.

I have changed all in SavePInfo and MySQL database to save the score. here is the code

pawn Код:
stock SavePInfo(playerid)
{
    if(GetPVarInt(playerid, "LoggedIN") == 1)
    {
        new
            Query[600];

        format(Query, sizeof(Query), "UPDATE `playerinfo` SET `kills` = %d,`score` = %d, `deaths` = %d, `money` = %d, `Level` = %d, `Last Pos X` = %f, `Last Pos Y` = %f, `Last Pos Z` = %f, `Interior` = %d WHERE `user` = '%s'", // Also remember to update this...

        PVar[playerid][pKills],
        GetPlayerScore(playerid), // <---- This is my change. see score in SQL code too.
        PVar[playerid][pDeaths],
        GetPlayerMoney(playerid),
        PVar[playerid][pLevel],
        PVar[playerid][pLastX],
        PVar[playerid][pLastY],
        PVar[playerid][pLastZ],
        GetPlayerInterior(playerid),
        pName(playerid));

        mysql_query(Query);
        mysql_free_result();
        return 1;
    }
    else return 0;
}
But I don't know much of sscanf and I can't understand what to change in load pinfo.

pawn Код:
stock LoadPlayerInfo(iPlayer)
{
    new
        Query[700];

    if(mysql_fetch_row(Query))
    {
        sscanf(Query, "e<p<|>s[24]s[35]ddddfffd>", PVar[iPlayer]); // Remember to update this if you add more info...
        mysql_free_result();
    }
    return 1;
}
I would like to know how to change this.

Best Regards,

MarMigs
Reply
#25

I have an old version of phpMyAdmin, Version 3.3.8.1 it'll works on that version? :S

I have some errors in MySQL Logs and server crashing

Quote:

[14:10:45]

[14:10:45] ---------------------------

[14:10:45] MySQL Debugging activated (01/09/11)

[14:10:45] ---------------------------

[14:10:45]

[14:10:45] >> mysql_connect( )

[14:10:45] CMySQLHandler::CMySQLHandler() - constructor called.

[14:10:45] CMySQLHandler::CMySQLHandler() - Connecting to "89.248.172.138" | DB: "pawno_samp" | Username: "pawno_lol" ...

[14:10:46] CMySQLHandler::Connect() - Can't connect to MySQL server on '89.248.172.138' (10061) (Error ID: 2003)

[14:10:46] >> mysql_query( Connection handle: 1 )

[14:10:46] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)

[14:10:46] >> mysql_store_result( Connection handle: 1 )

[14:10:46] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead)

[14:10:46] >> mysql_retrieve_row( Connection handle: 1 )

[14:10:46] CMySQLHandler::RetrieveRow() - You cannot call this function now. (Reason: Connection is dead)

[14:10:46] >> mysql_free_result( Connection handle: 1 )

[14:10:46] CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead)

[14:10:46] >> mysql_query( Connection handle: 1 )

[14:10:46] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)

[14:10:46] >> mysql_store_result( Connection handle: 1 )

[14:10:46] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead)

[14:10:46] >> mysql_num_rows( Connection handle: 1 )

[14:10:46] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)

[14:10:46] >> mysql_free_result( Connection handle: 1 )

[14:10:46] CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead)

Reply
#26

[L3th4l] if you could, just make a command when players can change their own passwords, the one u gave me doesnot work
Reply
#27

i got a problem i cant create a database called that how can i edit it so my database is a different name?

Many thanks
Reply
#28

Just crashing when i try to log on ?
Reply
#29

it askes me to login, while i havent even registered! so i dont have a password...
Reply
#30

For me when i try to spawn it says "Stay within world boundries"
Reply
#31

Quote:
Originally Posted by wolfcock
Посмотреть сообщение
For me when i try to spawn it says "Stay within world boundries"
You are missing AddPlayerClass(...). Make sure you add one.
Reply
#32

Why its asking for login when not even registered?
Reply
#33

How can I let the script withdraw my money when I join the server?
Reply
#34

When connecting, the register dialog etc doesn't appear. Anyone able to help?
Reply
#35

Xd know why?
Код:
[Err] 1046 - No database selected
[Err] --
-- Database: `mysql2`
--

-- --------------------------------------------------------

--
-- Table structure for table `labels`
--

CREATE TABLE IF NOT EXISTS `labels` (
  `LabelX` float NOT NULL,
  `LabelY` float NOT NULL,
  `LabelZ` float NOT NULL,
  `LabelInfo` varchar(128) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
[Msg] Finished - Unsuccessfully
[/QUOTE]
Reply
#36

I can not get the admin privileges, when I login as rcon using /rcon login [password] it logs me in and when I try the command /setlevel [ID] [Level] it says the player is not connected.

I am only online with ID 0 and when I put id 0 it still gives my the same message.

Any solutions?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)