Jump to content

Khazou

Members
  • Posts

    44
  • Joined

  • Last visited

Posts posted by Khazou

  1. map,x,y,z	script	NPC	749,{
    	if(getgroupid() >= .groupLevel){
    		if($gmRoom){
    			switch(select("Close Room","Quit")){
    				case 1:
    					set $gmRoom,0;
    					mes "Done";
    					close;
    					
    				case 2:
    					mes "ok";
    					close;
    			}
    		} else{
    			switch(select("Open Room","Quit")){
    				case 1:
    					set $gmRoom,1;
    					mes "Done";
    					close;
    					
    				case 2:
    					mes "ok";
    					close;
    			}
    		}
    	} else{
    		if($gmRoom){
    			mes .npc$,"Do you want to go to the Gm Room ?";
    			next;
    				switch(select("Yes","No")){
    					case 1:
    						mes .npc$,"Here we go !";
    						close2
    						warp .map$[0],.map$[1],.map$[2];
    						end;
    					case 2:
    						mes .npc$,"Ok";
    						close;
    				}
    		} else {
    			mes .npc$,"Gm Room is actually locked.";
    			close;
    		}
    	}
    
    	OnInit:
    		setarray .map$,"prontera",100,100; // Where to warp player/gm
    		set .npc$,"NPC"; // Name of the Npc
    		set .gmLvl,60; // Minimum Group Level to access the npc
    	end;
    }	
    
    

    Edit: You should use Patskie's one :)

  2. You just need to replace this:

    if(ZENY >= atoi(.mvpSpawn$[2])){
        set ZENY, ZENY - atoi(.mvpSpawn$[2]);
        monster strcharinfo(3),99,135,.mvpSpawn$[0],atoi(.mvpSpawn$[1]),1;
    }
    

    By:

    if(ZENY >= atoi(.mvpSpawn$[2])){
            set ZENY, ZENY - atoi(.mvpSpawn$[2]);
    	mapannounce strcharinfo(3),strcharinfo(0)+" just spawned "+.mvpSpawn$[0],0;
            monster strcharinfo(3),99,135,.mvpSpawn$[0],atoi(.mvpSpawn$[1]),1;
    }
    
  3. function    script    Ramvp_M    {
      setarray .mvpList$[0],
             "Orc Lord:1190:2000000",
             "Orc Hero:1087:3000000",
             "Phreeoni:1159:4000000",
             "Turtle General:1312:5000000";
    
        mes "How do you need help?";
        menu "Summon Mvp",L_Spawn,"Heal Please",L_Heal,"Leave",L_Leave;
    
        L_Spawn:
            for(set .@i,0; .@i < getarraysize(.mvpList$);set .@i, .@i + 1){
                explode(.mvpData$,.mvpList$[.@i],":");
                if(.@i == 0) set .@menu$, .mvpData$[0];
                else set .@menu$, .@menu$ + (":"+.mvpData$[0]);
            }
                set .@choice,select(.@menu$);
                explode(.mvpSpawn$,.mvpList$[.@choice - 1],":");
                
                mes "You want to spawn: "+.mvpSpawn$[0],
                    "It cost: "+.mvpSpawn$[2];
                next;
                    switch(select("Yes","No")){
                        case 1:
                            if(ZENY >= atoi(.mvpSpawn$[2])){
                                set ZENY, ZENY - atoi(.mvpSpawn$[2]);
                                monster strcharinfo(3),0,0,.mvpSpawn$[0],atoi(.mvpSpawn$[1]),1;
                            }
                            else {
                                mes "You don't have enough zeny.";
                                close;
                            }
                        end;
                        
                        case 2:
                            mes "Ok, Come back when you get ready!";
                            close;
                    }
        end;
    
        L_Heal:
            mes "Ok, the heal cost 1M Zeny, do you still want i heal you?";
            next;
                switch(select("Ok","No")){
                    case 1:
                        if(ZENY >= 1000000){
                            set ZENY, ZENY - 1000000;
                            percentheal 100,100;
                        }
                        else {
                            mes "I'm sorry you don't have enough zeny.";
                            close;
                        }
                }
        end;
    
        L_Leave:
            warp "prontera",156,179;
            close;
    
    }
    

    I just test it and it works fine, hope you won't get an error xD

    • Upvote 1
  4. Hum just a last question, are you trying to block player using bot?

    Because that sort of script is useless.

     

    If it's for another reason:


     

    OnPCLoginEvent:
    	mes "2+2?";
    	initnpctimer;
    	input .@ans$;
    	if (.@ans$ != "4" ) {
    		mes "wrong!";
    		stopnpctimer;
    		// You need to do something here, add a 'close' or make a loop. Or player will be freeze since there is no 'close'
    	} else {
    		mes "right!";
    		stopnpctimer;
    		close;
    	}
    	
    	OnTimer5000:
    		atcommand "@kick "+strcharinfo(0);
    		end;
    end;
    
  5. You have many choice:

    
    *addtimer <ticks>,"NPC::OnLabel";
    *deltimer "NPC::OnLabel";
    *addtimercount <ticks>,"NPC::OnLabel";
    
    These commands will create, destroy, and delay a countdown timer - 'addtimer' to
    create, 'deltimer' to destroy and 'addtimercount' to delay it by the specified
    number of ticks. For all three cases, the event label given is the identifier of
    that timer. The timer runs on the character object that is attached to the script,
    and can have multiple instances. When the label is run, it is run as if the player that
    the timer runs on has clicked the NPC.
    
    When this timer runs out, a new execution thread will start in the specified NPC
    object at the specified label.
    
    The ticks are given in 1/1000ths of a second.
    
    One more thing. These timers are stored as part of player data. If the player
    logs out, all of these get immediately deleted, without executing the script.
    If this behavior is undesirable, use some other timer mechanism (like 'sleep').
    
    Example:
    <NPC Header> {
    	dispbottom "Starting a 5 second timer...";
    	addtimer 5000, strnpcinfo(3)+"::On5secs";
    	end;
    On5secs:
    	dispbottom "5 seconds have passed!";
    	end;
    }
    
    

    Or:

    
    *initnpctimer{ "<NPC name>" {, <Attach Flag>} } |
                 { "<NPC name>" | <Attach Flag> };
    *stopnpctimer{ "<NPC name>" {, <Detach Flag>}  } |
                 { "<NPC name>" | <Detach Flag> };
    *startnpctimer{ "<NPC name>" {, <Attach Flag>} } |
                  { "<NPC name>" | <Attach Flag> };
    *setnpctimer <tick>{,"<NPC name>"};
    *getnpctimer(<type of information>{,"<NPC name>"})
    *attachnpctimer {"<character name>"};
    *detachnpctimer {"<NPC name>"};
    
    This set of commands and functions will create and manage an NPC-based timer.
    The NPC name may be omitted, in which case the calling NPC is used as target.
    
    Contrary to addtimer/deltimer commands which let you have many different timers
    referencing different labels in the same NPC, each with their own countdown,
    'initnpctimer' can only have one per NPC object. But it can trigger many labels
    and let you know how many were triggered already and how many still remain.
    
    This timer is counting up from 0 in ticks of 1/1000ths of a second each. Upon 
    creating this timer, the execution will not stop, but will happily continue 
    onward. The timer will then invoke new execution threads at labels 
    "OnTimer<time>:" in the NPC object it is attached to. 
    
    To create the timer, use the 'initnpctimer', which will start it running. 
    'stopnpctimer' will pause the timer, without clearing the current tick, while 
    'startnpctimer' will let the paused timer continue.
    
    By default timers do not have a RID attached, which lets them continue even
    if the player that started them logs off. To attach a RID to a timer, you can
    either use the optional "attach flag" when using 'initnpctimer/startnpctimer', 
    or do it manually by using 'attachnpctimer'. Likewise, the optional flag of
    stopnpctimer lets you detach any RID after stopping the timer, and by using
    'detachnpctimer' you can detach a RID at any time.
    
    Normally there is only a single timer per NPC, but as an exception, as long as
    you attach a player to the timer, you can have multiple timers running at once,
    because these will get stored on the players instead of the NPC.
    NOTE: You need to attach the RID before the timer _before_ you start it to
    get a player-attached timer. Otherwise it'll stay a NPC timer (no effect).
    
    If the player that is attached to the npctimer logs out, the "OnTimerQuit:"
    event label of that NPC will be triggered, so you can do the appropriate
    cleanup (the player is still attached when this event is triggered).
    
    The 'setnpctimer' command will explicitly set the timer to a given tick.
    'getnpctimer' provides timer information. Its parameter defines what type:
    
     0 - Will return the current tick count of the timer.
     1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the 
         specified NPC waiting for execution.
     2 - Will return the number of times the timer has triggered and will trigger
         an "OnTimer<tick>:"  label in the specified NPC.
    
    Example 1:
    
        <NPC Header> {
            // We need to use attachnpctimer because the mes command below needs RID attach
            attachnpctimer;
            initnpctimer;
            npctalk "I cant talk right now, give me 10 seconds";
            end;
        OnTimer5000:
            npctalk "Ok 5 seconds more";
            end;
        OnTimer6000:
            npctalk "4";
            end;
        OnTimer7000:
            npctalk "3";
            end;
        OnTimer8000:
            npctalk "2";
            end;
        OnTimer9000:
            npctalk "1";
            end;
        OnTimer10000:
            stopnpctimer;
            mes "[Man]";
            mes "Ok we can talk now";
            detachnpctimer;
            // and remember attachnpctimer and detachnpctimer can only use while the NPC timer is not running !
        }
    
    Example 2:
    
        OnTimer15000:
            npctalk "Another 15 seconds have passed.";
    
            // You have to use 'initnpctimer' instead of 'setnpctimer 0'.
            // This is equal to 'setnpctimer 0' + 'startnpctimer'.
            // Alternatively, you can also insert another 'OnTimer15001' label so that the timer won't stop. */
            initnpctimer;
            end;
           
        // This OnInit label will run when the script is loaded, so that the timer 
        // is initialized immediately as the server starts. It is dropped back to 0 
        // every time the NPC says something, so it will cycle continuously.
        OnInit:
            initnpctimer;
            end;
    
    Example 3:
    
        mes "[Man]";
        mes "I have been waiting "+(getnpctimer(0)/1000)+" seconds for you.";
        // We divide the timer returned by 1000 to convert milliseconds to seconds.
        close;
    
    Example 4:
    
        mes "[Man]";
        mes "Ok, I will let you have 30 more seconds...";
        close2;
        setnpctimer (getnpctimer(0)-30000);
        // Notice the 'close2'. If there were a 'next' there the timer would be 
        // changed only after the player pressed the 'next' button.
        end;
    

    Read this and then if you don't understand something just ask :)

  6. You're using a NPC variable .@accountType$, use an account one: #accountType$

     

    Edit:

     

    You should also use an int variable like:

    #accountType

    if 0 = normal player

    if 1 = VIP

     

    Or make a if(!#accountType$)

     

    Because here your problem is that the .@accountType$ variable is not define so she's equal to "" and since you don't have any if statement for a null variable your script stop here:

    mes"Yo estoy aqui para llevar a los usuarios VIP a las ciudades VIP.";
    	mes"Te interesa?.";
    	next;
    
  7. It should work:

     

    function    script    Ramvp_M    {
        setarray .mvpList$[0],
            "<Mvp Name>:<MvpId>:<MvpCost>",
            "<Mvp Name>:<MvpId>:<MvpCost>";
            
        mes "How do you need help?.";
        menu "Summon Mvp",L_Spawn,"Heal Please",L_Heal,"Leave",L_Leave;
    
        L_Spawn:
            for(set .@i,0; .@i < getarraysize(.mvpList$);set .@i, .@i + 1){
                explode(.mvpData$,.mvpList$[.@i],":");
                if(!.@i) set .menu$, .mvpData$[0];
                else set .@menu$ += ","+.mvpData$[0];
            }
                set .@choice,select(.@menu$);
                explode(.mvpSpawn$,.mvpList$[.@choice + 1],":");
                
                mes "You want to spawn: "+.mvpSpawn$[0],
                    "It cost: "+.mvpSpawn$[2];
                next;
                    switch(select("Yes","No")){
                        case 1:
                            if(ZENY >= atoi(.mvpSpawn$[2])){
                                set ZENY, ZENY - atoi(.mvpSpawn$[2]);
                                monster strcharinfo(3),0,0,.mvpSpawn$[0],atoi(.mvpSpawn$[1]);
                            }
                            else {
                                mes "You don't have enough zeny.";
                                close;
                            }
                        end;
                        
                        case 2:
                            mes "Ok";
                            close;
                    }
        end;
    
        L_Heal:
            mes "Heal cost 1M Zeny";
            next;
                switch(select("Ok","No")){
                    case 1:
                        if(ZENY >= 1000000){
                            set ZENY, ZENY - 1000000;
                            percentheal 100,100;
                        }
                        else {
                            mes "You don't have enough zeny.";
                            close;
                        }
                }
        end;
    
        L_Leave:
            warp "prontera",156,179;
            close;
    
    }
    

     

    Edit: Keep in mind that you can only store 128 value in your array, so you can't have more than 128 MvP in the .mvpList$ var.

  8. dont mind on my "//" in post above, its for testing...

    No, no it's just that since Emistry said you to duplicate your npc to do this i tough that maybe it wasn't possible :)

    But then i don't understand why you should duplicate your npc, having only 1npc wouldn't be better in terms of performance ?

×
×
  • Create New...