Results 1 to 10 of 69

Thread: Saving a variable client-side (persistently)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #39
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    That should work most of the time.

    Keep in mind that if you're using a login system, do not let the player spawn until the bar() function has completed with success. If no success, re-try the query or try another query.

    Also, dont loop through your stats. Thats just plain stupid.


    PHP Code:
    loadstats()
    {
        
    result =  [[level.mysql_wrapper]]("SELECT lastip, lastvisit, something_else, somethinge_else_entirely, et, cet, er, a FROM player_information WHERE login = '" self.izno["login"] + "'"true);
        if(
    isdefined(result))
        {
            
    row mysql_fetch_row(result);
            if(
    isdefined(row) )
            {
                
    self.stats["lastip"] = row[0];
                
    self.stats["lastvisit"] = row[1];
                
    self.stats["something_else"] = int(row[2]);
                
    self.stats["something_else_entirely"] = int(row[3]);
                
    self.stats["et"] = int(row[4]);
                
    self.stats["cet"] = int(row[5]);
                
    self.stats["er"] = int(row[6]);
                
    self.stats["a"] = int(row[7]);
            }    
            
    mysql_free_result(result);
        }


    Already saves you 7 queries.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  2. The Following 2 Users Say Thank You to IzNoGoD For This Useful Post:

    agribilos (15th February 2021),kung foo man (16th February 2021)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •