Guest User

database type thing

a guest
Feb 12th, 2015
37
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class databaseflowclass expands actor   config(playerdb);
  2.  
  3. Struct datbase_structure
  4. {
  5. var() string player, property,value;
  6. };
  7.  
  8.  
  9. var () config  array<datbase_structure> playerdatadb;
  10.  
  11. function string  getdatavalue (string xplayer , string xproperty)
  12. {
  13. local int i;
  14.  For( i = 0; i <  Array_Size(playerdatadb) ; i++  )
  15.     {
  16.                           if (playerdatadb[i].player ==xplayer && playerdatadb[i].property == xproperty )
  17.                           {
  18.                            return  playerdatadb[i].property;
  19.                           }
  20.  
  21.  
  22.     }
  23.     return "nil";
  24. }
  25.  
  26.  
  27.  
  28. function bool  updatedatavalue (string xplayer , string xproperty,string xvalue)
  29. {
  30.  
  31. local int i,reqestednumber;
  32. local bool found;
  33.  For( i = 0; i <  Array_Size(playerdatadb) ; i++  )
  34.     {
  35.                           if (playerdatadb[i].player ==xplayer && playerdatadb[i].property == xproperty && !found )
  36.                           {
  37.                           reqestednumber = i;
  38.                           found = true;
  39.                           playerdatadb[i].value = xvalue;
  40.                           saveconfig();
  41.                           log (" we found out requested data at " $ reqestednumber);
  42.                           }
  43.  
  44.  
  45.     }
  46.  
  47.  
  48.     if (!found)
  49.     {
  50.                          i = Array_Size(playerdatadb) -1;
  51.                          Array_Insert(playerdatadb,Array_Size(playerdatadb),1);
  52.                          playerdatadb[i].warpname=wordlist[1];
  53.                          playerdatadb[i].mapname=string(level.outer);
  54.                          playerdatadb[i].zlocation=tempp.location;
  55.                          log ("new entry")
  56.                          saveconfig();
  57.  
  58.                          // yewa call ourself   again ;)
  59.                          updatedatavalue(xplayer,xproperty,xvalue);
  60.  
  61.  
  62.  
  63.  
  64.     }
  65.  
  66.  
  67.  
  68.  
  69.  
  70. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×