Raised This Month: $ Target: $400
 0% 

[CSS] Can't rewrite some string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BHy4ok
Junior Member
Join Date: Jul 2006
Location: Russia Federation
Old 03-14-2009 , 06:00   [CSS] Can't rewrite some string
Reply With Quote #1

In amxx it's was:
Code:
	if(get_user_flags(id) & ACCESS_LEVEL)
		return PLUGIN_HANDLED
I try do this on sourcemod, but it's don't work. It block admins too:
Code:
	if(GetUserFlagBits(client) & ACCESS_FLAG)
		return Plugin_Handled;
What's wrong ?
Code:
public OnClientPutInServer(client)
{
	if(GetUserFlagBits(client) & ACCESS_FLAG)
		return Plugin_Handled;	

	new user_pass[40];
	GetClientInfo(client, "_cw", user_pass, 39);
	
	if (!StrEqual(szPass, user_pass))
	{
		KickClient(client, "Kicked: You entered wrong password (setinfo _cw '***')", GetClientUserId(client));
	}
	return Plugin_Continue;
}
PS: szPass - The password established by admin

Last edited by BHy4ok; 03-14-2009 at 06:06.
BHy4ok is offline
Send a message via ICQ to BHy4ok
KawMAN
SourceMod Donor
Join Date: Sep 2007
Location: Cracov
Old 03-14-2009 , 09:59   Re: [CSS] Can't rewrite some string
Reply With Quote #2

Try this
PHP Code:
new String:szPass[40]="password";
public 
OnClientPostAdminCheck(client)
{

    if(
GetUserFlagBits(client) == 0)
        return 
Plugin_Handled;    

    new 
user_pass[sizeof(szPass)];
    
GetClientInfo(client"_cw"user_passsizeof(user_pass));
    
    if (!
StrEqual(szPassuser_pass))
    {
        
KickClient(client"Kicked: You entered wrong password (setinfo _cw '***')"GetClientUserId(client));
    }
    return 
Plugin_Continue;

__________________

Last edited by KawMAN; 03-14-2009 at 10:03.
KawMAN is offline
Send a message via ICQ to KawMAN Send a message via Skype™ to KawMAN
BHy4ok
Junior Member
Join Date: Jul 2006
Location: Russia Federation
Old 03-14-2009 , 13:41   Re: [CSS] Can't rewrite some string
Reply With Quote #3

2 KawMAN: This code checks only administrators. As a result again does not start up. Only simple users can connect without setinfo

Last edited by BHy4ok; 03-14-2009 at 14:29.
BHy4ok is offline
Send a message via ICQ to BHy4ok
BHy4ok
Junior Member
Join Date: Jul 2006
Location: Russia Federation
Old 03-15-2009 , 02:53   Re: [CSS] Can't rewrite some string
Reply With Quote #4

2 KawMAN: thx man. It's work with "OnClientPostAdminCheck"

PHP Code:
public OnClientPostAdminCheck(client)
{          
    if(
GetUserFlagBits(client) & ADMFLAG_KICK)
        return 
Plugin_Handled;
//....... 
BHy4ok is offline
Send a message via ICQ to BHy4ok
BHy4ok
Junior Member
Join Date: Jul 2006
Location: Russia Federation
Old 03-15-2009 , 12:32   Re: [CSS] Can't rewrite some string
Reply With Quote #5

Why after change level the password is not dumped(szPass)? I try to set: new szPass[40]="", but nothing (
On amxx it was dumped.

Last edited by BHy4ok; 03-15-2009 at 12:34.
BHy4ok is offline
Send a message via ICQ to BHy4ok
BHy4ok
Junior Member
Join Date: Jul 2006
Location: Russia Federation
Old 03-16-2009 , 01:31   Re: [CSS] Can't rewrite some string
Reply With Quote #6

PHP Code:
/*    AMXModX plugin
*     (c) 2009 made by L3X.
*
*    ICQ: 8721378
*
*commands:
*    sm_checkpass  - check or not password from players (default 1)
*    sm_setpass  - sets the server password
*    sm_showpass  - Shows the established password
*    sm_onshow  - show or not password to admin's (default 1)
*
*
*/

#include <sourcemod>

#define ACCESS_FLAG        ADMFLAG_KICK

new Handle:Cvar_OnShow INVALID_HANDLE;
new 
Handle:Cvar_CheckPass INVALID_HANDLE;

public 
Plugin:myinfo 
{
    
name "Server password",
    
author "L3X",
    
description "none"
};

new 
szPass[40];


public 
OnPluginStart()
{
    
RegAdminCmd("sm_setpass"Command_SetPassACCESS_FLAG"sm_setpass [password]");
    
RegAdminCmd("sm_showpass"Command_ShowPassACCESS_FLAG);
    
Cvar_CheckPass CreateConVar("sm_checkpass","1");
    
Cvar_OnShow CreateConVar("sm_onshow","1");
    
CreateTimer(20.0OnSetDefMap0TIMER_REPEAT);
}

public 
OnClientPostAdminCheck(client)
{
    if(!
GetConVarInt(Cvar_CheckPass)) 
        return 
Plugin_Handled;              
    if(
GetUserFlagBits(client) & ACCESS_FLAG)
        return 
Plugin_Handled;
    if(
IsFakeClient(client))
        return 
Plugin_Handled;

    if((
GetClientCount(false)) || (StrEqual(szPass"")))
        
KickClient(client"Only players with admin's rights allowed now"GetClientUserId(client)); 
    else    

    {    
    new 
user_pass[sizeof(szPass)];
    
GetClientInfo(client"_cw"user_passsizeof(user_pass));
    
    if (!
StrEqual(szPassuser_pass))
    {
        
KickClient(client"Kicked: You entered wrong password (setinfo _cw '***')"GetClientUserId(client));
    }

    }
    return 
Plugin_Continue;

}


public 
Action:Command_SetPass(clientargs)
{
    if(!
CheckCommandAccess(client"sm_setpass"ACCESS_FLAG))
        return 
Plugin_Handled;

    if (
args 1)
    {
        
ReplyToCommand(client"[SM] Usage: sm_setpass [password]");
        return 
Plugin_Handled;
    }

    
GetCmdArgString(szPass39);
    
PrintToChat(client"The password on server is established");

    return 
Plugin_Handled;    
}

public 
Action:Command_ShowPass(clientargs)
{
    if(!
GetConVarInt(Cvar_OnShow))
    {
        
PrintToConsole(client"The given function is switched off");
        return 
Plugin_Handled;
    }
    if(
GetUserFlagBits(client) & ACCESS_FLAG)
        
PrintToConsole(client"Server Password is: %s"szPass);
    return 
Plugin_Handled;
}

public 
Action:OnSetDefMap(Handle:timer)
{
    if(!
GetConVarInt(Cvar_CheckPass))
        return 
Plugin_Handled;

    if((
GetClientCount(true)==0) & (!StrEqual(szPass"")))
        
szPass="";

    new 
mapname[32];
    
GetCurrentMap(mapname31);

    if((
GetClientCount(true)==0) & (!StrEqual("de_dust",mapname)))
        
ServerCommand("map de_dust");
    return 
Plugin_Handled;
        

How to correct a mistake "warning 213: tag mismatch"(In 44,46,48,50,56,58,64,80,102,103 lines). 15 Warnings...
I can't understand.
__________________
< L3X.

Last edited by BHy4ok; 03-16-2009 at 03:40.
BHy4ok is offline
Send a message via ICQ to BHy4ok
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 20:47.


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