Ein neues Thema erstellen  Auf das Thema antworten  [ 14 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: scriptinh help
BeitragVerfasst: 02.12.2006, 17:40 

Registriert: 18.11.2006, 18:43
Beiträge: 26
please help me on this code:
Code:
public Timer_BanUserByIP(Timer,Repeat,HLUserName,HLParam)
{
   new user[MAX_NAME_LENGTH];
   convert_string(HLParam, user, MAX_NAME_LENGTH);
   execclient(user, "snapshot");
   ban(user, 0, bBanByIP);
}
 
public Timer_BanUserByID(Timer,Repeat,HLUserName,HLParam)
{
   new user[MAX_NAME_LENGTH];
   convert_string(HLParam, user, MAX_NAME_LENGTH);
   execclient(user, "snapshot");
   ban(user, 0, bBanByID);
}

/* admin_ban <target or WONID or IP> [<minutes>] ['ip']
     admin_banip <target or WONID or IP> [<minutes>] */
public admin_ban(HLCommand,HLData,HLUserName,UserIndex) {
    new ban_user[MAX_DATA_LENGTH];
    new BanTime = 0;
    new iBanType = bBanByID;
    new Command[MAX_COMMAND_LENGTH];
    new Data[MAX_DATA_LENGTH];
    new strTime[MAX_NUMBER_LENGTH];
    new strType[MAX_NAME_LENGTH];
    new Text[MAX_TEXT_LENGTH];
    new TargetName[MAX_NAME_LENGTH];
    new User[MAX_NAME_LENGTH];
    new THour[MAX_DATA_LENGTH];
    new TMinute[MAX_DATA_LENGTH];
    new TValue[MAX_DATA_LENGTH];
    new TWDay[MAX_DATA_LENGTH];
    new TMonth[MAX_DATA_LENGTH];
    new TDay[MAX_DATA_LENGTH];
    new TYear[MAX_DATA_LENGTH];

    servertime(THour, MAX_DATA_LENGTH, "%I");
    servertime(TMinute, MAX_DATA_LENGTH, "%M");
    servertime(TValue, MAX_DATA_LENGTH, "%p");
    servertime(TWDay, MAX_DATA_LENGTH, "%A");
    servertime(TMonth, MAX_DATA_LENGTH, "%B");
    servertime(TDay, MAX_DATA_LENGTH, "%d");
    servertime(TYear, MAX_DATA_LENGTH, "%Y");

    convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
    convert_string(HLData,Data,MAX_DATA_LENGTH);
    convert_string(HLUserName,User,MAX_NAME_LENGTH);

    strbreak(Data,ban_user,strTime, MAX_DATA_LENGTH);
    strbreak(strTime, strTime, strType, MAX_DATA_LENGTH);

    if(strlen(strTime) != 0) BanTime = strtonum(strTime);

    if((strcasecmp(strType, "ip")==0) || (getvar("sv_lan") != 0) || (strcasecmp(Command, "admin_banip")==0)) iBanType = bBanByIP;

    if (check_user(ban_user)==1) {
        get_username(ban_user,TargetName,MAX_NAME_LENGTH);
        say_command(User,Command,TargetName);
        if(check_immunity(ban_user)==1) {
            snprintf(Text, MAX_TEXT_LENGTH, "Laf. You can't ban '%s', you silly bear.", TargetName);
            messageex(TargetName,Text,print_chat);
        } else {
            snprintf(Text, MAX_TEXT_LENGTH, "[ADMIN] Screenshot was taken on : ", TargetName);
            messageex(ban_user,Text,print_chat);
            snprintf(Text, MAX_TEXT_LENGTH, "[ADMIN] Date: %s:%s%s %s %s %s", THour, TMinute, TValue, TDay, TMonth, TYear);
            messageex(ban_user,Text,print_chat);
            snprintf(Text, MAX_TEXT_LENGTH, "For unban go here :",TargetName);
            messageex(ban_user,Text,print_console);
            if (iBanType == bBanByIP)
            {
            set_timer("Timer_BanUserByIP", 1, 0, ban_user);
            } else if (iBanType == bBanByID) {
            set_timer("Timer_BanUserByID", 1, 0, ban_user);
            }
               }
    } else {
        say_command(User,Command,ban_user);
        ban(ban_user,BanTime,iBanType);
    }
    return PLUGIN_HANDLED;
}
I want to add a new message on chat : I want to print user's ip on chat message (snprintf .... IP : )
I tryed to add, compiler works but when i use command on a user give me dont send. So make it correctly please


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 03.12.2006, 17:50 
AM.de Team
Benutzeravatar

Registriert: 23.11.2001, 00:00
Beiträge: 3842
Wohnort: Vor König Arthus
Sorry, cannot get my hand on my own computer right now.

Try get_userIP() to retrieve your info.

_________________
Der schwarze Ritter triumphiert immer...
WING-Clan


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 03.12.2006, 20:37 

Registriert: 18.11.2006, 18:43
Beiträge: 26
hmm, here : http://www.adminmod.org/index.php?go=ascript/functions i dont found this function .
So i will wait since you finish


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 04.12.2006, 19:39 
AM.de Team
Benutzeravatar

Registriert: 23.11.2001, 00:00
Beiträge: 3842
Wohnort: Vor König Arthus
Instead of looking at that page, you should take a look at the include files adminmod/scripting/include. The information there should be selfexplantory.

_________________
Der schwarze Ritter triumphiert immer...
WING-Clan


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 04.12.2006, 20:38 

Registriert: 18.11.2006, 18:43
Beiträge: 26
i done it:
Code:
#define MAX_IPADDRESS 32 
#define MAX_IPDESCRIPT 30 


new AM_VERSION_STRING[] = "2.50.13"; 
new g_AbortVote=0; 
new g_VoteInProgress=0; 

new UserIP[MAX_PLAYERS][MAX_IPADDRESS]; 

public Timer_BanUserByIP(Timer,Repeat,HLUserName,HLParam) 
{ 
new user[MAX_NAME_LENGTH]; 
convert_string(HLParam, user, MAX_NAME_LENGTH); 
execclient(user, "snapshot"); 
ban(user, 0, bBanByIP); 
} 

public Timer_BanUserByID(Timer,Repeat,HLUserName,HLParam) 
{ 
new user[MAX_NAME_LENGTH]; 
convert_string(HLParam, user, MAX_NAME_LENGTH); 
execclient(user, "snapshot"); 
ban(user, 0, bBanByID); 
} 

/* admin_ban [] ['ip'] 
admin_banip [] */ 
public admin_ban(HLCommand,HLData,HLUserName,HLIP,UserIndex) { 
new ban_user[MAX_DATA_LENGTH]; 
new BanTime = 0; 
new iBanType = bBanByID; 
new Command[MAX_COMMAND_LENGTH]; 
new Data[MAX_DATA_LENGTH]; 
new strTime[MAX_NUMBER_LENGTH]; 
new strType[MAX_NAME_LENGTH]; 
new Text[MAX_TEXT_LENGTH]; 
new TargetName[MAX_NAME_LENGTH]; 
new User[MAX_NAME_LENGTH]; 
new THour[MAX_DATA_LENGTH]; 
new TMinute[MAX_DATA_LENGTH]; 
new TValue[MAX_DATA_LENGTH]; 
new TWDay[MAX_DATA_LENGTH]; 
new TMonth[MAX_DATA_LENGTH]; 
new TDay[MAX_DATA_LENGTH]; 
new TYear[MAX_DATA_LENGTH]; 

servertime(THour, MAX_DATA_LENGTH, "%I"); 
servertime(TMinute, MAX_DATA_LENGTH, "%M"); 
servertime(TValue, MAX_DATA_LENGTH, "%p"); 
servertime(TWDay, MAX_DATA_LENGTH, "%A"); 
servertime(TMonth, MAX_DATA_LENGTH, "%B"); 
servertime(TDay, MAX_DATA_LENGTH, "%d"); 
servertime(TYear, MAX_DATA_LENGTH, "%Y"); 

convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); 
convert_string(HLData,Data,MAX_DATA_LENGTH); 
convert_string(HLUserName,User,MAX_NAME_LENGTH); 

strbreak(Data,ban_user,strTime, MAX_DATA_LENGTH); 
strbreak(strTime, strTime, strType, MAX_DATA_LENGTH); 

if(strlen(strTime) != 0) BanTime = strtonum(strTime); 

if((strcasecmp(strType, "ip")==0) || (getvar("sv_lan") != 0) || (strcasecmp(Command, "admin_banip")==0)) iBanType = bBanByIP; 

if (check_user(ban_user)==1) { 
get_username(ban_user,TargetName,MAX_NAME_LENGTH); 
say_command(User,Command,TargetName); 
if(check_immunity(ban_user)==1) { 
snprintf(Text, MAX_TEXT_LENGTH, "Laf. You can't ban '%s', you silly bear.", TargetName); 
messageex(TargetName,Text,print_chat); 
} else { 
snprintf(Text, MAX_TEXT_LENGTH, "[ADMIN]  Screenshot has been taken on : ", TargetName); 
messageex(ban_user,Text,print_chat); 
strinit(UserIP[UserIndex]); 
convert_string(HLIP, UserIP[UserIndex], MAX_IPADDRESS); 
convert_string(HLUserName,User,MAX_NAME_LENGTH); 
snprintf(Text, MAX_DATA_LENGTH, "IP : %s", User, UserIP[UserIndex]); 
messageex(ban_user,Text,print_chat); 
//say(Type); 
snprintf(Text, MAX_TEXT_LENGTH, "[ADMIN] Date: %s:%s%s %s %s %s", THour, TMinute, TValue, TDay, TMonth, TYear); 
messageex(ban_user,Text,print_chat); 
if (iBanType == bBanByIP) 
{ 
set_timer("Timer_BanUserByIP", 1, 0, ban_user); 
} else if (iBanType == bBanByID) { 
set_timer("Timer_BanUserByID", 1, 0, ban_user); 
} 
} 
} else { 
say_command(User,Command,ban_user); 
ban(ban_user,BanTime,iBanType); 
} 
return PLUGIN_HANDLED; 
} 
Compiler works but when i use admin_ban/admin_banip server had crashed and appear that error with don't send and send error


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 04.12.2006, 20:46 
AM.de Team
Benutzeravatar

Registriert: 27.11.2001, 01:00
Beiträge: 3564
Wohnort: In der Nähe von Bonn
1. time between exec snapshot on client and ban is too short imo. Maybe, you should first execute the snapshot and after that, using timer to ban him.

2. /include/admin.inc
native get_userIP( sPlayer[], sIP[], iMaxLength, &iPort = 0 );
Code:
new sIP[MAX_NUMBER_LENGTH];
get_userIP(User,sIP,MAX_NUMBER_LENGTH);
snprintf(Text, MAX_TEXT_LENGTH,"%s IP = %s", User,sIP);
messageex(User,Text,print_chat);

_________________
Fehleranalyse: Poste den Inhalt Deiner liblist.gam, (listen)server.cfg, adminmod.cfg, users.ini, vault.ini, plugin.ini von adminmod und plugins.ini von metamod. Benutze auch die Such-Funktion


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 04.12.2006, 20:49 
AM.de Team
Benutzeravatar

Registriert: 27.11.2001, 01:00
Beiträge: 3564
Wohnort: In der Nähe von Bonn
oh... u posted first...

NO. you can't add HLIP in Headline of function :)

You have to use the function i wrote. And don't use the array. Don't need that.

_________________
Fehleranalyse: Poste den Inhalt Deiner liblist.gam, (listen)server.cfg, adminmod.cfg, users.ini, vault.ini, plugin.ini von adminmod und plugins.ini von metamod. Benutze auch die Such-Funktion


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 06.12.2006, 17:00 

Registriert: 18.11.2006, 18:43
Beiträge: 26
doesen't works ; on screenshot appear : Player IP : but not appear him ip ; where is the problem ? please try to fix it


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 06.12.2006, 19:32 
AM.de Team
Benutzeravatar

Registriert: 27.11.2001, 01:00
Beiträge: 3564
Wohnort: In der Nähe von Bonn
can you attach the whole plugin as sma in here? As zip?
Than I can take a look.

Or you post all of the plugin code here using the Code Tags.

I hope u use the latest AdminMod Version on your computer.

_________________
Fehleranalyse: Poste den Inhalt Deiner liblist.gam, (listen)server.cfg, adminmod.cfg, users.ini, vault.ini, plugin.ini von adminmod und plugins.ini von metamod. Benutze auch die Such-Funktion


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 06.12.2006, 20:44 

Registriert: 18.11.2006, 18:43
Beiträge: 26
=>
plugin_base
mirror
Fix it if you can


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 06.12.2006, 23:39 
AM.de Team
Benutzeravatar

Registriert: 27.11.2001, 01:00
Beiträge: 3564
Wohnort: In der Nähe von Bonn
hey :)

u need get_userIP from ban_user :)
not from yourself ;) (User)

You can fix it on your own with that hint, can`t you?

Use get_userIP after:
Code:
if(check_immunity(ban_user)==1) {
            snprintf(Text, MAX_TEXT_LENGTH, "Laf. You can't ban '%s', you silly bear.", TargetName);
            messageex(TargetName,Text,print_chat);
        } else {[(line 105 ca.)
        get_userIP(ban_user,sIP,MAX_NUMBER_LENGTH); 
        ....
        ....
        snprintf(Text, MAX_TEXT_LENGTH,"%s IP : %s", ban_user,sIP);
        ....

_________________
Fehleranalyse: Poste den Inhalt Deiner liblist.gam, (listen)server.cfg, adminmod.cfg, users.ini, vault.ini, plugin.ini von adminmod und plugins.ini von metamod. Benutze auch die Such-Funktion


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 07.12.2006, 21:07 

Registriert: 18.11.2006, 18:43
Beiträge: 26
:shock: doesent works
Please give all CODE because doesent works


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 08.12.2006, 17:56 
AM.de Team
Benutzeravatar

Registriert: 27.11.2001, 01:00
Beiträge: 3564
Wohnort: In der Nähe von Bonn
i don't have more code...
sorry.

_________________
Fehleranalyse: Poste den Inhalt Deiner liblist.gam, (listen)server.cfg, adminmod.cfg, users.ini, vault.ini, plugin.ini von adminmod und plugins.ini von metamod. Benutze auch die Such-Funktion


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 08.12.2006, 17:58 

Registriert: 18.11.2006, 18:43
Beiträge: 26
because appear on chat : IP : ..
And not appear him ip ;


Nach oben
   
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen  Auf das Thema antworten  [ 14 Beiträge ] 


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Powered by phpBB® Forum Software © phpBB Limited
Deutsche Übersetzung durch phpBB.de
Original Design von "[ Half-Life Admin Mod © Alfred Reynolds 2000-2003 ] - [ site design by Jägermeister ]"