Guest User

Untitled

a guest
May 26th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.18 KB | None | 0 0
  1. public OnPlayerText(playerid, text[]) {
  2.     #if defined DEBUG
  3.         printf("[debug] OnPlayerText(%d, %s)", playerid, text);
  4.     #endif
  5.  
  6.     if(playerVariables[playerid][pStatus] >= 1 && playerVariables[playerid][pMuted] == 0) {
  7.         new
  8.             queryString[255],
  9.             iRetStr = strfind(text, "(", true, 0),
  10.             textString[128];
  11.            
  12.         GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
  13.         for(new i = 0; i < strlen(szPlayerName); i++) {
  14.             if (szPlayerName[i] == '_') szPlayerName[i] = ' ';
  15.         }
  16.  
  17.         if(iRetStr < 4 && iRetStr != -1 && playerVariables[playerid][pAdminDuty] == 0) {
  18.             format(textString, sizeof(textString), "(( %s dice: %s ))", szPlayerName, text);
  19.             nearByMessage(playerid, COLOR_ICE, textString);
  20.         }
  21.  
  22.         if(playerVariables[playerid][pPhoneCall] != -1) {
  23.             format(textString, sizeof(textString), "(Cellulare) \"%s\"", text);
  24.             if(!strcmp(playerVariables[playerid][pAccent], "none", true))
  25.                 format(textString, sizeof(textString), "(Cellulare) %s dice: %s", szPlayerName, text);
  26.             else
  27.                 format(textString, sizeof(textString), "(Cellulare) (Accento %s) %s dice: %s", playerVariables[playerid][pAccent], szPlayerName, text);
  28.  
  29.             nearByMessage(playerid, COLOR_WHITE, textString);
  30.  
  31.             switch (playerVariables[playerid][pPhoneCall]) {
  32.                 case 455: {
  33.                     if(strlen(text) > 1) {
  34.                         new location[MAX_ZONE_NAME];
  35.  
  36.                         GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
  37.                         SendToJob(3, COLOR_BROWN,"|___________S.O.S. Reporting___________|");
  38.                         format(textString, sizeof(textString), "Soggetto: %s - Telefono: %d", szPlayerName, playerVariables[playerid][pPhoneNumber]);
  39.                         SendToJob(3, COLOR_BROWN, textString);
  40.                         format(textString, sizeof(textString), "Luogo: %s%", location);
  41.                         SendToJob(3, COLOR_BROWN, textString);
  42.                         format(textString, sizeof(textString), "Descrizione: %s%", text);
  43.                         SendToJob(3, COLOR_BROWN, textString);
  44.  
  45.                         SendClientMessage(playerid, COLOR_AZZURRO, "Centralino: D'accordo, il primo meccanico disponibile la contatterà o la raggiungerà direttamente.");
  46.  
  47.                         SendClientMessage(playerid, COLOR_AZZURRO, "L'operatore ha riagganciato.");
  48.  
  49.                         if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE) {
  50.                             SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  51.                         }
  52.                         playerVariables[playerid][pPhoneCall] = -1;
  53.                     }
  54.                 }
  55.                 case 555: {
  56.                     if(strlen(text) > 1) {
  57.                         new location[MAX_ZONE_NAME];
  58.                         if(jobVariables[playerid][jJobDuty] == 1)
  59.                         GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
  60.                         SendToJob(5, COLOR_ORANGE,"|___________Nuova Esigenza___________|");
  61.                         format(textString, sizeof(textString), "Soggetto: %s - Telefono: %d", szPlayerName, playerVariables[playerid][pPhoneNumber]);
  62.                         SendToJob(5, COLOR_ORANGE, textString);
  63.                         format(textString, sizeof(textString), "Luogo: %s%", location);
  64.                         SendToJob(5, COLOR_ORANGE, textString);
  65.                         format(textString, sizeof(textString), "Descrizione: %s%", text);
  66.                         SendToJob(5, COLOR_ORANGE, textString);
  67.  
  68.                         SendClientMessage(playerid, COLOR_AZZURRO, "Centralino: D'accordo, un tassista la contatterà quanto prima.");
  69.  
  70.                         SendClientMessage(playerid, COLOR_AZZURRO, "L'operatore ha riagganciato.");
  71.  
  72.                         if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE) {
  73.                             SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  74.                         }
  75.                         playerVariables[playerid][pPhoneCall] = -1;
  76.                     }
  77.                 }
  78.                 case 911: {
  79.                     if(strlen(text) > 1) {
  80.                         new location[MAX_ZONE_NAME];
  81.  
  82.                         GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
  83.                         SendToGroup(1, COLOR_AZZURRO,"|___________Chiamata 911___________|");
  84.                         format(textString, sizeof(textString), "Soggetto: %s - Telefono: %d", szPlayerName, playerVariables[playerid][pPhoneNumber]);
  85.                         SendToGroup(1, COLOR_AZZURRO, textString);
  86.                         format(textString, sizeof(textString), "Luogo: %s%", location);
  87.                         SendToGroup(1, COLOR_AZZURRO, textString);
  88.                         format(textString, sizeof(textString), "Situazione: %s%", text);
  89.                         SendToGroup(1, COLOR_AZZURRO, textString);
  90.  
  91.                         SendClientMessage(playerid, COLOR_AZZURRO, "Centralino 911: D'accordo, stia calmo e rimanga al sicuro, sono state avvisate le pattuglie.");
  92.  
  93.                         SendClientMessage(playerid, COLOR_AZZURRO, "L'operatore ha riagganciato.");
  94.  
  95.                         if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE) {
  96.                             SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  97.                         }
  98.                         playerVariables[playerid][pPhoneCall] = -1;
  99.                     }
  100.                 }
  101.                 case 118: {
  102.                     if(strlen(text) > 1) {
  103.                         new location[MAX_ZONE_NAME];
  104.  
  105.                         GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
  106.                         SendToGroup(2, COLOR_AZZURRO,"|___________Chiamata 118___________|");
  107.                         format(textString, sizeof(textString), "Soggetto: %s - Telefono: %d", szPlayerName, playerVariables[playerid][pPhoneNumber]);
  108.                         SendToGroup(2, COLOR_AZZURRO, textString);
  109.                         format(textString, sizeof(textString), "Luogo: %s%", location);
  110.                         SendToGroup(2, COLOR_AZZURRO, textString);
  111.                         format(textString, sizeof(textString), "Situazione: %s%", text);
  112.                         SendToGroup(2, COLOR_AZZURRO, textString);
  113.  
  114.                         SendClientMessage(playerid, COLOR_AZZURRO, "Centralino 911: D'accordo, stia calmo e tenga duro, sono state avvisate le pattuglie.");
  115.  
  116.                         SendClientMessage(playerid, COLOR_AZZURRO, "L'operatore ha riagganciato.");
  117.  
  118.                         if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE) {
  119.                             SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  120.                         }
  121.                         playerVariables[playerid][pPhoneCall] = -1;
  122.                     }
  123.                 }
  124.                 case 115: {
  125.                     if(strlen(text) > 1) {
  126.                         new location[MAX_ZONE_NAME];
  127.  
  128.                         GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
  129.                         SendToGroup(5, COLOR_AZZURRO,"|___________Chiamata 115___________|");
  130.                         format(textString, sizeof(textString), "Soggetto: %s - Telefono: %d", szPlayerName, playerVariables[playerid][pPhoneNumber]);
  131.                         SendToGroup(5, COLOR_AZZURRO, textString);
  132.                         format(textString, sizeof(textString), "Luogo: %s%", location);
  133.                         SendToGroup(5, COLOR_AZZURRO, textString);
  134.                         format(textString, sizeof(textString), "Situazione: %s%", text);
  135.                         SendToGroup(5, COLOR_AZZURRO, textString);
  136.  
  137.                         SendClientMessage(playerid, COLOR_AZZURRO, "Centralino 911: D'accordo, stia calmo e si tenga al sicuro, manderemo qualcuno immediatamente.");
  138.  
  139.                         SendClientMessage(playerid, COLOR_AZZURRO, "L'operatore ha riagganciato.");
  140.  
  141.                         if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE) {
  142.                             SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  143.                         }
  144.                         playerVariables[playerid][pPhoneCall] = -1;
  145.                     }
  146.                     else SendClientMessage(playerid, COLOR_CELESTE, "(Cellulare) 911: Scusi, non ho ben capito. Può ripetere per favore?");
  147.                 }
  148.                 default: { // If they're calling a player, this code is executed.
  149.                     SendClientMessage(playerVariables[playerid][pPhoneCall], COLOR_GREY, textString);
  150.                     mysql_real_escape_string(textString, textString);
  151.                     format(queryString, sizeof(queryString), "INSERT INTO chatlogs (value, playerinternalid) VALUES('%s', '%d')", textString, playerVariables[playerid][pInternalID]);
  152.                     mysql_query(queryString);
  153.                 }
  154.             }
  155.         }
  156.  
  157.         else {
  158.             if(!strcmp(playerVariables[playerid][pAccent], "None", true))
  159.                 format(textString, sizeof(textString), "{FFFFFF}%s dice: %s", szPlayerName, text);
  160.             else
  161.                 format(textString, sizeof(textString), "(Accento %s) {FFFFFF}%s dice: %s", playerVariables[playerid][pAccent], szPlayerName, text);
  162.  
  163.             if(playerVariables[playerid][pAdminDuty] >= 1) format(textString, sizeof(textString), "(( %s dice: %s ))", szPlayerName, text);
  164.             nearByMessage(playerid, COLOR_ICE, textString);
  165.             mysql_real_escape_string(textString, textString);
  166.             format(queryString, sizeof(queryString), "INSERT INTO chatlogs (value, playerinternalid) VALUES('%s', '%d')", textString, playerVariables[playerid][pInternalID]);
  167.             mysql_query(queryString);
  168.             format(textString, sizeof(textString), "\"%s\"", text);
  169.         }
  170.  
  171.         playerVariables[playerid][pSpamCount]++;
  172.     }
  173.     return 0;
  174. }
Add Comment
Please, Sign In to add comment