Getting kicked players -
Loinal - 03.06.2017
Ok, so iam creating a server database which include total registered players , total kicked players
So how can i get the count of the kicked players from the database?
Re: Getting kicked players -
Hansrutger - 03.06.2017
The thread below you is what you're looking for xD
https://sampforum.blast.hk/showthread.php?tid=635145
There's other ways, you don't particularly have to use mysql_pquery, but the SQL principle is the same.
Re: Getting kicked players -
Loinal - 03.06.2017
Quote:
Originally Posted by Hansrutger
|
Ok, i really didn't understand that my table
Код:
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jun 03, 2017 at 02:00 AM
-- Server version: 10.1.19-MariaDB
-- PHP Version: 5.5.38
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `zx`
--
-- --------------------------------------------------------
--
-- Table structure for table `serverinfo`
--
CREATE TABLE `serverinfo` (
`Total Kicked` int(11) NOT NULL,
`Total Banned` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Re: Getting kicked players -
CheezIt - 03.06.2017
Simply increase the value of a field in your database every time a player gets kicked lol
Re: Getting kicked players -
Loinal - 03.06.2017
Quote:
Originally Posted by CheezIt
Simply increase the value of a field in your database every time a player gets kicked lol
|
No i need to get it from the db
Re: Getting kicked players -
Loinal - 03.06.2017
My kick command have
PHP код:
totalkicked++;
mysql_format(mysql,query,sizeof(query),"UPDATE `serverinfo` SET `Total Kicked` = %d", totalkicked);
mysql_query(mysql,query);
and the command to check
PHP код:
mysql_format(mysql, query, sizeof(query), "SELECT COUNT(Total Kicked) AS tk FROM serverinfo WHERE Total Kicked = 0;");
mysql_query(mysql, query);
format(string,sizeof(string),"%s\nTotal kicked players: %d", string, tk);
still shows 0 in the dialog
Re: Getting kicked players -
Kane - 03.06.2017
Try:
PHP код:
stock CountTotalKicks()
{
new query[256], count;
mysql_query(mysql, "SELECT COUNT(*) FROM serverinfo WHERE Total Kicked");
count = cache_get_row_int(0, 0);
return count;
}
Put it in your string.
PHP код:
format(string,sizeof(string),"%s\nTotal kicked players: %d", string, CountTotalKicks());
Not guaranteed to work. I don't have much experience but I'm going off what I just learned from my own thread. I ran a query like that in phpMyAdmin and it worked so it might too.
Re: Getting kicked players -
Loinal - 03.06.2017
Quote:
Originally Posted by Arthur Kane
Try:
PHP код:
stock CountTotalKicks()
{
new query[256], count;
mysql_query(mysql, "SELECT COUNT(*) FROM serverinfo WHERE Total Kicked");
count = cache_get_row_int(0, 0);
return count;
}
Put it in your string.
PHP код:
format(string,sizeof(string),"%s\nTotal kicked players: %d", string, CountTotalKicks());
Not guaranteed to work. I don't have much experience but I'm going off what I just learned from my own thread. I ran a query like that in phpMyAdmin and it worked so it might too.
|
ok i use mysql +40
so it be
PHP код:
cache_get_value_index_int(0, 0, count);
Re: Getting kicked players -
Kane - 03.06.2017
Yes, use that then. Did it work?
Re: Getting kicked players -
Loinal - 03.06.2017
Quote:
Originally Posted by Loinal
ok i use mysql +40
so it be
PHP код:
cache_get_value_index_int(0, 0, count);
|
ok now it still at 3 kicks doesn't add other kicks
Re: Getting kicked players -
Loinal - 03.06.2017
Quote:
Originally Posted by Arthur Kane
Yes, use that then. Did it work?
|
No it didn't
Re: Getting kicked players -
Loinal - 03.06.2017
bumb
Re: Getting kicked players -
Sew_Sumi - 03.06.2017
Quote:
Originally Posted by Loinal
bumb
|
24 hour bumps only.
Re: Getting kicked players -
Loinal - 03.06.2017
Quote:
Originally Posted by Sew_Sumi
24 hour bumps only.
|
Ok, but i need it
Re: Getting kicked players -
iLearner - 03.06.2017
I don't see a reason for which you should send an update query to database on each kick.
Re: Getting kicked players -
Hunud - 03.06.2017
Why do you even work with MYSQL ? Far as i see in your posts you don't know any single shit and seems like you just copy/paste it!
Re: Getting kicked players -
Loinal - 03.06.2017
Quote:
Originally Posted by iLearner
I don't see a reason for which you should send an update query to database on each kick.
|
To change total kicks happens in the server and save at db and load at the dialog
Re: Getting kicked players -
Sew_Sumi - 03.06.2017
Quote:
Originally Posted by Loinal
Ok, but i need it
|
You've been here long enough to know, you've also no doubt been told before...
Need it or not, you still should be abiding by the rules for the forums. 24 hour bumps only.
Re: Getting kicked players -
Loinal - 03.06.2017
Quote:
Originally Posted by Sew_Sumi
You've been here long enough to know, you've also no doubt been told before...
Need it or not, you still should be abiding by the rules for the forums. 24 hour bumps only.
|
Ok thanks for that, Now no one can fix it right?
Re: Getting kicked players -
Loinal - 04.06.2017
bumb