· 6 years ago · Mar 16, 2019, 08:40 PM
1// /bdd appels :
2
3// BASE DE DONNEE (sql)
4
5DROP TABLE IF EXISTS `lspd_data_calls`;
6CREATE TABLE IF NOT EXISTS `lspd_data_calls` (
7 `id` int(11) NOT NULL AUTO_INCREMENT,
8 `status` tinyint(4) NOT NULL,
9 `userinfo` varchar(24) NOT NULL,
10 `reason` varchar(64) NOT NULL,
11 `date` datetime NOT NULL,
12 `phone` varchar(24) NOT NULL,
13 PRIMARY KEY (`id`)
14) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;
15
16
17
18
19else if(!strcmp(tmp, "appels", true))
20 {
21 new Cache:result,
22 user[24],
23 phone[20],
24 bigString[1024];
25
26 format(string, sizeof(string), "SELECT `id`, `phone`, `userinfo`, `date` FROM `lspd_data_calls` WHERE status='1' ORDER BY id");
27 result = mysql_query(g_Handle, string);
28
29 if(cache_num_rows())
30 {
31 for(new i, count = cache_get_row_count(); i < count ; i++)
32 {
33 cache_get_field_content(0, "phone", phone, g_Handle, 20);
34 cache_get_field_content(0, "userinfo", user, g_Handle, 24);
35
36 p_Items[playerid][i] = cache_get_field_content_int(i, "id");
37 }
38
39 format(bigString, sizeof(bigString),"%s / %s", user, phone);
40 ShowPlayerDialog(playerid, DIALOG_LSPD_CALLS, DIALOG_STYLE_TABLIST, "RECAPITULATIF DES APPELS 911", bigString, "Voir", "Quitter");
41 }
42 else {
43 SendClientMessage(playerid, COLOR_RED, "Aucun appel 911.");
44 }
45
46 cache_delete(result);
47 return true;
48 }
49
50// Dialogs
51
52 // APPELS 911
53 /* APPELS 911 LSPD */
54 else if(dialogid == DIALOG_LSPD_CALLS)
55 {
56 new reason[128],
57 userinfo[24],
58 phone[20],
59 menuindex[800],
60 createdtime[32],
61 itemid = p_Items[playerid][listitem],
62 Cache: result;
63
64 if(!response) return 1;
65 else
66 {
67 mysql_format(g_Handle, string, sizeof(string),"SELECT reason, userinfo, phone, date FROM lspd_data_calls WHERE id = %d AND status=1", itemid);
68 result = mysql_query(g_Handle, string);
69
70 if(cache_num_rows())
71 {
72 cache_get_field_content(0, "reason", reason, g_Handle, 128);
73 cache_get_field_content(0, "userinfo", userinfo, g_Handle, 24);
74 cache_get_field_content(0, "phone", phone, g_Handle, 20);
75
76 cache_get_field_content(0, "date", createdtime, g_Handle, 32);
77 }
78
79
80 format(string, sizeof(string), " {E2DCD9}[INFORMATIONS DU 911]{9FB1EE}\n\n \
81 Date d'émission : {FFFFFF}%s\n", createdtime);
82 strcat(menuindex, string);
83
84 format(string, sizeof(string), "{9FB1EE} Requérant : {FFFFFF}%s\n\n", userinfo);
85 strcat(menuindex, string);
86
87 format(string, sizeof(string), "{9FB1EE} Numéro de téléphone : {FFFFFF}%s\n\n", phone);
88 strcat(menuindex, string);
89
90 format(string, sizeof(string), "{9FB1EE} Motif : {FFFFFF}%s\n", reason);
91 strcat(menuindex, string);
92
93
94 format(string, sizeof(string), "Appel 911 / %s", userinfo);
95 ShowPlayerDialog(playerid, DIALOG_LSPD_CALLS+1, DIALOG_STYLE_MSGBOX, string, menuindex, "Prendre", "Retour");
96 cache_delete(result);
97 }
98 return 1;
99 }
100 else if(dialogid == DIALOG_LSPD_CALLS+1)
101 {
102 if(response == 1)
103 {
104 format(query, sizeof(query),"UPDATE lspd_data_calls SET status = 0");
105 mysql_tquery(g_Handle, query, "SendQuery", "");
106 PlayerPlaySound(playerid, 1058, 0.0, 0.0, 10.0);
107
108 SendClientMessage(playerid, COLOR_LIGHTBLUE, "Vous avez pris en charge un appel 911. Ce dernier a été archivé.");
109
110 }
111 else return OnPlayerCommandText(playerid, "/bdd appels");
112 return 1;
113 }
114
115// (Optionnel) : FORME RECEPTION APPEL 911
116if(JobInfo[j][jPhone] == 911 && IsPlayerLogged(p) && PlayerInfo[p][pJob] == JobInfo[j][jSQL] && PlayerInfo[p][pJobRank] > 0) // LSPD
117 {
118 printf("%s, %s, %s, NOW()", text, sendername, FormatPhone(CallNumber[playerid]));
119
120 SendClientMessage(p, COLOR_RADIO, "|________________ APPEL 911 ________________|");
121
122 format(string, sizeof(string), "Requérant : %s Numéro de téléphone : %s", sendername, FormatPhone(CallNumber[playerid]));
123 SendClientMessage(p, -1, string);
124
125 format(string, sizeof(string), "Demande : %s", text);
126 SendClientMessage(p, -1, string);
127
128 mysql_format(g_Handle, query, sizeof(query),"INSERT INTO lspd_data_calls (`reason`, `userinfo`, `phone`, `date`, `status`) VALUES ('%s', '%s', '%s', NOW(), '1')", text, sendername, FormatPhone(CallNumber[playerid]));
129 mysql_tquery(g_Handle, query, "SendQuery", "");
130
131 }
132
133// NE PAS OUBLIER D'EDIT :
134
135if(IsPlayerLogged(p) && PlayerInfo[p][pJob] == JobInfo[j][jSQL] && PlayerInfo[p][pJobRank] > 0)
136
137// EN :
138
139if(IsPlayerLogged(p) && PlayerInfo[p][pJob] == JobInfo[j][jSQL] && PlayerInfo[p][pJobRank] > 0 && JobInfo[j][jPhone] != 911)