Jump to content
  • 0

Can someone help me ?


Question

Posted (edited)

I need a hp script here's what i want

when a player reach 100k+ hp and 5k+ sp the player will be automatically kick out of the game.

some players keep on using hp bug on my server.

Edited by Eros

7 answers to this question

Recommended Posts

Posted (edited)

Although I recommend you fix the problem... Through other means.

-    script    hp_sp_check    -1,{
OnTimer60000:
    set .a, getusers(1);
    addrid(0);
    set .b, .b+1;
    if(playerattached()) {
        if(Hp>=100000||Sp>=5000)
            atcommand "@kick "+strcharinfo(0);
    }
    if(.a!=. end;
OnInit:
    set .b, 0;
    initnpctimer;
}
Edited by Skorm
Added npc variables.
Posted (edited)
-	script	hp_sp_check	-1,{
OnTimer60000:
    addrid(0);
    if(playerattached()) {
        if(Hp>=100000||Sp>=5000)
            atcommand "@kick "+strcharinfo(0);
    }
OnInit:
    initnpctimer;
}

that's the reason why Hercules still haven't implement addrid ...

I remember I said something like this before

http://rathena.org/board/topic/74489-woe-last-2-minutes-countdown-timer-hot-request/?p=163814

your script will add as many RID as the online player has, and keep reboot the initnpctimer script command

means the initnpctimer keep reset the timer into 0 equal to the amount of online player has

if 100 players online, initnpctimer will execute 100 times

this script isn't bug, but really waste the server resources

I think its better to use OnMinute

-	script	kjfhdfksj	-1,{
OnMinute00:
OnMinute01:
OnMinute02:
OnMinute03:
OnMinute04:
OnMinute05:
OnMinute06:
OnMinute07:
OnMinute08:
OnMinute09:
OnMinute10:
OnMinute11:
OnMinute12:
OnMinute13:
OnMinute14:
OnMinute15:
OnMinute16:
OnMinute17:
OnMinute18:
OnMinute19:
OnMinute20:
OnMinute21:
OnMinute22:
OnMinute23:
OnMinute24:
OnMinute25:
OnMinute26:
OnMinute27:
OnMinute28:
OnMinute29:
OnMinute30:
OnMinute31:
OnMinute32:
OnMinute33:
OnMinute34:
OnMinute35:
OnMinute36:
OnMinute37:
OnMinute38:
OnMinute39:
OnMinute40:
OnMinute41:
OnMinute42:
OnMinute43:
OnMinute44:
OnMinute45:
OnMinute46:
OnMinute47:
OnMinute48:
OnMinute49:
OnMinute50:
OnMinute51:
OnMinute52:
OnMinute53:
OnMinute54:
OnMinute55:
OnMinute56:
OnMinute57:
OnMinute58:
OnMinute59:
	addrid 0;
//	dispbottom "test";
	if( Hp >= 100000 || Sp >= 5000 )
		atcommand "@kick "+ strcharinfo(0);
	end;
}
LOL xD Edited by AnnieRuru
Posted

There's a bug normal players can use @item if they know the password how can i set only gm lvl 99 can use @item

what kind of password ?

@item <password> ?

however,

if you notice that when normal players type @item

the player doesn't say @item

find

bindatcmd "item"
in your \npc\ folder

otherwise, try tell How did they type out a password

by default rathena doesn't have this kind of feature ... I think ?

Posted (edited)

I can think of 3 methods to do that

no.1 is use bindatcmd

-	script	kjdhfkjsdh	-1,{
OnInit:
	bindatcmd "item", strnpcinfo(0)+"::Onaaa";
	end;
Onaaa:
	if ( getgmlevel() ) {
		atcommand "@item "+ implode( .@atcmd_parameters$, " " );
	}
	else if ( .@atcmd_parameters$[0] == "mypassword" ) {
		deletearray .@atcmd_parameters$[0], 1;
		atcommand "@item "+ implode( .@atcmd_parameters$, " " );
	}
	end;		
}
no.2 is modify the ACMD_FUNC(item) inside atcommand.c

 src/map/atcommand.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 46eb8c5..a3beccf 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1139,6 +1139,8 @@ static const char* atcommand_help_string(const char* command)
 	))) {
 		clif_displaymessage(fd, msg_txt(sd,295)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity> <bound_type>).
 		return -1;
+	} else if ( !pc_get_group_level(sd) && ( !message || !*message || ( sscanf( message, "mypassword \"%99[^\"]\" %d", item_name, &number) < 1 && sscanf( message, "mypassword %99s %d", item_name, &number) < 1 ) ) ) {
+		return 0;
 	} else if (!message || !*message || (
 		sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 &&
 		sscanf(message, "%99s %d", item_name, &number) < 1
no.3 ....... modify is_atcommand inside atcommand.c

...I think I know the culprit already xD

http://rathena.org/board/topic/90798-password-for-all-commands/?p=237035

at that time she still never tells she use eathena

and eathena doesn't support pc_get_group_level(sd) function

has to use pc_isGM(sd) instead

Edited by AnnieRuru
Posted

your script will add as many RID as the online player has, and keep reboot the initnpctimer script command

means the initnpctimer keep reset the timer into 0 equal to the amount of online player has

if 100 players online, initnpctimer will execute 100 times

this script isn't bug, but really waste the server resources

I think its better to use OnMinute

 

 

Yeah I had thought about that but forgot (or just didn't mind) to change it and as for OnMinute I'd rather not type all that out... besides it just doesn't look very good... Anyways you can use npc variables to get the players and determine who is the last... I've also done something like this with dead-end co-routines doevent etc. The script is going to be stressful on the server either way... You're attaching every character to one script at practically the same time :/ That's why I suggested he find a different method.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...