Getting kicked players
#1

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?
Reply
#2



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.
Reply
#3

Quote:
Originally Posted by Hansrutger
Посмотреть сообщение


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.
Ok, i really didn't understand that my table

Код:
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.netnl67713e3d942f7...2.90218758-- 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 */;
Reply
#4

Simply increase the value of a field in your database every time a player gets kicked lol
Reply
#5

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
Reply
#6

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(mysqlquerysizeof(query), "SELECT COUNT(Total Kicked) AS tk FROM serverinfo WHERE Total Kicked = 0;");
    
mysql_query(mysqlquery);
format(string,sizeof(string),"%s\nTotal kicked players: %d"stringtk); 
still shows 0 in the dialog
Reply
#7

Try:
PHP код:
stock CountTotalKicks()
{
    new 
query[256], count;
                                                                                                                                     
    
mysql_query(mysql"SELECT COUNT(*) FROM serverinfo WHERE Total Kicked");
   
count cache_get_row_int(00);
    
    return 
count

Put it in your string.
PHP код:
format(string,sizeof(string),"%s\nTotal kicked players: %d"stringCountTotalKicks()); 
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.
Reply
#8

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(00);
    
    return 
count

Put it in your string.
PHP код:
format(string,sizeof(string),"%s\nTotal kicked players: %d"stringCountTotalKicks()); 
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(00count); 
Reply
#9

Yes, use that then. Did it work?
Reply
#10

Quote:
Originally Posted by Loinal
Посмотреть сообщение
ok i use mysql +40

so it be

PHP код:
cache_get_value_index_int(00count); 
ok now it still at 3 kicks doesn't add other kicks
Reply
#11

Quote:
Originally Posted by Arthur Kane
View Post
Yes, use that then. Did it work?
No it didn't
Reply
#12

bumb
Reply
#13

Quote:
Originally Posted by Loinal
View Post
bumb
24 hour bumps only.
Reply
#14

Quote:
Originally Posted by Sew_Sumi
View Post
24 hour bumps only.
Ok, but i need it
Reply
#15

I don't see a reason for which you should send an update query to database on each kick.
Reply
#16

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!
Reply
#17

Quote:
Originally Posted by iLearner
View Post
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
Reply
#18

Quote:
Originally Posted by Loinal
View Post
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.
Reply
#19

Quote:
Originally Posted by Sew_Sumi
View Post
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?
Reply
#20

bumb
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)