Hi @Emistry
Thank you for the help, I was able to complete the script somehow, but i'm getting a debug error
[Warning]: script:query_sql: Too many columns, discarding last 1 columns.
[Debug]: Source (NPC): Tournament at gm_room (77,47)
It seems to be the checkExist if statement
if( query_sql( "SELECT `team_name` FROM `tournament` WHERE `team_name` = '"+escape_sql( .@team_name$ )+"'" ) ){
gm_room,77,47,5 script Tournament 757,{
query_sql( "SELECT * FROM `tournament` WHERE `char_id`='"+escape_sql( getcharid(0) )+"'",.@w_id$,.@a_id$,.@c_id$,.@c_name$,.@team_name$,.amount$,.@time$ );
goto checkExist;
checkExist:
if( query_sql( "SELECT `team_name` FROM `tournament` WHERE `team_name` = '"+escape_sql( .@team_name$ )+"'" ) ){
goto boundAddress;
}
else {
goto addMember;
}
boundAddress:
mes "This character is already registered to the team:";
mes "^FF0000"+.@team_name$+"";
mes "You can't change your wallet address at this time.";
close;
checkTotal:
mes "Do you want ";
query_sql( "SELECT COUNT(1) FROM `tournament` WHERE `team_name` = '"+escape_sql(.@w_reg$)+"' GROUP BY `team_name",.@amount );
mes "Total Member: " + .@amount;
if (.@amount >= 3) {
goto moreThanThree;
}
else {
query_sql "INSERT INTO `tournament` VALUES ( '', '" + .@a_id$ + "', '" + getcharid(0) + "', '" + strcharinfo(0) + "', '" + .@w_reg$ + "', '1' , NOW() )";
close;
}
moreThanThree:
mes "There are already 3 members of that team.";
close;
addMember:
mes "Enter your team name";
input .@w_reg$;
goto checkTotal;
close;
}