SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Gamemode Scripts

Reply
 
Thread Tools Display Modes
Old 31/01/2011, 03:22 AM   #21
Rocketeer
Big Clucker
 
Rocketeer's Avatar
 
Join Date: Jan 2011
Location: New Jersey
Posts: 96
Reputation: 2
Default Re: Clean, Simple MySQL GM..

what if player forgets his or her password? how to i change it in MysQl database?
Also, what does md5 means?
Rocketeer is offline   Reply With Quote
Old 31/01/2011, 03:25 AM   #22
[L3th4l]
Guest
 
Posts: n/a
Default Re: Clean, Simple MySQL GM..

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 Code:
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 With Quote
Old 31/01/2011, 03:27 AM   #23
Rocketeer
Big Clucker
 
Rocketeer's Avatar
 
Join Date: Jan 2011
Location: New Jersey
Posts: 96
Reputation: 2
Default Re: Clean, Simple MySQL GM..

Thanks alot, but why not tho? its just a variable just like all others.
Player commands does not work
Rocketeer is offline   Reply With Quote
Old 31/01/2011, 11:32 AM   #24
marmigs
Big Clucker
 
marmigs's Avatar
 
Join Date: May 2009
Location: /home/marmigs
Posts: 131
Reputation: 3
Default Re: Clean, Simple MySQL GM..

I have a question.

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

pawn Code:
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 Code:
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
__________________
Not PPC - Unique - www.sa-trucking.co.uk
Beta v0.2 - We are looking for Admins/Mapper
marmigs is offline   Reply With Quote
Old 31/01/2011, 01:09 PM   #25
HyperZ
High-roller
 
HyperZ's Avatar
 
Join Date: Aug 2009
Location: Pakistan
Posts: 1,385
Reputation: 59
Default Re: Clean, Simple MySQL GM..

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)

Last edited by HyperZ; 31/01/2011 at 01:14 PM. Reason: Bla Bla Bla
HyperZ is offline   Reply With Quote
Old 31/01/2011, 08:36 PM   #26
Rocketeer
Big Clucker
 
Rocketeer's Avatar
 
Join Date: Jan 2011
Location: New Jersey
Posts: 96
Reputation: 2
Default Re: Clean, Simple MySQL GM..

[L3th4l] if you could, just make a command when players can change their own passwords, the one u gave me doesnot work
Rocketeer is offline   Reply With Quote
Old 31/01/2011, 08:48 PM   #27
Duke11
Little Clucker
 
Join Date: Sep 2008
Posts: 12
Reputation: 0
Default Re: Clean, Simple MySQL GM..

Goddamn Nice script. Here's a little request i would like to see ,cause i dont enjoy scripting myself,but i would apperciate
Duke11 is offline   Reply With Quote
Old 31/01/2011, 10:41 PM   #28
[L3th4l]
Guest
 
Posts: n/a
Default Re: Clean, Simple MySQL GM..

@ MarMigs:
pawn Code:
e<p<|>s[24]s[35]dddddfffd>

Also remember to update the DB info

@ Clive:
I have no idea why that's happening.

@Rocketeer:

I'll fix it
  Reply With Quote
Old 31/01/2011, 10:43 PM   #29
Rocketeer
Big Clucker
 
Rocketeer's Avatar
 
Join Date: Jan 2011
Location: New Jersey
Posts: 96
Reputation: 2
Default Re: Clean, Simple MySQL GM..

Ok. waiting bro
Rocketeer is offline   Reply With Quote
Old 31/01/2011, 11:12 PM   #30
[L3th4l]
Guest
 
Posts: n/a
Default Re: Clean, Simple MySQL GM..

pawn Code:
CMD:changepass(playerid, params[])
{
    new
        EscPass[40],
        Query[128],
        iStr[55];

    if(isnull(params)) return SendClientMessage(playerid, -1, ""#CRED"Usage: "#CORANGE"/ChangePass < New Password >");

    mysql_real_escape_string(params, EscPass);
    format(Query, sizeof(Query), "UPDATE `playerinfo` SET `password` = md5('%s') WHERE `user` = '%s'", EscPass, pName(playerid));
    mysql_query(Query);
   
    format(iStr, sizeof(iStr), "You've changed your password to: "#CBLUE"%s", params);
    SendClientMessage(playerid, -1, iStr);
    return 1;
}

It's working fine for me.
  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] C-MYSQL (Remade) - Increased Speed & More Simple Carlton Includes 55 12/07/2013 09:13 AM
[Tutorial] Creating a MySQL account system (Simple) Carlton Tutorials 11 14/05/2013 01:42 PM
File or Function is not found, Clean MYSQL Script Triple X Server Support 1 01/01/2011 09:54 AM
Simple MySQL reading crashes the Server virtualmarc Help Archive 4 20/09/2009 02:28 PM


All times are GMT. The time now is 12:51 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.