Raised This Month: $ Target: $400
 0% 

Client authentication


Post New Thread Reply   
 
Thread Tools Display Modes
FaTony
Veteran Member
Join Date: Aug 2008
Old 04-07-2010 , 09:38   Re: Client authentication
Reply With Quote #21

Listen or dedicated?
FaTony is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 04-07-2010 , 09:59   Re: Client authentication
Reply With Quote #22

chemicstry: read again: http://forums.alliedmods.net/showpos...2&postcount=17
__________________
Leonardo is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 04-09-2010 , 12:50   Re: Client authentication
Reply With Quote #23

PHP Code:
new bool:headshot GetEventBool(event"headshot"), attacker GetEventInt(event"attacker"), aci GetClientOfUserId(attacker), cSteamid[30], sSteamid[30
DOES. NOT. COMPILE.
FaTony is offline
chemicstry
Junior Member
Join Date: Jan 2010
Old 04-15-2010 , 15:34   Re: Client authentication
Reply With Quote #24

BREAKING NEWS: MORE PROBLEMS

I want to make that when client writes something, plugin checks client in mysql and if it is located there he gets [VIP] near his nick and if admin he gets [ADMIN]. I tried this code, but those who arent in mysql has "%&SDbg%^S" something like that behind their nick and sometimes it doesnt even show what i written.

Code:
#include <sourcemod>

new Handle:hDatabase = INVALID_HANDLE;
new String:Arg[255]

public Plugin:myinfo = 
{
    name = "VIP Mod",
    author = "Intel",
    description = "hm",
    version = "1.0.0.0",
    url = "http://www.ten-games.lt"
};


public OnPluginStart()
{
    RegServerCmd("vipmod_list", vipmod_list)
    StartSQL();
    RegConsoleCmd("say", HandleSay);
}



public Action:HandleSay(Client, Args)
{
    //Verify:
    if(Client == 0 || !IsClientInGame(Client))
        return Plugin_Continue;
        
    GetCmdArgString(Arg, sizeof(Arg));

    StripQuotes(Arg);
    TrimString(Arg);

    if(Arg[0] == '/' || Arg[0] == '!' || Arg[0] == '@')
        return Plugin_Continue;
        
    new String:cip[20]
    new String:Query[255]
    GetClientIP(Client, cip, 20);
    Format(Query, 255, "SELECT * FROM vip_list WHERE `ip` = '%s'", cip);
    SQL_TQuery(hDatabase, T_chat, Query, Client)

    //Return:
    return Plugin_Handled;
}

String:IsAdmin(client)
{
    new String:Adminas[20] = "";
    new AdminId:Admin_ID = GetUserAdmin(client);
    if (Admin_ID == INVALID_ADMIN_ID) {
        return Adminas;
    }

    if (GetAdminFlag(Admin_ID, Admin_Kick)) 
        {
            Adminas = "[Admin]";
            return Adminas;
        }

    return  Adminas;
}

public T_chat(Handle:owner, Handle:hndl, const String:error[], any:data)
{
    //Declare:
    decl MaxPlayers;
    decl String:ChatMsg[192], String:ClientName[64], String:IsVIP[8];
    IsVIP = "";
    if (hndl == INVALID_HANDLE)
    {
        PrintToServer("Query failed! %s", error);
    }
    if (SQL_GetRowCount(hndl))
    {
        IsVIP = "[VIP]";
    }
    //Initialize:
    MaxPlayers = GetMaxClients();
    GetClientName(data, ClientName, sizeof(ClientName));
    //Format:
    Format(ChatMsg, 255, "\x04%s %s \x03 %s \x01: %s", IsVIP, IsAdmin(data), ClientName, Arg);
    //Print:
    for(new X = 1; X <= MaxPlayers; X++)
    {
        if(IsClientConnected(X))
        {
            if(IsPlayerAlive(data) == IsPlayerAlive(X))
            {
                new Handle:buffer = StartMessageOne("SayText2", X);
                if ( buffer != INVALID_HANDLE )
                {
                    BfWriteByte(buffer, data);
                    BfWriteByte(buffer, true);
                    BfWriteString(buffer, ChatMsg);
                    EndMessage();
                }
            }
        }
    }
}

StartSQL()
{
    SQL_TConnect(GotDatabase, "vipmod");
}
 
public GotDatabase(Handle:owner, Handle:hndl, const String:error[], any:data)
{
    if (hndl == INVALID_HANDLE)
    {
        LogError("Database failure: %s", error);
    } else {
        hDatabase = hndl;
    }
}
Thanks.
chemicstry is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 04-15-2010 , 17:21   Re: Client authentication
Reply With Quote #25

http://docs.sourcemod.net/api/index....d=show&id=838&
FaTony is offline
chemicstry
Junior Member
Join Date: Jan 2010
Old 04-29-2010 , 07:16   Re: Client authentication
Reply With Quote #26

I'm in scripting level 2 !

Now i want to try something harder like "addmap" in eventscripts, but i cant find how to execute shell commands like bzip2, wget, cp, mv. I looked into extension system, but it says its only for windows. Is there any extension or something how to do this?

I have an idea to use php script, but it's a shitty way of doing it ;/

Last edited by chemicstry; 04-29-2010 at 07:33.
chemicstry is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 04-29-2010 , 12:53   Re: Client authentication
Reply With Quote #27

Quote:
Originally Posted by chemicstry View Post
I'm in scripting level 2 !
__________________
Leonardo is offline
chemicstry
Junior Member
Join Date: Jan 2010
Old 04-29-2010 , 13:09   Re: Client authentication
Reply With Quote #28

Quote:
Originally Posted by Leonardo View Post
If you continue banging your head, you will get on lower scripting level :/

So does anyone know how to execute shell command?
chemicstry is offline
chemicstry
Junior Member
Join Date: Jan 2010
Old 04-30-2010 , 06:13   Re: Client authentication
Reply With Quote #29

anyone?
chemicstry is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-30-2010 , 06:54   Re: Client authentication
Reply With Quote #30

Quote:
Originally Posted by chemicstry View Post
I'm in scripting level 2 !
What rank you have and what achievements you have accomplish ??
This scripting remind me like WoW what I have ever never played.
This ain't nintendo gaming.
Bacardi 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 20:32.


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