March 28, 2024, 11:43:12 pm

Author Topic: Accounts Scripts  (Read 5375 times)

0 Members and 1 Guest are viewing this topic.

Hardened

  • Newbie
  • *
  • Posts: 3
    • View Profile
Accounts Scripts
« on: November 06, 2011, 07:54:28 am »
            Accounts Scripts

It's just an apt example of SQL Accounts Scripts.I have added just some cmds related with accounts. If you'll found any bug's you can inform me and i'll try to fix it as soon as possible. I hope you'll enjoy it and able to make own scripts from it's help.

Download:Click Here
« Last Edit: November 09, 2011, 05:40:03 am by Hardened »
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


Sephiroth

  • Guest
Re: Accounts Scripts
« Reply #1 on: November 06, 2011, 09:39:58 am »
These scripts aren't harmful or harry for you're computer.

Best..Quote....EVER
Cannot rate own posts


morphine

  • Crazy Man
  • *****
  • Posts: 1908
  • Country: lt
    • View Profile
Re: Accounts Scripts
« Reply #2 on: November 06, 2011, 10:49:38 am »
wtf
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


Thijn

  • Forum Administrator
  • Crazy Man
  • *
  • *
  • *
  • Posts: 2946
  • Country: nl
    • View Profile
Re: Accounts Scripts
« Reply #3 on: November 07, 2011, 03:58:23 pm »
Code: [Select]
        if ( player.IP != GetPlayerIP( player ) ) SetPlayerLogged( player, "false" );
        if ( player.IP == GetPlayerIP( player ) ) SetPlayerLogged( player, "true" );
bad bad bad, that does 2 queries for one something thing, you can just do
Code: [Select]
        if ( player.IP == GetPlayerIP( player ) ) SetPlayerLogged( player, "true" );
        else SetPlayerLogged( player, "true" );

And did you even test your changepass command, it seems that you forgot a return 0; in the PIn function.

Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

I'm not totally useless,
I can be used as an bad example ;)

"Never do Today, What you can do Tomorrow"


Hardened

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Accounts Scripts
« Reply #4 on: November 09, 2011, 05:38:55 am »
Quote
And did you even test your changepass command, it seems that you forgot a return 0; in the PIn function.

Thanks, I was forgot, fixed
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


Charley

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 4749
  • Country: 00
    • View Profile
Re: Accounts Scripts
« Reply #5 on: November 09, 2011, 10:08:23 am »
eee fuck, there are way too many queries in that script. You need to minimise the number of times you query the database, so as to reduce lag. You also need to free all of your queries when you're done with them.

Plus, using the database to indicate whether you're logged in or not and your level is ridiculous. If you query it every time you need to check that then your server will lag out when it gets past 10 or so players. All of these queries and it doesn't even include kills/deaths/joins stats either.

I suggest you go away and look at classes and arrays. Remake your script with as few queries as possible, instead assign players class entries in an array.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

Writer of excessively long posts


Foxtrot

  • Crazy Man
  • *****
  • Posts: 383
  • Country: 00
    • View Profile
Re: Accounts Scripts
« Reply #6 on: November 09, 2011, 05:43:43 pm »
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


stormeus

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 1755
  • Country: us
  • VC:MP Developer
    • View Profile
    • GTA VICE CITY Respective owner
Re: Accounts Scripts
« Reply #7 on: November 09, 2011, 08:17:29 pm »
A decent start, but in no way ready for use in a production server.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

<krystianoo> stormeus do good job
<krystianoo> with recent update
<krystianoo> if not agree; jeb yourself in head
<Avenger> yesterday you said death to stormeus
<karan> double standard krystianoo
<karan> he called him fake prophet too
<krystianoo> sure fake prophet
<krystianoo> but with recent updates real

morphine

  • Crazy Man
  • *****
  • Posts: 1908
  • Country: lt
    • View Profile
Re: Accounts Scripts
« Reply #8 on: November 09, 2011, 08:26:40 pm »
I took a look at it myself and indeed it does too much of querying. Even though I'm a bit new to SQL this is not what I expected an accounts system to be. Thanks for PMing me about this on IRC though, Hardened. I'd rather stick to my own development for now.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


Hardened

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Accounts Scripts
« Reply #9 on: November 10, 2011, 10:40:56 am »
Guys, i posted these scripts as a Squirrel SQL example not for anything else
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


Thijn

  • Forum Administrator
  • Crazy Man
  • *
  • *
  • *
  • Posts: 2946
  • Country: nl
    • View Profile
Re: Accounts Scripts
« Reply #10 on: November 10, 2011, 01:12:29 pm »
Guys, i posted these scripts as a Squirrel SQL example not for anything else
Then you made a bad example.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

I'm not totally useless,
I can be used as an bad example ;)

"Never do Today, What you can do Tomorrow"


Skirmant

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 681
  • Country: il
  • Ignorance is bliss.
    • View Profile
Re: Accounts Scripts
« Reply #11 on: November 11, 2011, 06:59:14 am »
Sorry if this may sound kind of ignorant, but what does QuerySQL do anyways? So it writes into a file with the SQL language. What's the point? Why not just write data into a simple INI file?
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

"C++ is a horrible language" - Linus Torvalds, creator of Linux

Quote
<SLC> nope. changed my mind. squirrel still sux dix
<SLC> it's just a piece of sh!t
* SLC has quit (Connection closed)

Thijn

  • Forum Administrator
  • Crazy Man
  • *
  • *
  • *
  • Posts: 2946
  • Country: nl
    • View Profile
Re: Accounts Scripts
« Reply #12 on: November 11, 2011, 08:32:43 am »
Sorry if this may sound kind of ignorant, but what does QuerySQL do anyways? So it writes into a file with the SQL language. What's the point? Why not just write data into a simple INI file?
I must say, I was wondering the same after noticing SvM was again warping like a butthole...
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

I'm not totally useless,
I can be used as an bad example ;)

"Never do Today, What you can do Tomorrow"


Charley

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 4749
  • Country: 00
    • View Profile
Re: Accounts Scripts
« Reply #13 on: November 11, 2011, 10:25:12 am »
Sorry if this may sound kind of ignorant, but what does QuerySQL do anyways? So it writes into a file with the SQL language. What's the point? Why not just write data into a simple INI file?

It's quite a lot faster than INI, it is also more manipulable. It can be used as part of the script itself, instead of just a way to store data. Take a look at this http://www.w3schools.com/sql/default.asp to see the different SQL functions.

SQL itself shouldn't make a server warp unless it's over used. I can only speak from experience here, SvM warps and has always warped, no matter what we do to the SQL so I feel that it ain't to do with that. XE didn't used to warp but now it does, after having not touched the SQL either. The difference between the XE that warped and the XE that didn't was a different version of the server.


When SQL files are queried for data, the data is held in a virtual table in the RAM. This data then needs to be freed to stop a memory leak. The old server did not free the data properly, the new one does. However, my theory which VRocker supports is that the process that the new one uses to free data takes quite a bit of processing power. XE is hosted on a very basic machine, so whenever the server frees a bunch of data it warps for a second or two. This should be fixable by moving to a more powerful hosting machine. Thus it shouldn't be a problem for most people, as the machine that XE is hosted on atm is quite weak.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

Writer of excessively long posts


Skirmant

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 681
  • Country: il
  • Ignorance is bliss.
    • View Profile
Re: Accounts Scripts
« Reply #14 on: November 11, 2011, 02:46:21 pm »
It's quite a lot faster than INI, it is also more manipulable.

 Not sure about manipulation, but the speed depends on what you mean and what you're doing. Yes it is faster to write already formatted data to a file than write unformulated data into an INI which is formatted at the point of reading the file. But the process of formatting data before writing it can be used for INI files as well and result in greater performance than SQL, do to the greater simplicity.

 And for the record. By formatted data I mean the content of the entire modified file.
 
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

"C++ is a horrible language" - Linus Torvalds, creator of Linux

Quote
<SLC> nope. changed my mind. squirrel still sux dix
<SLC> it's just a piece of sh!t
* SLC has quit (Connection closed)