Raised This Month: $ Target: $400
 0% 

Verify online users.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
killergirl
Senior Member
Join Date: Jul 2010
Old 10-06-2010 , 11:47   Verify online users.
Reply With Quote #1

I need a little help to my script. I don't know is there exist a command to check if there are online users like:

PHP Code:
if(!is_there_online_users(){
execute
}
else{
execute this

killergirl is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 10-06-2010 , 12:16   Re: Verify online users.
Reply With Quote #2

With get_players you can do that.get_players()
If second parameter (&num) is 0, there are nor players in the server
Also, function is_user_connected() return if the user is connected or not.
Mxnn is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 10-06-2010 , 12:26   Re: Verify online users.
Reply With Quote #3

PHP Code:
/* Returns number of players put in server. 
* If flag is set then also connecting are counted. */
native get_playersnum(flag=0); 
__________________
hleV is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 10-06-2010 , 12:29   Re: Verify online users.
Reply With Quote #4

Thank you for fast reply. I solved the problem.

(I have a war server and I want to make additional scripts, to moderate the game if there is no admins online.)

I have a second question about "maximum team score". So is there 2 players, one CT and one T, and somebody reach the maximum score allowed, suddenly both get's a team switch.

Eg. T reach 10 allowed score and he will be changed to CT, and the CT player changed to T, after the switch the game will be restarted.

Any ideas?
killergirl is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 10-06-2010 , 14:25   Re: Verify online users.
Reply With Quote #5

Quote:
Originally Posted by killergirl View Post
Thank you for fast reply. I solved the problem.

(I have a war server and I want to make additional scripts, to moderate the game if there is no admins online.)

I have a second question about "maximum team score". So is there 2 players, one CT and one T, and somebody reach the maximum score allowed, suddenly both get's a team switch.

Eg. T reach 10 allowed score and he will be changed to CT, and the CT player changed to T, after the switch the game will be restarted.

Any ideas?
Look up the DeathMsg event.

PHP Code:
new t_Score;
public 
deathmsgevent()
{
     new 
iKiller read_data(1)
     
     if( 
get_user_team(iKiller) == )
     {
          
t_Score++

          if( 
t_Score == 10 )
          {
               
//end the round the way that best fits you
          
}
     }

use get_user_team(iKiller) == 2 to retrieve CT's, and increase a variable the same way. Hope you understand.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 10-06-2010 , 15:20   Re: Verify online users.
Reply With Quote #6

PHP Code:
#include <amxmodx>
#include <cstrike>

new t_Score;
new 
ct_Score;

public 
plugin_init(){
    
register_plugin("CT T Switch""1.0""Author")
    
    
register_event("DeathMsg""deathmsgevent""a")
}

public 
deathmsgevent(){
    
    new 
iKiller read_data(1)
    new 
iKillertwo read_data(1)
    
    if( 
get_user_team(iKiller) == )
    {
        
t_Score++
        
        if( 
t_Score == 10 )
        {
            if(
get_user_team(iKiller) == CS_TEAM_T){
                
cs_set_user_team(iKiller,CS_TEAM_CT)
                
cs_set_user_team(iKillertwo,CS_TEAM_T)
            }
            else{
                
client_print(0print_chat"Something is wrong! TERRORIST")
            }
        }
        else{
            return 
PLUGIN_CONTINUE;
        }
    }
    if( 
get_user_team(iKillertwo) == )
    {
        
ct_Score++
        
        if( 
ct_Score == 10 )
        {
            if(
get_user_team(iKillertwo) == CS_TEAM_CT){
                
cs_set_user_team(iKiller,CS_TEAM_CT)
                
cs_set_user_team(iKillertwo,CS_TEAM_T)
            }
            else{
                
client_print(0print_chat"Something is wrong! CT")
            }
        }
        else{
            return 
PLUGIN_CONTINUE;
        }
    }
    return 
PLUGIN_CONTINUE;

I don't know is this ok, or maybe I need to change here?
PHP Code:
###
if(get_user_team(iKiller) == CS_TEAM_T)
###
if(get_user_team(iKillertwo) == CS_TEAM_CT)
### 
with:
PHP Code:
###
if(get_user_team(iKiller) == 1)
###
if(get_user_team(iKillertwo) == 1)
### 
killergirl is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 10-06-2010 , 15:33   Re: Verify online users.
Reply With Quote #7

Use cs_get_user_team() if it's for CS. And you're retrieving same players' teams twice for unknown reason.
__________________
hleV is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 10-06-2010 , 15:34   Re: Verify online users.
Reply With Quote #8

Quote:
Originally Posted by killergirl View Post
PHP Code:
#include <amxmodx>
#include <cstrike>

new t_Score;
new 
ct_Score;

public 
plugin_init(){
    
register_plugin("CT T Switch""1.0""Author")
    
    
register_event("DeathMsg""deathmsgevent""a")
}

public 
deathmsgevent(){
    
    new 
iKiller read_data(1)
    new 
iKillertwo read_data(1)
    
    if( 
get_user_team(iKiller) == )
    {
        
t_Score++
        
        if( 
t_Score == 10 )
        {
            if(
get_user_team(iKiller) == CS_TEAM_T){
                
cs_set_user_team(iKiller,CS_TEAM_CT)
                
cs_set_user_team(iKillertwo,CS_TEAM_T)
            }
            else{
                
client_print(0print_chat"Something is wrong! TERRORIST")
            }
        }
        else{
            return 
PLUGIN_CONTINUE;
        }
    }
    if( 
get_user_team(iKillertwo) == )
    {
        
ct_Score++
        
        if( 
ct_Score == 10 )
        {
            if(
get_user_team(iKillertwo) == CS_TEAM_CT){
                
cs_set_user_team(iKiller,CS_TEAM_CT)
                
cs_set_user_team(iKillertwo,CS_TEAM_T)
            }
            else{
                
client_print(0print_chat"Something is wrong! CT")
            }
        }
        else{
            return 
PLUGIN_CONTINUE;
        }
    }
    return 
PLUGIN_CONTINUE;

I don't know is this ok, or maybe I need to change here?
PHP Code:
###
if(get_user_team(iKiller) == CS_TEAM_T)
###
if(get_user_team(iKillertwo) == CS_TEAM_CT)
### 
with:
PHP Code:
###
if(get_user_team(iKiller) == 1)
###
if(get_user_team(iKillertwo) == 1)
### 
You only need one iKiller. It will get a new killer every time, don't worry.

To get the victim, use something like

new iVictim = read_data(2)
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 10-06-2010 , 15:51   Re: Verify online users.
Reply With Quote #9

PHP Code:
#include <amxmodx>
#include <cstrike>

new t_Score

public plugin_init(){
    
register_plugin("CT T Switch""1.0""Author")
    
    
register_event("DeathMsg""deathmsgevent""a")
}

public 
deathmsgevent(){
    
    new 
iKiller read_data(1)
    new 
iVictim read_data(2
    
    if( 
get_user_team(iKiller) == )
    {
        
t_Score++
        
        if( 
t_Score == 10 )
        {
            if(
get_user_team(iKiller) == 1){
                
cs_set_user_team(iKiller,CS_TEAM_CT)
                
cs_set_user_team(iVictim,CS_TEAM_T)
            }
            else{
                
client_print(0print_chat"Something is wrong!")
            }
        }
        else{
            return 
PLUGIN_CONTINUE;
        }
    }
    return 
PLUGIN_CONTINUE;

I'm so stupid, I can't understand what are you guys talking about
killergirl is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 10-06-2010 , 15:54   Re: Verify online users.
Reply With Quote #10

Quote:
Originally Posted by killergirl View Post
PHP Code:
#include <amxmodx>
#include <cstrike>

new t_Score

public plugin_init(){
    
register_plugin("CT T Switch""1.0""Author")
    
    
register_event("DeathMsg""deathmsgevent""a")
}

public 
deathmsgevent(){
    
    new 
iKiller read_data(1)
    new 
iVictim read_data(2
    
    if( 
get_user_team(iKiller) == )
    {
        
t_Score++
        
        if( 
t_Score == 10 )
        {
            if(
get_user_team(iKiller) == 1){
                
cs_set_user_team(iKiller,CS_TEAM_CT)
                
cs_set_user_team(iVictim,CS_TEAM_T)
            }
            else{
                
client_print(0print_chat"Something is wrong!")
            }
        }
        else{
            return 
PLUGIN_CONTINUE;
        }
    }
    return 
PLUGIN_CONTINUE;

I'm so stupid, I can't understand what are you guys talking about
Why are you retrieving the killers team twice?
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:28.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode