Jump to content
  • 0

Check Guild If Already Exist


caspa

Question


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

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 .@gname$;
    next;
    mes "[Guild Creator]";
    mes "Is this right?";
    mes "''"+.@gname$+"''";
    switch(select("No, I'd like to retry.:Perfect!")) {
    case 1:
        mes "[Guild Creator]";
        mes "Sorry!";
        goto L_guildname;
    case 2:
        atcommand "@guild "+.@gname$;
        mes "[Guild Creator]";
        mes "Enjoy!";
        close;
        }
    }
}
Edited by caspa
Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

try like this ?

if( query_sql( "SELECT `name` FROM `guild` WHERE `name` = '"+escape_sql( .@gname$ )+"'" ) ){
	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


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

thank you em... [ solved ]

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

atcommand "@guild "+.@gname$;

if the name is already used, the serveur send a message to the player which used @guild

You are already in a Guild.

just to point it out

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