Tsuuu 11 Posted January 18, 2017 Good Morning, could someone tell me how I can remove this 'warning' in map-server: 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. Quote Share this post Link to post Share on other sites
0 KirieZ 88 Posted January 18, 2017 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 1 Tsuuu reacted to this Quote Share this post Link to post Share on other sites
0 Tsuuu 11 Posted January 18, 2017 (edited) 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 January 19, 2017 by Tsuuu Quote Share this post Link to post Share on other sites
0 KirieZ 88 Posted January 22, 2017 Sorry for the delay, I didn't see your edit. You can see the documentation here: https://github.com/HerculesWS/Hercules/blob/master/doc/script_commands.txt#L7549 1 Tsuuu reacted to this Quote Share this post Link to post Share on other sites
Good Morning, could someone tell me how I can remove this 'warning' in map-server:
Here is the script:
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