Jump to content
  • 0
caspa

Check Guild If Already Exist

Question

I'm implementing a guild maker on my server........

i would like to know how to check if the one i've input already exist in the database?

 

 
prontera,150,150,1    script    Guild Creator    50,{
 
mes "[Guild Creator]";
mes "Hi. Want a guild?";
switch(select("No!:Yes!")) {
case 1:
    next;
    mes "[Guild Creator]";
    mes "Very well.";
    close;
case 2:
    if(getcharid(2) == 1) { // Check for belonging to a guild
        next;
        mes "[Guild Creator]";
        mes "You are already in a guild!";
        mes "Please leave your current guild before trying to create a new one.";
        close;
    }
    goto L_guildname;
 
L_guildname:
    next;
    mes "[Guild Creator]";
    mes "What would you like the name to be?";
    input [email protected]$;
    next;
    mes "[Guild Creator]";
    mes "Is this right?";
    mes "''"[email protected]$+"''";
    switch(select("No, I'd like to retry.:Perfect!")) {
    case 1:
        mes "[Guild Creator]";
        mes "Sorry!";
        goto L_guildname;
    case 2:
        atcommand "@guild "[email protected]$;
        mes "[Guild Creator]";
        mes "Enjoy!";
        close;
        }
    }
}
Edited by caspa
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

try like this ?

if( query_sql( "SELECT `name` FROM `guild` WHERE `name` = '"+escape_sql( [email protected]$ )+"'" ) ){
	mes "This guild name already exist.";
}else{
	mes "This name is available...";
}
close;

refer query_sql , escape_sql

Link to comment
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.   Paste as plain text instead

  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.



×
×
  • Create New...

Important Information

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