Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Police equipment - By Kwarde.
- You may release this script (with the full credits to me, and maybe some to you for edits).
- you may NOT claim this as your own. You may remove the command /equipcredits. If you release this script,
- you MUST give my name + the link to the official topic: {NONE}
- Thanks in advance.
- Enjoy this script.
- */
- #include <a_samp>
- #include <zcmd>
- #undef MAX_PLAYERS
- #define MAX_SLOTS (15)
- #define MAX_PLAYERS MAX_SLOTS
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_RED 0xFF0000AA
- #define COLOR_GREEN 0x00FF00AA
- #define COLOR_GRAY 0xAFAFAFAA
- #define AMMO_BACKUPWEP (150)
- #define AMMO_SUBGUNWEP (900)
- #define AMMO_BIGWEP (3500)
- #define AMMO_HEAVYWEP (1000)
- #define AMMO_RPGHS (4)
- #define AMMO_THROW (10)
- #define DIALOG_MAIN (40)
- #define DIALOG_TYPE (41)
- #define DIALOG_WEAPONS (42)
- #define DIALOG_WEPMELEE (421)
- #define DIALOG_WEPBACKUP (422)
- #define DIALOG_WEPSUB (423)
- #define DIALOG_WEPBIG (424)
- #define DIALOG_WEPHEAVY (425)
- #define DIALOG_WEPTHROW (426)
- #define DIALOG_OTHER (43)
- #define DIALOG_TEMPLATE (44)
- #define DIALOG_OFFDUTY (45)
- #define ARMOUR_SLOTID (0)
- new bool:pArmourAttached[MAX_SLOTS],
- pOffDutySkin[MAX_SLOTS], pWepData[MAX_SLOTS][13][2],
- bool:pOnDuty[MAX_SLOTS]
- ;
- public OnPlayerConnect(playerid)
- {
- pArmourAttached[playerid] = false;
- pOffDutySkin[playerid] = 0;
- for(new i = 0; i < 13; i++){
- pWepData[playerid][i][0] = 0;
- pWepData[playerid][i][1] = 0;
- }
- pOnDuty[playerid] = false;
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- new Float:pArmour;
- GetPlayerArmour(playerid, pArmour);
- if(pArmourAttached[playerid] && pArmour <= 0){
- RemovePlayerAttachedObject(playerid, ARMOUR_SLOTID);
- pArmourAttached[playerid] = false;
- SendClientMessage(playerid, COLOR_RED, "You'll start to die! They shot your armour to the death");
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid != DIALOG_OFFDUTY && !pOnDuty[playerid] && IsScriptDialog(dialogid, DIALOG_OFFDUTY)){
- for(new i = 0; i < 13; i++)
- GetPlayerWeaponData(playerid, i, pWepData[playerid][i][0], pWepData[playerid][i][1]);
- ResetPlayerWeapons(playerid);
- pOffDutySkin[playerid] = GetPlayerSkin(playerid);
- pOnDuty[playerid] = true;
- SendClientMessage(playerid, COLOR_GREEN, "You are now on duty");
- }
- if(dialogid == DIALOG_MAIN)
- {
- if(!response) return 0;
- switch(listitem)
- {
- case 0: ShowDialog(playerid, DIALOG_TYPE);
- case 1: ShowDialog(playerid, DIALOG_WEAPONS);
- case 2: ShowDialog(playerid, DIALOG_OTHER);
- case 3: ShowDialog(playerid, DIALOG_TEMPLATE);
- case 4: ShowDialog(playerid, DIALOG_OFFDUTY);
- }
- }
- if(dialogid == DIALOG_TYPE)
- {
- if(!response) return ShowDialog(playerid, DIALOG_MAIN);
- switch(listitem)
- {
- case 0:
- {
- SetPlayerSkin(playerid, 71);
- SendClientMessage(playerid, COLOR_GREEN, "* You are now clothed as a guard");
- }
- case 1:
- {
- SetPlayerSkin(playerid, 280);
- SendClientMessage(playerid, COLOR_GREEN, "* You are now clothed as a normal officer");
- }
- case 2:
- {
- SetPlayerSkin(playerid, 284);
- SendClientMessage(playerid, COLOR_GREEN, "* You are now clothed as a motor officer ^^");
- }
- case 3:
- {
- SetPlayerSkin(playerid, 285);
- SendClientMessage(playerid, COLOR_GREEN, "* You are now clothed as a SWAT/TACTICAL agent");
- }
- }
- ShowDialog(playerid, DIALOG_MAIN);
- }
- if(dialogid == DIALOG_WEAPONS)
- {
- if(!response) return ShowDialog(playerid, DIALOG_MAIN);
- switch(listitem)
- {
- case 0: ShowDialog(playerid, DIALOG_WEPMELEE);
- case 1: ShowDialog(playerid, DIALOG_WEPBACKUP);
- case 2: ShowDialog(playerid, DIALOG_WEPSUB);
- case 3: ShowDialog(playerid, DIALOG_WEPBIG);
- case 4: ShowDialog(playerid, DIALOG_WEPHEAVY);
- case 5: ShowDialog(playerid, DIALOG_WEPTHROW);
- case 6:
- {
- RemovePlayerWeapon(playerid, GetPlayerWeapon(playerid));
- SendClientMessage(playerid, COLOR_GREEN, "* You have putted back your current weapon");
- ShowDialog(playerid, DIALOG_WEAPONS);
- }
- }
- }
- if(dialogid == DIALOG_WEPMELEE)
- {
- if(!response) return ShowDialog(playerid, DIALOG_WEAPONS);
- RemovePlayerWeapon(playerid, 3, 4);
- switch(listitem)
- {
- case 0:
- {
- GivePlayerWeapon(playerid, 3, 1);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the knite stick as melee weapon");
- }
- case 1:
- {
- GivePlayerWeapon(playerid, 4, 1);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the Tactical Knife as melee weapon");
- }
- }
- ShowDialog(playerid, DIALOG_WEAPONS);
- }
- if(dialogid == DIALOG_WEPBACKUP)
- {
- if(!response) return ShowDialog(playerid, DIALOG_WEAPONS);
- RemovePlayerWeapon(playerid, 22, 23, 24);
- switch(listitem)
- {
- case 0:
- {
- GivePlayerWeapon(playerid, 22, AMMO_BACKUPWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the 9mm as backup weapon");
- }
- case 1:
- {
- GivePlayerWeapon(playerid, 23, AMMO_BACKUPWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the silenced 9mm as backup weapon");
- }
- case 2:
- {
- GivePlayerWeapon(playerid, 24, AMMO_BACKUPWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the Desert Eagle as backup weapon");
- }
- }
- ShowDialog(playerid, DIALOG_WEAPONS);
- }
- if(dialogid == DIALOG_WEPSUB)
- {
- if(!response) return ShowDialog(playerid, DIALOG_WEAPONS);
- RemovePlayerWeapon(playerid, 28, 29, 32);
- switch(listitem)
- {
- case 0:
- {
- GivePlayerWeapon(playerid, 28, AMMO_SUBGUNWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the Micro-SMG as submachine gun");
- }
- case 1:
- {
- GivePlayerWeapon(playerid, 29, AMMO_SUBGUNWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the SMG as submachine gun");
- }
- case 2:
- {
- GivePlayerWeapon(playerid, 32, AMMO_SUBGUNWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the TEC-9 as submachine gun");
- }
- }
- ShowDialog(playerid, DIALOG_WEAPONS);
- }
- if(dialogid == DIALOG_WEPBIG)
- {
- if(!response) return ShowDialog(playerid, DIALOG_WEAPONS);
- RemovePlayerWeapon(playerid, 25, 26, 27, 30, 31, 33);
- switch(listitem)
- {
- case 0:
- {
- GivePlayerWeapon(playerid, 25, AMMO_BIGWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the Shotgun as big weapon");
- }
- case 1:
- {
- GivePlayerWeapon(playerid, 26, AMMO_BIGWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the Sawn-Off Shotgun as big weapon");
- }
- case 2:
- {
- GivePlayerWeapon(playerid, 27, AMMO_BIGWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the Combat Shotgun as big weapon");
- }
- case 3:
- {
- GivePlayerWeapon(playerid, 30, AMMO_BIGWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the AK-47 as big weapon");
- }
- case 4:
- {
- GivePlayerWeapon(playerid, 31, AMMO_BIGWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the M4 as big weapon");
- }
- case 5:
- {
- GivePlayerWeapon(playerid, 33, AMMO_BIGWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the Country Rifle as big weapon");
- }
- }
- ShowDialog(playerid, DIALOG_WEAPONS);
- }
- if(dialogid == DIALOG_WEPHEAVY)
- {
- if(!response) return ShowDialog(playerid, DIALOG_WEAPONS);
- RemovePlayerWeapon(playerid, 34, 35, 36, 37, 38);
- switch(listitem)
- {
- case 0:
- {
- GivePlayerWeapon(playerid, 34, AMMO_HEAVYWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the Sniper Rifle as heavy weapon");
- }
- case 1:
- {
- GivePlayerWeapon(playerid, 35, AMMO_RPGHS);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the RPG as heavy weapon");
- SendClientMessage(playerid, COLOR_RED, "!! WARNING !! You have only 4 bullets with it");
- }
- case 2:
- {
- GivePlayerWeapon(playerid, 36, AMMO_RPGHS);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the HeatSeeker as heavy weapon");
- SendClientMessage(playerid, COLOR_RED, "!! WARNING !! You have only 4 bullets with it");
- }
- case 3:
- {
- GivePlayerWeapon(playerid, 37, AMMO_HEAVYWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the flamethrower as heavy weapon");
- }
- case 4:
- {
- GivePlayerWeapon(playerid, 38, AMMO_HEAVYWEP);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the minigun as heavy weapon");
- }
- }
- ShowDialog(playerid, DIALOG_WEAPONS);
- }
- if(dialogid == DIALOG_WEPTHROW)
- {
- if(!response) return ShowDialog(playerid, DIALOG_WEAPONS);
- RemovePlayerWeapon(playerid, 16, 17, 18, 39);
- switch(listitem)
- {
- case 0:
- {
- GivePlayerWeapon(playerid, 16, AMMO_THROW);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the grenades as throw weapons");
- }
- case 1:
- {
- GivePlayerWeapon(playerid, 17, AMMO_THROW);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the C2 Gas as throw weapons");
- }
- case 2:
- {
- GivePlayerWeapon(playerid, 18, AMMO_THROW);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the Molotov Cocktails as throw weapons");
- }
- case 3:
- {
- GivePlayerWeapon(playerid, 39, AMMO_THROW);
- SendClientMessage(playerid, COLOR_GREEN, "* You have selected the Satchel Charges as throw weapons");
- }
- }
- ShowDialog(playerid, DIALOG_WEAPONS);
- }
- if(dialogid == DIALOG_OTHER)
- {
- if(!response) return ShowDialog(playerid, DIALOG_MAIN);
- switch(listitem)
- {
- case 0:
- {
- if(!pArmourAttached[playerid]){
- SetPlayerArmour(playerid, 100);
- SetPlayerAttachedObject(playerid, ARMOUR_SLOTID, 19142, 1, 0.102796, 0.067300, -0.003721, 0.000000, 357.653930, 0.000000, 1.000000, 1.000000, 1.000000);
- SendClientMessage(playerid, COLOR_GREEN, "* You have putted on a armour vest");
- pArmourAttached[playerid] = true;
- }
- else{
- pArmourAttached[playerid] = false;
- SetPlayerArmour(playerid, 0);
- RemovePlayerAttachedObject(playerid, ARMOUR_SLOTID);
- SendClientMessage(playerid, COLOR_GREEN, "* You'd put back the armour vest");
- }
- ShowDialog(playerid, DIALOG_OTHER);
- }
- case 1:
- {
- SetPlayerHealth(playerid, 100);
- SendClientMessage(playerid, COLOR_GREEN, "You'd just take some health pills. You are now healed");
- ShowDialog(playerid, DIALOG_OTHER);
- }
- }
- ShowDialog(playerid, DIALOG_MAIN);
- }
- if(dialogid == DIALOG_TEMPLATE)
- {
- if(!response) ShowDialog(playerid, DIALOG_MAIN);
- ResetPlayerWeapons(playerid);
- switch(listitem)
- {
- case 0:
- {
- SetPlayerSkin(playerid, 71);
- GivePlayerWeapon(playerid, 4, 1);
- GivePlayerWeapon(playerid, 24, 35);
- GivePlayerWeapon(playerid, 30, 120);
- SendClientMessage(playerid, COLOR_GREEN, "* You are now a guard");
- }
- case 1:
- {
- SetPlayerSkin(playerid, 280);
- GivePlayerWeapon(playerid, 3, 1);
- GivePlayerWeapon(playerid, 24, 35);
- SendClientMessage(playerid, COLOR_GREEN, "* You are now a patrol officer");
- }
- case 2:
- {
- SetPlayerSkin(playerid, 285);
- GivePlayerWeapon(playerid, 4, 1);
- GivePlayerWeapon(playerid, 17, 4);
- GivePlayerWeapon(playerid, 22, 120);
- GivePlayerWeapon(playerid, 29, 180);
- GivePlayerWeapon(playerid, 31, 5185);
- SendClientMessage(playerid, COLOR_GREEN, "* You are now a SWAT / Tactical officer");
- }
- }
- ShowDialog(playerid, DIALOG_MAIN);
- }
- if(dialogid == DIALOG_OFFDUTY)
- {
- if(!response) return ShowDialog(playerid, DIALOG_MAIN);
- if(pOnDuty[playerid]){
- ResetPlayerWeapons(playerid);
- SetPlayerSkin(playerid, pOffDutySkin[playerid]);
- pOffDutySkin[playerid] = 0;
- for(new i = 0; i < 13; i++){
- GivePlayerWeapon(playerid, pWepData[playerid][i][0], pWepData[playerid][i][1]);
- pWepData[playerid][i][0] = 0;
- pWepData[playerid][i][1] = 0;
- }
- RemovePlayerAttachedObject(playerid, ARMOUR_SLOTID);
- pArmourAttached[playerid] = false;
- SetPlayerArmour(playerid, 0);
- pOnDuty[playerid] = false;
- SendClientMessage(playerid, COLOR_GREEN, "* You are now off duty!");
- }
- else return SendClientMessage(playerid, COLOR_GRAY, "* You are not on duty!");
- }
- return 0;
- }
- stock ShowDialog(playerid, dialog)
- {
- switch(dialog)
- {
- case DIALOG_MAIN: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST, "Choose", "Skin Type\nWeapons\nOther\nSelect template\nGo off duty", "Select", "Cancel");
- case DIALOG_TYPE: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST, "Choose skin type", "Guard\nOfficer\nMotor Officer\nSWAT/Tactical", "Select", "Back");
- case DIALOG_WEAPONS: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST, "Choose weapon type", "Melee\nBackup weapon\nSub machine gun\nBig weapon\nHeavy weapon\nThrow weapons\nPut back current weapon", "Select", "Back");
- case DIALOG_WEPMELEE: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST, "Melee weapons", "Nite stick\nTactical Knife", "Select", "Back");
- case DIALOG_WEPBACKUP: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST, "Backup weapons", "9mm\nSilenced 9mm\nDesert Eagle", "Select", "Back");
- case DIALOG_WEPSUB: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST, "Sub machine guns", "Micro SMG\nSMG\nTEC-9", "Select", "Back");
- case DIALOG_WEPBIG: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST, "Big weapons", "Shotgun\nSawn-off Shotgun\nCombat shotgun\nAK-47\nM4\nCountry Rifle", "Select", "Back");
- case DIALOG_WEPHEAVY: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST, "Heavy weapon", "Sniper\nRPG\nHeatseeker\nFlamethrower\nMinigun", "Select", "Back");
- case DIALOG_WEPTHROW: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST, "Throw weapon", "Grenade\nC2 Gas\nMolotov\nSatchel charge", "Select", "Back");
- case DIALOG_OTHER: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST, "Other", "Take/Put armour\nEat health pills", "Select", "Back");
- case DIALOG_TEMPLATE: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST, "Select Template", "Guard\nPatrol officer\nSWAT / Tactical", "Select", "Back");
- case DIALOG_OFFDUTY: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_MSGBOX, "Confirm", "Are you sure you wanna go off duty?\nYou'll get your old skin and weapons back", "Yes", "No");
- default: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST, "Error!", "An error has occured.\nIt seems like, that there is used a wrong dialog ID.\nContact the scripter or owner of this server, and tell him to fix it.\nAlso say, when this dialog came up", "Okay", "");
- }
- return 1;
- }
- stock RemovePlayerWeapon(playerid, {_}:...)
- {
- new pWepInfo[13][2], pCurWep, WepID,
- ammount = numargs()
- ;
- pCurWep = GetPlayerWeapon(playerid);
- for(new i = 0; i < 13; i++)
- GetPlayerWeaponData(playerid, i, pWepInfo[i][0], pWepInfo[i][1]);
- ResetPlayerWeapons(playerid);
- for(new i = 1; i < ammount; i++){
- WepID = getarg(i);
- for(new w = 0; w < 13; w++)
- if(pWepInfo[w][0] == WepID)
- pWepInfo[w][0] = 0;
- }
- for(new i = 0; i < 13; i++)
- GivePlayerWeapon(playerid, pWepInfo[i][0], pWepInfo[i][1]);
- SetPlayerArmedWeapon(playerid, pCurWep);
- }
- stock IsScriptDialog(dialogid, {_}:...)
- {
- new a = dialogid, count = numargs(), curdialogid;
- if(a == DIALOG_MAIN || a == DIALOG_TYPE || a == DIALOG_WEAPONS || a == DIALOG_WEPMELEE || a == DIALOG_WEPBACKUP || a == DIALOG_WEPSUB || a == DIALOG_WEPBIG || a == DIALOG_WEPHEAVY || a == DIALOG_WEPTHROW || a == DIALOG_OTHER || a == DIALOG_TEMPLATE || a == DIALOG_OFFDUTY){
- for(new i = 1; i < count; i++){
- curdialogid = getarg(i);
- if(a != curdialogid)
- return true;
- }
- }
- return false;
- }
- CMD:lspdequip(playerid, params[])
- {
- if(!IsPlayerInRangeOfPoint(playerid, 0.5, 254.105804, 73.696701, 1003.640625) && GetPlayerInterior(playerid) != 6) return SendClientMessage(playerid, COLOR_RED, "You are not at the equipment place!");
- ShowDialog(playerid, DIALOG_MAIN);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement