AdminMod.de
https://www.adminmod.de/

scriptinh help
https://www.adminmod.de/viewtopic.php?t=9920
Seite 1 von 1

Autor:  caramel [ 02.12.2006, 17:40 ]
Betreff des Beitrags:  scriptinh help

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

Autor:  [WING] Black Knight [ 03.12.2006, 17:50 ]
Betreff des Beitrags: 

Sorry, cannot get my hand on my own computer right now.

Try get_userIP() to retrieve your info.

Autor:  caramel [ 03.12.2006, 20:37 ]
Betreff des Beitrags: 

hmm, here : http://www.adminmod.org/index.php?go=ascript/functions i dont found this function .
So i will wait since you finish

Autor:  [WING] Black Knight [ 04.12.2006, 19:39 ]
Betreff des Beitrags: 

Instead of looking at that page, you should take a look at the include files adminmod/scripting/include. The information there should be selfexplantory.

Autor:  caramel [ 04.12.2006, 20:38 ]
Betreff des Beitrags: 

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

Autor:  Sir Drink a lot [ 04.12.2006, 20:46 ]
Betreff des Beitrags: 

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);

Autor:  Sir Drink a lot [ 04.12.2006, 20:49 ]
Betreff des Beitrags: 

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.

Autor:  caramel [ 06.12.2006, 17:00 ]
Betreff des Beitrags: 

doesen't works ; on screenshot appear : Player IP : but not appear him ip ; where is the problem ? please try to fix it

Autor:  Sir Drink a lot [ 06.12.2006, 19:32 ]
Betreff des Beitrags: 

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.

Autor:  caramel [ 06.12.2006, 20:44 ]
Betreff des Beitrags: 

=>
plugin_base
mirror
Fix it if you can

Autor:  Sir Drink a lot [ 06.12.2006, 23:39 ]
Betreff des Beitrags: 

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);
        ....

Autor:  caramel [ 07.12.2006, 21:07 ]
Betreff des Beitrags: 

:shock: doesent works
Please give all CODE because doesent works

Autor:  Sir Drink a lot [ 08.12.2006, 17:56 ]
Betreff des Beitrags: 

i don't have more code...
sorry.

Autor:  caramel [ 08.12.2006, 17:58 ]
Betreff des Beitrags: 

because appear on chat : IP : ..
And not appear him ip ;

Seite 1 von 1 Alle Zeiten sind UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/