11.07.2016, 13:56
Can someone help me, I Want a MDC Box that pops up when you do /mdc
Like it to show.
Lookup Name
- When done I want it to show
Sex Male/Female
Phone Number
Crimes
Tickets
Lookup Phone Number
Like it to show.
Lookup Name
- When done I want it to show
Sex Male/Female
Phone Number
Crimes
Tickets
Lookup Phone Number
Код:
forward OnMDCLookup(playerid, name[]); public OnMDCLookup(playerid, name[]) { new msg[128]; new rows,fields; cache_get_data(rows,fields); if(rows < 1) { SendClientMessage(playerid, X11_TOMATO_2, "* MDC: No one on record found!"); return 1; } cache_get_row(0, 0, msg); MDCLookup(playerid, strval(msg)); return 1; } MDCLookup(playerid, id) { new msg[256]; format(msg, sizeof(msg), "SELECT `c1`.`username`,`c1`.`phonenumber`,`c1`.`sex`,`c1`.`id` FROM `characters` AS `c1` WHERE `c1`.`id` = %d",id); mysql_function_query(g_mysql_handle, msg, true, "OnMDCRetrieve", "d",playerid); } forward OnMDCRetrieve(playerid); public OnMDCRetrieve(playerid) { new string[128],id_string[128]; new rows, fields; cache_get_data(rows, fields); if(rows < 1) return 0; SendClientMessage(playerid, TEAM_BLUE_COLOR,"______-=MOBILE DATA COMPUTER=-_______"); cache_get_row(0, 0, id_string); format(string, sizeof(string), "Name : %s", id_string); SendClientMessage(playerid, X11_WHITE,string); cache_get_row(0, 1, id_string); format(string, sizeof(string), "Phone Number : %s", id_string); SendClientMessage(playerid, X11_WHITE,string); cache_get_row(0, 2, id_string); format(string, sizeof(string), "Sex : %s", GetSexName(strval(id_string))); SendClientMessage(playerid, X11_WHITE,string); cache_get_row(0, 3, id_string); new sqlid = strval(id_string); sendCrimes(playerid, sqlid); sendTickets(playerid, sqlid); return 1; } forward OnCrimesRetrieve(playerid); public OnCrimesRetrieve(playerid) { new rows, fields; new id_string[128]; new string[128]; cache_get_data(rows, fields); SendClientMessage(playerid, TEAM_BLUE_COLOR,"______________ * Crimes * _______________"); if(rows > 0) { for(new i=0;i<rows;i++) { cache_get_row(i, 2, id_string); if(!strcmp(id_string, "NULL", true)) { format(string, sizeof(string), "* Issuer: %s",id_string); SendClientMessage(playerid, X11_WHITE,string); } cache_get_row(i, 3, id_string); format(string, sizeof(string), "* Reason: %s",id_string); SendClientMessage(playerid, X11_WHITE,string); cache_get_row(i, 4, id_string); if(id_string[0] == '0') { format(string, sizeof(string), "* Issued: %s",id_string); SendClientMessage(playerid, X11_WHITE,string); } SendClientMessage(playerid, X11_WHITE,"*************************"); } } } forward OnTicketsRetrieve(playerid); public OnTicketsRetrieve(playerid) { new rows, fields; new id_string[128]; new string[128]; cache_get_data(rows, fields); SendClientMessage(playerid, TEAM_BLUE_COLOR,"______________ * Tickets * _______________"); if(rows > 0) { for(new i=0;i<rows;i++) { cache_get_row(i, 2, id_string); format(string, sizeof(string), "* Issuer: %s",id_string); SendClientMessage(playerid, X11_WHITE,string); cache_get_row(i, 3, id_string); format(string, sizeof(string), "* Reason: %s",id_string); SendClientMessage(playerid, X11_WHITE,string); cache_get_row(i, 4, id_string); format(string, sizeof(string), "* Issued: %s",id_string); SendClientMessage(playerid, X11_WHITE,string); SendClientMessage(playerid, X11_WHITE,"*************************"); } } } sendCrimes(playerid, sqlid) { format(query, sizeof(query), "SELECT `crimes`.`id`,`c1`.`username`,`c2`.`username`,`reason`,`issuetime` FROM `crimes` INNER JOIN `characters` AS `c1` ON `c1`.`id` = `suspect` LEFT JOIN `characters` AS `c2` ON `c2`.`id` = `issuer` WHERE `suspect` = %d",sqlid); mysql_function_query(g_mysql_handle, query, true, "OnCrimesRetrieve", "d",playerid); } sendTickets(playerid, sqlid) { format(query, sizeof(query), "SELECT `tickets`.`id`,`c1`.`username`,IFNULL(`c2`.`username`,\"Los Santos\"),`reason`,`issuetime` FROM `tickets` INNER JOIN `characters` AS `c1` ON `c1`.`id` = `owner` LEFT JOIN `characters` AS `c2` ON `c2`.`id` = `issuer` WHERE `owner` = %d",sqlid); mysql_function_query(g_mysql_handle, query, true, "OnTicketsRetrieve", "d",playerid); } InsertCrime(target, playerid, crime[]) { query[0] = 0; new crime_esc[(64*2)+1]; mysql_real_escape_string(crime, crime_esc); format(query, sizeof(query), "INSERT INTO `crimes` (`issuer`,`suspect`,`reason`) VALUES (%d, %d, \"%s\")",GetPVarInt(playerid, "CharID"), GetPVarInt(target, "CharID"),crime_esc); mysql_function_query(g_mysql_handle, query, true, "EmptyCallback", ""); } SendCrimeMessage(target, playerid, crime[]) { new msg[128]; format(msg, sizeof(msg), "HQ: All Units APB: Reporter: %s",GetPlayerNameEx(playerid, ENameType_RPName_NoMask)); SendCopMessage(TEAM_BLUE_COLOR, msg); format(msg, sizeof(msg), "HQ: Crime: %s, Suspect: %s",crime,GetPlayerNameEx(target, ENameType_RPName_NoMask)); SendCopMessage(TEAM_BLUE_COLOR, msg); return 1;