Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*///////////////////////////////////////////////////////////////////////////////////////////
- //
- //
- //
- // » Reportavimo sistema by MantasPwn
- // • Naudojama mysql versija r39-2
- // • Naudojamas scanf2 pluginas
- //
- //
- //
- *////////////////////////////////////////////////////////////////////////////////////////////
- #include <a_samp>
- #include <a_mysql>
- #include <sscanf2>
- #define MySQL_HOST "localhost"
- #define MySQL_USER "root"
- #define MySQL_DATA "report"
- #define MySQL_PASS ""
- new handle;
- new PasirinktasZaidejas[MAX_PLAYERS];
- main()
- {
- print("\n----------------------------------");
- print("» Reportavimo sistema by MantasPwn");
- print("----------------------------------\n");
- }
- stock GetPlayerID(const Name[])
- {
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(i, pName, sizeof(pName));
- if(strcmp(Name, pName, true)==0)
- {
- return i;
- }
- }
- }
- return -1;
- }
- public OnGameModeInit()
- {
- mysql_log(LOG_ALL);
- handle = mysql_connect(MySQL_HOST,MySQL_USER,MySQL_DATA,MySQL_PASS);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/report", true))
- {
- ShowPlayerDialog(playerid, 1234, DIALOG_STYLE_LIST, "Reportavimas", "{FFFFFF}[ {ff6600}x {ffFFff}] Reportuoti žaidėja\n{FFFFFF}[ {ff6600}x {ffFFff}] Reportuoti klaidą žaidime", "Toliau", "Atšaukti");
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 1234)
- {
- if(response)
- {
- if(listitem == 0) ShowPlayerDialog(playerid, 1235, DIALOG_STYLE_INPUT, "Reportavimas", "{FFFFFF}[ {ff6600}x {ffFFff}] Įveskite žaidėjo slapyvardį, apie kurį norite pranešti\n{FFFFFF}[ {ff6600}x {ffFFff}] Žaidėjas turi būti serveryje!", "Toliau", "Atšaukti");
- if(listitem == 1) ShowPlayerDialog(playerid, 1237, DIALOG_STYLE_INPUT, "Reportavimas", "{FFFFFF}[ {ff6600}x {ffFFff}] Aprašykite klaidą:", "Toliau", "Atšaukti");
- }
- }
- if(dialogid == 1235)
- {
- if(response)
- {
- new Name[MAX_PLAYER_NAME];
- new msg[180];
- new player;
- player = GetPlayerID(inputtext);
- if(sscanf(inputtext, "u", player)) return SendClientMessage(playerid, 0xAA3333AA, "* Laukelis negali būti tusčias!");
- if(!IsPlayerConnected(player)){
- SendClientMessage(playerid, 0xAA3333AA, "* Įvestas žaidėjas neprisijunges!");
- ShowPlayerDialog(playerid, 1235, DIALOG_STYLE_INPUT, "Reportavimas", "{FFFFFF}[ {ff6600}x {ffFFff}] Įveskite žaidėjo slapyvardį, apie kurį norite pranešti\n{FFFFFF}[ {ff6600}x {ffFFff}] Žaidėjas turi būti serveryje!", "Toliau", "Atšaukti");
- return 1;
- }
- PasirinktasZaidejas[playerid] = player;
- GetPlayerName(PasirinktasZaidejas[playerid], Name, MAX_PLAYER_NAME);
- format(msg, sizeof(msg), "{FFFFFF}[ {ff6600}x {ffFFff}] Įvestas žaidėjo slapyvardis: {ff6600}%s\n{FFFFFF}[ {ff6600}x {ffFFff}] Prašome įrašyti priežastį:", Name);
- ShowPlayerDialog(playerid, 1236, DIALOG_STYLE_INPUT, "Reportavimas", msg, "Reportuoti", "Atšaukti");
- }
- }
- if(dialogid == 1236)
- {
- if(response)
- {
- new player = PasirinktasZaidejas[playerid];
- if(strlen(inputtext) < 5)
- {
- new msg[160];
- new Name[MAX_PLAYER_NAME];
- GetPlayerName(player, Name, MAX_PLAYER_NAME);
- format(msg, sizeof(msg), "{FFFFFF}[ {ff6600}x {ffFFff}] Įvestas žaidėjo slapyvardis: {ff6600}%s\n{FFFFFF}[ {ff6600}x {ffFFff}]Prašome įrašyti priežastį:\n{FF0000}• Priežastį turi sudaryti nemažiau kaip 5 raidės!", Name);
- ShowPlayerDialog(playerid, 1236, DIALOG_STYLE_INPUT, "Reportavimas", msg, "Reportuoti", "Atšaukti");
- SendClientMessage(playerid, 0xAA3333AA, "* Priežastį turi sudaryti nemažiau kaip 5 raidės!");
- return 1;
- }
- new msg[150];
- new Pazeidejas[MAX_PLAYER_NAME];
- new Zaidejas[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Zaidejas, MAX_PLAYER_NAME);
- GetPlayerName(player, Pazeidejas, MAX_PLAYER_NAME);
- format(msg, sizeof(msg), "{FFFFFF}[{ff6600}REPORT{FFFFFF}] Žaidėjas {ff6600}%s{ffFFff} reportavo {ff6600}%s{ffFFff} dėl {ff6600}%s",Zaidejas, Pazeidejas, inputtext);
- SendClientMessageToAll(-1, msg);
- }
- }
- if(dialogid == 1237)
- {
- if(response)
- {
- if(strlen(inputtext) < 15) return ShowPlayerDialog(playerid, 1237, DIALOG_STYLE_INPUT, "Reportavimas", "{FFFFFF}[ {ff6600}x {ffFFff}] Aprašykite klaidą:\n{FF0000}• Per mažai įvesta simbolių!", "Toliau", "Atšaukti");
- new rows, fields;
- new Zaidejas[MAX_PLAYER_NAME];
- new msg[150];
- new query[120];
- mysql_query(handle,"SELECT * FROM reports");
- cache_get_data(rows, fields);
- rows++;
- GetPlayerName(playerid, Zaidejas, MAX_PLAYER_NAME);
- format(query, sizeof(query), "INSERT INTO `reports` (ReportID,Zaidejas,Klaida) VALUES('%d','%s','%s')", rows, Zaidejas, inputtext);
- mysql_query(handle, query);
- format(msg, sizeof(msg), "{FFFFFF}[{ff6600}REPORT ID %i{FFFFFF}] Ačiū! Klaida buvo įrašyta į d. baze!",rows);
- SendClientMessage(playerid, -1, msg);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement