Nokia Posted January 24, 2012 Posted January 24, 2012 Hi there, i want to make a "guild reward" npc, the npc should warp all members in a lvl 50 guild to a map. like this: mes hi bla if guild lvl is not 50 mes you cant use this service close else warp bla end but i cant find any script function in eathena to check the guild lvl via scripts, or i missed something? Quote
Z3R0 Posted January 24, 2012 Posted January 24, 2012 I don't believe you can actually check guild level via a script command (single command) you can get the name of the guild, if they are in one, and then read the SQL DB for the level value Quote
Aleos Posted January 24, 2012 Posted January 24, 2012 As Z3R0 said, there is no actual scripting command to get the level of a guild, but this is a simple NPC to get it without having to make an actual command. prontera,150,150,3 script Guild Level 100,{ set .@guild_id,strcharinfo(2); if ( !.@guild_id ) { mes "You aren't in a guild!"; close; } query_sql "SELECT `guild_lv` FROM `guild` WHERE `guild_id` = '"+ .@guild_id +"'",.@guild_lv; mes "Your guild level is "+ .@guild_lv +"!"; close; } Quote
Nokia Posted January 24, 2012 Author Posted January 24, 2012 hmm, the sql part isent working for me, the npc always says im not in a guild and if i cut the script into this: prontera,150,150,3 script Guild Level 100,{ query_sql "SELECT `guild_lv` FROM `guild` WHERE `guild_id` = '"+ .@guild_id +"'",.@guild_lv; mes "Your guild level is "+ .@guild_lv +"!"; close; } then the npc always says your guild lvl is 0, but its not. Quote
Brian Posted January 24, 2012 Posted January 24, 2012 (edited) prontera,155,188,0 script GuildLevel50 910,{ query_sql "SELECT guild_lv FROM guild WHERE guild_id = "+getcharid(2), .@guild_lv; mes "hi bla"; if (getcharid(2) == 0) { mes "You are not in a guild."; } else if (.@guild_lv < 50) { mes "you cant use this service"; mes "Your guild must be level 50."; } else { warp "bla",0,0; } close; } @Nokia: your example isn't working because .@guild_id isn't set, so it's 0. Then your 'query_sql' looks up the guild_lv for guild_id 0 (which doesn't exist). Try the full script Aleos posted, or the example I posted above. Edited January 24, 2012 by Brian Quote
Nokia Posted January 24, 2012 Author Posted January 24, 2012 ah thanks, but now the npc always says my guild is not lvl 50, but my guild is lvl 50 :/ Quote
Brian Posted January 24, 2012 Posted January 24, 2012 Did you recently level up to 50? since we are querying SQL, there is a slight delay. The map-server saves guild info every 60 seconds (or whatever you have autosave_time set to). Quote
Nokia Posted January 24, 2012 Author Posted January 24, 2012 ah i see, i changed my glvl with @glvl, it works if i wait 60 seconds, thanks Quote
REKT Posted January 25, 2012 Posted January 25, 2012 Hello, Brian how about this? I wanted to 'check guild' name and 'no guild' also. prontera,155,188,0 script Check Guild 910,{ query_sql "SELECT guild FROM guild WHERE guild_id = "+getcharid(2), .@guild; mes "hi bla"; if (getcharid(2) == 0) { mes "Guilde: None Guild"; } // Other else { mes "Guild:"; warp "bla",0,0; } close; } Thank you :3 Quote
Brian Posted January 26, 2012 Posted January 26, 2012 For guild name, there is a script command: getguildname mes "Guild name:"; mes getguildname(getcharid(2)); Quote
Question
Nokia
Hi there, i want to make a "guild reward" npc, the npc should warp all members in a lvl 50 guild to a map. like this:
mes hi bla
if guild lvl is not 50
mes you cant use this service
close
else
warp bla
end
but i cant find any script function in eathena to check the guild lvl via scripts, or i missed something?
9 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.