Raised This Month: $ Target: $400
 0% 

Kick no-steam ppl


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 05-27-2007 , 16:21   Kick no-steam ppl
Reply With Quote #1

Hi.I have this plugin that supose to act like this:"When the server is full and a player with steam is connecting, kick a random "no-steam" player!"
*I dunno how to kick a random "no-steam" player,maybe a stock or....,
*I don't know i plugin works!Someone tells me is not working...


Thanks.
Attached Files
File Type: sma Get Plugin or Get Source (advanced_steam_slot.sma - 883 views - 1.1 KB)
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 05-27-2007 , 16:28   Re: Kick no-steam ppl
Reply With Quote #2

Your checking here if the user is a bot.
PHP Code:
if(!is_user_bot(id))
  return 
0
Checking the players authid is pretty much useless here since your going to loop to all the players in player_kick() function
PHP Code:
new authid[32]
 
get_user_authid(id,authid,31)
 
 if(
players limit
 {
  if(
containi(authid,"STEAM_ID_PENDING"))
  {
   
player_kick()
  }
 
 } 
Also the right usage of "containi" is
PHP Code:
if(containi(authid,"STEAM_ID_PENDING") != -1
Because it returns -1 if it cant find anything.
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.

Last edited by Cheap_Suit; 05-27-2007 at 16:33.
Cheap_Suit is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-27-2007 , 20:25   Re: Kick no-steam ppl
Reply With Quote #3

Im bored so i fixed cheap_suit's suggestions/hints and optimized a little..
Hope that is ok ;)

The returns are strange i would return PLUGIN_HANDLED or PLUGIN_CONTINUE, but i don't know which is better so i don't touched this..0o

Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Advanced Steam slot"
#define VERSION "1.0"
#define AUTHOR "Alka"

new g_maxplayers

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    g_maxplayers = get_maxplayers();
}

public client_connect(id)
{
    if(is_user_bot(id)) return 0;
    
    new players = get_playersnum(1);
    new limit = g_maxplayers - get_cvar_num("amx_reservation");
        
    if(players > limit) 
    {
        new authid[32];
        get_user_authid(id,authid,31);
        if(containi(authid,"STEAM_ID_PENDING") != -1)
        {
            player_kick();
        }
    }
    return 0;
}

public player_kick()
{
    new players[32], inum, i, player;
    get_players(players,inum);
    
    for(i = 0; i < inum; i++)
    {
        player = players[i];
        
        new authid[32];
        get_user_authid(player,authid,31);
        
        if(!equal(authid,"STEAM_ID_PENDING") && (containi(authid,"STEAM_0:0") == -1) && (containi(authid,"STEAM_0:1") == -1))
        {
            server_cmd("kick #%i A player with SteamID connected! Buy Steam for reserved slot!",get_user_userid(player));
        }
    }
    return 1;
}
greetz regalis
__________________
regalis is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 05-28-2007 , 03:31   Re: Kick no-steam ppl
Reply With Quote #4

heh thanks ^^!! but strange code

Code:
        if(!equal(authid,"STEAM_ID_PENDING") && (containi(authid,"STEAM_0:0") == -1) && (containi(authid,"STEAM_0:1") == -1))
        {
            server_cmd("kick #%i A player with SteamID connected! Buy Steam for reserved slot!",get_user_userid(player));
        }
i think should be
Code:
        if(!equal(authid,"STEAM_ID_PENDING") && (containi(authid,"STEAM_0:0") != -1) || (containi(authid,"STEAM_0:1") =! -1))
        {
            server_cmd("kick #%i A player with SteamID connected! Buy Steam for reserved slot!",get_user_userid(player));
        }
...:/
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 05-28-2007 , 06:04   Re: Kick no-steam ppl
Reply With Quote #5

The first check is rather redundant since STEAM_0:0/1 is not contained within STEAM_ID_PENDING.
Lee is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-28-2007 , 06:57   Re: Kick no-steam ppl
Reply With Quote #6

Quote:
Originally Posted by Alka View Post
heh thanks ^^!! but strange code

Code:
        if(!equal(authid,"STEAM_ID_PENDING") && (containi(authid,"STEAM_0:0") == -1) && (containi(authid,"STEAM_0:1") == -1))
        {
            server_cmd("kick #%i A player with SteamID connected! Buy Steam for reserved slot!",get_user_userid(player));
        }
i think should be
Code:
        if(!equal(authid,"STEAM_ID_PENDING") && (containi(authid,"STEAM_0:0") != -1) || (containi(authid,"STEAM_0:1") =! -1))
        {
            server_cmd("kick #%i A player with SteamID connected! Buy Steam for reserved slot!",get_user_userid(player));
        }
...:/
If you do != then you get the players with STEAM_0:" in their name ;)
Means you will kick a steamplayer *g*


Quote:
Originally Posted by Lee View Post
The first check is rather redundant since STEAM_0:0/1 is not contained within STEAM_ID_PENDING.
If i got that right, players who have a authid of type "STEAM_ID_PENDING" or "STEAM_0:" have a steam account!? correct?
Then this check would be correct because STEAM_0: wouldn't contain STEAM_ID_PENDING.
But i got doubts that "STEAM_ID_PENDIG" is a valid steamaccount...dont know exactly...

greetz regalis
__________________
regalis is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 05-28-2007 , 07:23   Re: Kick no-steam ppl
Reply With Quote #7

My mistake. I was a little confused as to whether you were checking for a valid or invalid SteamID. I should pay more attention.
Lee 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:33.


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