| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- /*
- /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
- | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
- | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
- | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
- | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
- | $$\ $$$| $$ \ $$ | $$ \ $$| $$
- | $$ \ $$| $$$$$$/ | $$ | $$| $$
- |__/ \__/ \______/ |__/ |__/|__/
- Interaction System Revision
- Remastered by Winterfield
- Next Generation Gaming, LLC
- (created by Next Generation Gaming Development Team)
- * Copyright (c) 2016, Next Generation Gaming, LLC
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are not permitted in any case.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- #include <YSI\y_hooks>
- CMD:interact(playerid, params[])
- {
- new id;
- if(sscanf(params, "u", id)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /interact [playerid]");
- if(IsPlayerConnected(id))
- {
- if(!ProxDetectorS(8.0, playerid, GetPVarInt(playerid, "pInteract"))) return SendClientMessageEx(playerid, COLOR_GREY, "That player is not near you!.");
- if(id == playerid) return SendClientMessageEx(playerid, COLOR_GREY, "You can't interact with yourself.");
- SetPVarInt(playerid, "pInteract", id);
- ShowInteractionMenu(playerid, 0);
- }
- else SendClientMessageEx(playerid, COLOR_GRAD1, "That player is not connected!");
- return 1;
- }
- ShowInteractionMenu(playerid, menu)
- {
- szMiscArray[0] = 0;
- if(!ProxDetectorS(8.0, playerid, GetPVarInt(playerid, "pInteract"))) return SendClientMessageEx(playerid, COLOR_GREY, "The player you have tried to interact with is not near you."); // An extra check never hurts! - Winterfield
- switch(menu)
- {
- case 0: // Main Menu
- {
- DeletePVar(playerid, "pGiving");
- DeletePVar(playerid, "pSelling");
- format(szMiscArray, sizeof(szMiscArray), "Pay\nGive Item\nSell Item\nFrisk\nShow License");
- if(IsACop(playerid)) format(szMiscArray, sizeof(szMiscArray), "%s\nCop", szMiscArray);
- if(IsAMedic(playerid)) format(szMiscArray, sizeof(szMiscArray), "%s\nMedic", szMiscArray);
- if(IsADocGuard(playerid)) format(szMiscArray, sizeof(szMiscArray), "%s\nGuard", szMiscArray);
- ShowPlayerDialogEx(playerid, DIALOG_INTERACT, DIALOG_STYLE_LIST, "Interaction Menu", szMiscArray, "Select", "Cancel");
- }
- case 1: // Give / Sell
- {
- format(szMiscArray, sizeof(szMiscArray), "Item\tCurrent Amount\n\
- Drugs\n\
- Weapons\n\
- Materials\t%d\n\
- Syringes\t%d\n\
- Sprunk\t%d\n\
- Fireworks\t%d",
- PlayerInfo[playerid][pMats],
- PlayerInfo[playerid][pSyringes],
- PlayerInfo[playerid][pSprunk],
- PlayerInfo[playerid][pFirework]);
- if(GetPVarInt(playerid, "pGiving")) ShowPlayerDialogEx(playerid, DIALOG_INTERACT_GIVEITEM, DIALOG_STYLE_TABLIST_HEADERS, "Interaction Menu - Give", szMiscArray, "Select", "Cancel");
- else if(GetPVarInt(playerid, "pSelling")) ShowPlayerDialogEx(playerid, DIALOG_INTERACT_SELLITEM, DIALOG_STYLE_TABLIST_HEADERS, "Interaction Menu - Sell", szMiscArray, "Select", "Cancel");
- }
- }
- return 1;
- }
- hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
- if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
- switch(dialogid)
- {
- case DIALOG_INTERACT:
- {
- if(!response) return 1;
- if(!IsPlayerConnected(GetPVarInt(playerid, "pInteract"))) return SendClientMessage(playerid, COLOR_GRAD1, "The player you were interacting with has disconnected!");
- if(!ProxDetectorS(8.0, playerid, GetPVarInt(playerid, "pInteract"))) return SendClientMessageEx(playerid, COLOR_GREY, "The player you have tried to interact with is not near you.");
- szMiscArray[0] = 0;
- switch(listitem)
- {
- case 0: ShowPlayerDialogEx(playerid, DIALOG_INTERACT_PAY, DIALOG_STYLE_INPUT, "Interaction Menu - Pay", "How much would you like to transfer?", "Select", "Cancel"); // Pay
- case 1: // Give
- {
- SetPVarInt(playerid, "pGiving", 1);
- ShowInteractionMenu(playerid, 1);
- }
- case 2: // Sell
- {
- SetPVarInt(playerid, "pSelling", 1);
- ShowInteractionMenu(playerid, 1);
- }
- case 3: // Frisk
- {
- new id[3];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- cmd_frisk(playerid, id);
- }
- case 4: // Show License
- {
- new id[3];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- cmd_showlicenses(playerid, id);
- }
- }
- if(listitem == 5 && IsACop(playerid))
- {
- format(szMiscArray, sizeof(szMiscArray), "(Un)cuff\nJailcuff\nDrag\nDetain\nTicket\nConfiscate", szMiscArray);
- ShowPlayerDialogEx(playerid, DIALOG_INTERACT_COP, DIALOG_STYLE_LIST, "Interaction Menu - Cop", szMiscArray, "Select", "Cancel");
- }
- if(listitem == 5 && IsAMedic(playerid))
- {
- format(szMiscArray, sizeof(szMiscArray), "Move Patient\nLoad Patient\nTriage\nHeal", szMiscArray);
- ShowPlayerDialogEx(playerid, DIALOG_INTERACT_MEDIC, DIALOG_STYLE_LIST, "Interaction Menu - Medic", szMiscArray, "Select", "Cancel");
- }
- if(listitem == 5 && IsADocGuard(playerid))
- {
- format(szMiscArray, sizeof(szMiscArray), "(Un)cuff\nJailcuff\nDrag\nDetain\nConfiscate\nExtend Sentence\nReduce Sentence\nIsolate", szMiscArray);
- ShowPlayerDialogEx(playerid, DIALOG_INTERACT_GUARD, DIALOG_STYLE_LIST, "Interaction Menu - DoC", szMiscArray, "Select", "Cancel");
- }
- }
- case DIALOG_INTERACT_PAY:
- {
- if(!response) return 1;
- if(!IsPlayerConnected(GetPVarInt(playerid, "pInteract"))) return SendClientMessage(playerid, COLOR_GRAD1, "The player you were interacting with has disconnected!");
- if(!ProxDetectorS(8.0, playerid, GetPVarInt(playerid, "pInteract"))) return SendClientMessageEx(playerid, COLOR_GREY, "The player you have tried to interact with is not near you.");
- new id[3], realstring[50];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- format(realstring, 50, "%s %s", id, inputtext);
- cmd_pay(playerid, realstring);
- }
- case DIALOG_INTERACT_GIVEITEM:
- {
- if(!response) return 1;
- if(!IsPlayerConnected(GetPVarInt(playerid, "pInteract"))) return SendClientMessage(playerid, COLOR_GRAD1, "The player you were interacting with has disconnected!");
- if(!ProxDetectorS(8.0, playerid, GetPVarInt(playerid, "pInteract"))) return SendClientMessageEx(playerid, COLOR_GREY, "The player you have tried to interact with is not near you.");
- switch(listitem)
- {
- case 0:
- {
- szMiscArray[0] = 0;
- for(new i; i < sizeof(Drugs); i++) format(szMiscArray, sizeof(szMiscArray), "%s\n{A9C4E4}%s {FFFFFF}(%dg){A9C4E4}", szMiscArray, GetDrugName(i), PlayerInfo[playerid][pDrugs][i]);
- ShowPlayerDialogEx(playerid, DIALOG_INTERACT_GI_DRUGS, DIALOG_STYLE_LIST, "Interaction Menu - Give Item (Drugs)", szMiscArray, "Select", "Cancel");
- }
- case 1:
- {
- szMiscArray[0] = 0;
- new weapon[16], weapons[13][2];
- for (new i = 0; i <= 12; i++)
- {
- GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
- GetWeaponName(weapons[i][0], weapon, sizeof(weapon));
- if(PlayerInfo[playerid][pGuns][i] == weapons[i][0]) format(szMiscArray, sizeof(szMiscArray), "%s\n{A9C4E4}%s {FFFFFF}(%d){A9C4E4}", szMiscArray, weapon, weapons[i][0]);
- }
- ShowPlayerDialogEx(playerid, DIALOG_INTERACT_GI_WEAPON, DIALOG_STYLE_LIST, "Interaction Menu - Give Item (Weapons)", szMiscArray, "Select", "Cancel");
- }
- }
- }
- case DIALOG_INTERACT_COP:
- {
- if(!response) return 1;
- if(!IsPlayerConnected(GetPVarInt(playerid, "pInteract"))) return SendClientMessage(playerid, COLOR_GRAD1, "The player you were interacting with has disconnected!");
- if(!ProxDetectorS(8.0, playerid, GetPVarInt(playerid, "pInteract"))) return SendClientMessageEx(playerid, COLOR_GREY, "The player you have tried to interact with is not near you.");
- switch(listitem)
- {
- case 0: // (Un)cuff
- {
- new id[3];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- if(PlayerCuffed[GetPVarInt(playerid, "pInteract")] > 1) cmd_uncuff(playerid, id);
- else cmd_cuff(playerid, id);
- }
- case 1: // Jailcuff
- {
- new id[3];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- cmd_jailcuff(playerid, id);
- }
- case 2: // Drag
- {
- new id[3];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- cmd_drag(playerid, id);
- }
- case 3: ShowPlayerDialogEx(playerid, DIALOG_INTERACT_DETAIN, DIALOG_STYLE_INPUT, "Interaction Menu - Detain", "Please choose the number of seat you'd like to detain the suspect in. (1-3)", "Select", "Cancel");
- case 4: ShowPlayerDialogEx(playerid, DIALOG_INTERACT_TICKET, DIALOG_STYLE_INPUT, "Interaction Menu - Ticket", "Please choose how much you would like to ticket the suspect.", "Select", "Cancel");
- case 5: ShowPlayerDialogEx(playerid, DIALOG_INTERACT_CONFISCATE, DIALOG_STYLE_LIST, "Interaction Menu - Confiscate", "Weapons\nPot\nCrack\nMeth\nEcstasy\nMaterials\nRadio\nHeroin\nRawopium\nSyringes\nPotSeeds\nOpiumSeeds\nDrugCrates", "Select", "Cancel");
- }
- }
- case DIALOG_INTERACT_MEDIC:
- {
- if(!response) return 1;
- if(!IsPlayerConnected(GetPVarInt(playerid, "pInteract"))) return SendClientMessage(playerid, COLOR_GRAD1, "The player you were interacting with has disconnected!");
- if(!ProxDetectorS(8.0, playerid, GetPVarInt(playerid, "pInteract"))) return SendClientMessageEx(playerid, COLOR_GREY, "The player you have tried to interact with is not near you.");
- switch(listitem)
- {
- case 0: // Move Patient
- {
- new id[3];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- cmd_movept(playerid, id);
- }
- case 1: // Load Patient
- {
- new id[3], seat = -1, realstring[50];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- new carid = gLastCar[playerid];
- if(IsAnAmbulance(carid))
- {
- for(new i = 2; i < 3; i++)
- if(!IsVehicleOccupied(carid, i)) { seat = i; break; }
- }
- else return 1;
- format(realstring, 50, "%s %d", id, seat);
- if(seat != -1) cmd_loadpt(playerid, realstring);
- }
- case 2: // Jailcuff
- {
- new id[3];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- cmd_jailcuff(playerid, id);
- }
- case 3: // Triage
- {
- new id[3];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- cmd_triage(playerid, id);
- }
- case 4: ShowPlayerDialogEx(playerid, DIALOG_INTERACT_HEAL, DIALOG_STYLE_INPUT, "Interaction Menu - Heal", "How much would you like to heal the patient for? ($200 - $1,000)", "Select", "Cancel");
- }
- }
- case DIALOG_INTERACT_GUARD:
- {
- if(!response) return 1;
- if(!IsPlayerConnected(GetPVarInt(playerid, "pInteract"))) return SendClientMessage(playerid, COLOR_GRAD1, "The player you were interacting with has disconnected!");
- if(!ProxDetectorS(8.0, playerid, GetPVarInt(playerid, "pInteract"))) return SendClientMessageEx(playerid, COLOR_GREY, "The player you have tried to interact with is not near you.");
- switch(listitem)
- {
- case 0: // (Un)cuff
- {
- new id[3];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- if(PlayerCuffed[GetPVarInt(playerid, "pInteract")] > 1) cmd_uncuff(playerid, id);
- else cmd_cuff(playerid, id);
- }
- case 1: // Jailcuff
- {
- new id[3];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- cmd_jailcuff(playerid, id);
- }
- case 2: // Drag
- {
- new id[3];
- valstr(id, GetPVarInt(playerid, "pInteract"));
- cmd_drag(playerid, id);
- }
- case 3: ShowPlayerDialogEx(playerid, DIALOG_INTERACT_DETAIN, DIALOG_STYLE_INPUT, "Interaction Menu - Detain", "Please choose the number of seat you'd like to detain the suspect in. (1-3)", "Select", "Cancel");
- case 4: ShowPlayerDialogEx(playerid, DIALOG_INTERACT_CONFISCATE, DIALOG_STYLE_LIST, "Interaction Menu - Confiscate", "Weapons\nPot\nCrack\nMeth\nEcstasy\nMaterials\nRadio\nHeroin\nRawopium\nSyringes\nPotSeeds\nOpiumSeeds\nDrugCrates", "Select", "Cancel");
- case 5: ShowPlayerDialogEx(playerid, DIALOG_INTERACT_EXTEND, DIALOG_STYLE_INPUT, "Interaction Menu - Extend Sentence", "How much would you like to extend the prisoners sentence? (1 - 30)", "Select", "Cancel");
- case 6: ShowPlayerDialogEx(playerid, DIALOG_INTERACT_REDUCE, DIALOG_STYLE_INPUT, "Interaction Menu - Reduce Sentence", "How much would you like to reduce the prisoners sentence? (1 - 30)", "Select", "Cancel");
- case 7: ShowPlayerDialogEx(playerid, DIALOG_INTERACT_ISOLATION, DIALOG_STYLE_LIST, "Interaction Menu - Isolation", "IC Isolation\nOOC Isolation", "Select", "Cancel");
- }
- }
- }
- return 0;
- }
|