1 Capuche Posted June 3, 2013 Posted June 3, 2013 if ( query_sql ( "SELECT 1 FROM `guild` WHERE `name` = '"+escape_sql( @gcreatenm$ )+"'", .@tmp ) ){ Quote
Jaburak Posted June 3, 2013 Posted June 3, 2013 This is absolutely wrong. SELECT `name` FROM `guild` WHERE `name` Quote
DeadlySilence Posted June 3, 2013 Posted June 3, 2013 It is not an error, just a warning because you read one column from the database without saving it to a variable. Thus, the script warns you that you don't do anything with the variable. Quote
DeadlySilence Posted June 3, 2013 Posted June 3, 2013 Change your query to query_sql("<your query>", .@name$). Quote
caspa Posted June 3, 2013 Author Posted June 3, 2013 (edited) i don't know how to properly do it...here's my script zhakastia,92,56,4 script Guild Manager 81,{ set .item1, 714; // Item ID 1 set .item2, 677; // Item ID 2 set .itemreq1, 9; // Ammount of item number 1 (9 since an emp is also consumed naturally upon guild creation) set .itemreq2, 10; // Ammount of item number 2 set .name$, "[^FF0000Guild Manager^000000]"; mes .name$; mes "Hello there "+strcharinfo(0)+"."; mes "I can help you form a guild or disband your current one."; menu "Sign-up for Guild Creation.",L_create,"Disband Guild.",L_disband,"Any requirements?",L_req,"No thanks.",L_cya; L_create: if(getpartyleader(getcharid(1)) == strcharinfo(0)) && (getcharid(2) == 0) { goto L_approve; } else { goto L_inguild; end; } L_approve: next; mes .name$; mes "Alright, I need you to tell me the name you want for your guild."; sleep2 1500; input @gcreatenm$; mes "Are you sure that's what you want?"; switch(select("Yes:No")) { case1: if ( query_sql ( "SELECT `name` FROM `guild` WHERE `name` = '"+escape_sql( @gcreatenm$ )+"'" ) ){ mes .name$; mes "'^ff0000"+@gcreatenm$+"^000000' has already been used."; mes "Please try another one."; next; goto L_create; end; } if(countitem(.item1) < .itemreq1) && (countitem(.item2) < .itemreq2) { goto L_nope; end; } mes .name$; mes "Alright then let's try this..."; atcommand "@guild "+@gcreatenm$; next; if(getcharid(2) == 0) { mes "Woops, seems like that guild already exists...try another name."; goto L_create; end; } announce strcharinfo(0)+" has created "+strcharinfo(2)+" Guild!",0; mes .name$; mes "Congrats."; delitem .item1, .itemreq1; delitem .item2, .itemreq2; close; end; case2: goto L_create; end; } L_disband: if(getcharid(2) == 0) { goto L_noguild; end; } if(getguildmaster(getcharid(2)) == strcharinfo(0)) { next; mes .name$; mes "Type this:"; mes "/breakguild ''"+strcharinfo(2)+"''"; close; end; } else { mes .name$; mes "You're not the guild leader."; close; end; } L_req: next; mes .name$; mes "You'll need "+.itemreq1+" pieces of "+getitemname(.item1)+" and "+.itemreq2+" pieces of "+getitemname(.item2)+"."; close; end; L_nope: next; mes .name$; mes "Bring me the items first!"; close; L_inguild: next; mes .name$; mes "You're either already in a guild or you're not the party leader!"; close; L_noguild: next; mes .name$; mes "You're not even in a guild!"; close; L_cya: next; mes .name$; mes "Next time then!"; close; } Edited June 3, 2013 by caspa Quote
Emistry Posted June 3, 2013 Posted June 3, 2013 you can also do like this if not mistaken .. SELECT 1 FROM `guild` WHERE `name` but still i believe add the part that save it into a variable would be better. Quote
Question
caspa
i got error on this part.
7 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.