Jump to content
  • 0
Tsuuu

Help with .@atcmd_parameters$[]

Question

Good Morning, could someone tell me how I can remove this 'warning' in map-server:

 

post-5267-0-78797800-1484745072_thumb.jpg

 

 

Here is the script:

 

 

 

bindatcmd "warp",strnpcinfo(3)+"::OnAtcommand4";
OnAtcommand4:	
getmapxy @map$,@x,@y,0;	
if(@map$=="bra_dun01") { 
	message strcharinfo(0),"WARP OFF.";
	end; 
	} else {

		if(.@atcmd_parameters$[1])
		{
			if ( WARPCOORCD + 5 > gettimetick(2) ) {
				message strcharinfo(0),"[Delay Warp com Coordenadas] ---> Você precisa esperar " + ( WARPCOORCD + 5 - gettimetick(2) ) + " segundos.";		
				end;	
			} else {
				atcommand "@warp "+.@atcmd_parameters$[0]+" "+.@atcmd_parameters$[1]+" "+.@atcmd_parameters$[2]+"";
				WARPCOORCD = gettimetick(2);
				end;
			}
		} else {
			atcommand "@warp "+.@atcmd_parameters$[0]+"";
		}

	}
}

 

 

 

PS: I'm a beginner, so please do not repair the code, just help me optimize it.

PS²: I sure use hercules.

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

The problem is at:

if(.@atcmd_parameters$[1])

if expression must result in a number (0 for false or other numbers for true) and there you're giving it a string (notice the $).

I'm not sure what you're trying to compare there, but a example would be:

if(.@atcmd_parameters$[1] == "1") // runs if parameters[1] is equal to 1

Maybe you're trying to check if the parameter exists? It would probably be better to use .@atcmd_numparameters instead. Example:

if (.@atcmd_numparameters == 2) // So parameters[0] and parameters[1] exists

Hope this helps

Share this post


Link to post
Share on other sites
  • 0

I'm at work and I can not test now, as soon as I get home I'm going to test, thank you very much for helping me, I'll return on this topic to notify you if it worked or not

 

@edit

 

 

Forgive me the delay, you helped me, thank you very much, could you inform me where I see the documentation of these parameter commands?

 

 

It stayed like this, works perfectly without any warning on the map-serv:

OnAtcommand4:    
getmapxy @map$,@x,@y,0;    
if(@map$=="bra_dun01") {
    message strcharinfo(0),"WARP OFF.";
    end;
    } else {
    
        if(.@atcmd_numparameters == 3)
        {
            if ( WARPCOORCD + 5 > gettimetick(2) ) {
                dispbottom "[Delay Warp com Coordenadas] ---> Você precisa esperar " + ( WARPCOORCD + 5 - gettimetick(2) ) + " segundos.";        
                end;    
            } else {
                atcommand "@warp "+.@atcmd_parameters$[0]+" "+.@atcmd_parameters$[1]+" "+.@atcmd_parameters$[2]+"";
                WARPCOORCD = gettimetick(2);
                end;
            }
        } else if(.@atcmd_numparameters == 2){
        
            dispbottom "Você utilizou o warp com coordenadas erradas, corriga o comando.";
            end;
            
        } else {
            atcommand "@warp "+.@atcmd_parameters$[0]+"";
        }

    }
}

 


 

Edited by Tsuuu

Share this post


Link to post
Share on other sites

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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.