I'm using Feefty's support ticket system and this script came along with it (see bottom)
this script checks for support tickets. As of now, all the support tickets are showing except the ones that got deleted... I want the "solved" and "closed" ones to not appear when I use @checkunread / @cu in-game. In the sql database status 0 and status 2 are closed and resolved if that helps anything. I need a query for that to exclude these statuses but i cant figure it out, this is what i have so far:
query_sql("SELECT status = 0 FROM cp_support_tickets");
set .@sql$, .@sql$ - "1";
Thanks so much who can figure this out for me!
Whole script (unedited yet):
- script atcmd_ticket_notify -1,{
OnInit:
bindatcmd("checkunread", "atcmd_ticket_notify::OnAtcommand");
bindatcmd("cu", "atcmd_ticket_notify::OnAtcommand");
end;
OnAtcommand:
set .@unreadmsg$, "You have %d unread support tickets.";
set .@sql$, "SELECT id, department, ticket_read FROM cp_support_tickets WHERE ";
if (getgmlevel() > 0) {
set .@sql$, .@sql$ + "1";
} else {
set .@sql$, .@sql$ + "account_id = " + getcharid(3) + " AND unread = 1";
}
set .@count, query_sql(.@sql$, @id, @department, @ticket_read$);
if (.@count) {
if (getgmlevel() == 0) {
dispbottom(sprintf(.@unreadmsg$, .@count));
end;
}
if (.@count > 1) {
set .@ticket_count, 0;
for (set .@i, 0; .@i < getarraysize(@id); .@i++) {
set .@isRead, 0;
query_sql("SELECT group_id FROM cp_support_dep WHERE id = " + @department[.@i], @group_id);
if (@ticket_read$ != "") {
explode(.@tickets_read$, @ticket_read$[.@i], ",");
for (set .@j, 0; .@j < getarraysize(.@tickets_read$); .@j++) {
if (atoi(.@tickets_read$[.@j]) == getcharid(3)) {
set .@isRead, 1;
break;
}
}
}
if (@group_id <= getgmlevel() && .isRead == 0) {
.@ticket_count++;
}
}
dispbottom(sprintf(.@unreadmsg$, .@count));
end;
} else {
query_sql("SELECT group_id FROM cp_support_dep WHERE id = " + @department, @group_id);
set .@isRead, 0;
if (@ticket_read$ != "") {
explode(.@tickets_read$, @ticket_read$, ",");
for (set .@j, 0; .@j < getarraysize(.@tickets_read$); .@j++) {
if (atoi(.@tickets_read$[.@j]) == getcharid(3)) {
set .@isRead, 1;
break;
}
}
}
if (@group_id <= getgmlevel() && .@isRead == 0) {
dispbottom(sprintf(.@unreadmsg$, .@count));
end;
} else {
dispbottom(sprintf(.@unreadmsg$, 0));
end;
}
}
} else {
dispbottom(sprintf(.@unreadmsg$, 0));
end;
}
end;
}
Question
HristDead
Hi rAthena,
I'm using Feefty's support ticket system and this script came along with it (see bottom)
this script checks for support tickets. As of now, all the support tickets are showing except the ones that got deleted... I want the "solved" and "closed" ones to not appear when I use @checkunread / @cu in-game. In the sql database status 0 and status 2 are closed and resolved if that helps anything. I need a query for that to exclude these statuses but i cant figure it out, this is what i have so far:
Thanks so much who can figure this out for me!
Whole script (unedited yet):
Link to comment
Share on other sites
0 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.