iCEtIMed

Adding money and score to Player info?

5 posts in this topic

Hi all.

Does anyone know how to add the colums 'Money' and 'Score' from the 'account' table to the colums in the 'player' table?

Databases are not my strong suit and Im reluctant to start playing around with it!

Any pointers would be great. :)

Thanks.

Share this post


Link to post
Share on other sites

CREATE TABLE IF NOT EXISTS `player` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(64) NOT NULL,
  `account_uid` varchar(32) NOT NULL,
  `is_alive` tinyint(1) NOT NULL DEFAULT '1',
  `damage` double unsigned NOT NULL DEFAULT '0',
  `fatigue` double unsigned NOT NULL DEFAULT '0',
  `hunger` double unsigned NOT NULL DEFAULT '100',
  `thirst` double unsigned NOT NULL DEFAULT '100',
  `alcohol` double unsigned NOT NULL DEFAULT '0',
  `oxygen_remaining` double unsigned NOT NULL DEFAULT '1',
  `bleeding_remaining` double unsigned NOT NULL DEFAULT '0',
  `hitpoint_head` double unsigned NOT NULL,
  `hitpoint_body` double unsigned NOT NULL DEFAULT '0',
  `hitpoint_hands` double unsigned NOT NULL DEFAULT '0',
  `hitpoint_legs` double unsigned NOT NULL DEFAULT '0',
  `direction` double NOT NULL DEFAULT '0',
  `position_x` double NOT NULL DEFAULT '0',
  `position_y` double NOT NULL DEFAULT '0',
  `position_z` double NOT NULL DEFAULT '0',
  `spawned_at` datetime NOT NULL,
  `died_at` datetime DEFAULT NULL,
  `assigned_items` text NOT NULL,
  `backpack` varchar(64) NOT NULL,
  `backpack_items` text NOT NULL,
  `backpack_magazines` text NOT NULL,
  `backpack_weapons` text NOT NULL,
  `current_weapon` varchar(64) NOT NULL,
  `goggles` varchar(64) NOT NULL,

//Add Money & Score Colums

  `money` double NOT NULL DEFAULT '0',
  `score` int(11) NOT NULL DEFAULT '0',
  `handgun_items` varchar(255) NOT NULL,
  `handgun_weapon` varchar(64) NOT NULL,
  `headgear` varchar(64) NOT NULL,
  `binocular` varchar(64) NOT NULL,
  `loaded_magazines` varchar(255) NOT NULL,
  `primary_weapon` varchar(64) NOT NULL,
  `primary_weapon_items` varchar(255) NOT NULL,
  `secondary_weapon` varchar(64) NOT NULL,
  `secondary_weapon_items` varchar(255) NOT NULL,
  `uniform` varchar(64) NOT NULL,
  `uniform_items` text NOT NULL,
  `uniform_magazines` text NOT NULL,
  `uniform_weapons` text NOT NULL,
  `vest` varchar(64) NOT NULL,
  `vest_items` text NOT NULL,
  `vest_magazines` text NOT NULL,
  `vest_weapons` text NOT NULL,
  PRIMARY KEY (`id`),
  KEY `player_uid` (`account_uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Share this post


Link to post
Share on other sites
Advertisement

Why are you adding them? is probably a better question seeing as the player table is not meant to be a permanent record (ie. you should be clearing dead players from the database regularly).

You can link account and player already:

SELECT * 
FROM player,account 
WHERE account.uid = player.account_uid

 

Edited by second_coming

Share this post


Link to post
Share on other sites
On 18/11/2015 02:05:14, second_coming said:

Why are you adding them? is probably a better question seeing as the player table is not meant to be a permanent record (ie. you should be clearing dead players from the database regularly).

You can link account and player already:


SELECT * 
FROM player,account 
WHERE account.uid = player.account_uid

 

Thanks for both replys.

I have been having an issue where some players are losing poptabs and respect when they die. I just wanted to have a record of the last time they played so I can check on tehdatabse befor refunding.

Is this just me? I htought it was an issue with them recordning on the database.

Do youguys know of a solution for this?

Thanks again!

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.