Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <ZCMD>
- #include <sscanf2>
- #include <sscanf>
- #include <streamer>
- #define COLOR_LIGHTRED 0xFF6347AA
- #define COLOR_ORANGE 0xFF8000FF
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_GRAD1 0xB4B5B7FF
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_PURPLE 0xC2A2DAAA
- #define CRATEGUN 1
- new dynamiccrate;
- new Text3D:dynamiccrate3DText;
- forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
- public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:posx, Float:posy, Float:posz;
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- GetPlayerPos(i, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
- {
- if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
- {
- SendClientMessage(i, col1, string);
- }
- else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
- {
- SendClientMessage(i, col2, string);
- }
- else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
- {
- SendClientMessage(i, col3, string);
- }
- else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
- {
- SendClientMessage(i, col4, string);
- }
- else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- SendClientMessage(i, col5, string);
- }
- }
- }
- }
- }
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == CRATEGUN)
- {
- if(response) // If they clicked 'Yes' or pressed enter
- {
- if(listitem == 0) // Shotgun
- {
- GivePlayerWeapon(playerid, 25, 99999);
- SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Shotgun!");
- }
- if(listitem == 1) // MP5
- {
- GivePlayerWeapon(playerid, 29, 99999);
- SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a MP5!");
- }
- if(listitem == 2) // Rifle
- {
- GivePlayerWeapon(playerid, 33, 99999);
- SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Rifle!");
- }
- if(listitem == 3) // Desert Eagle
- {
- GivePlayerWeapon(playerid, 24, 99999);
- SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Desert Eagle!");
- }
- if(listitem == 4) // AK-47
- {
- GivePlayerWeapon(playerid, 30, 99999);
- SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken an AK-47!");
- }
- if(listitem == 5) // M4
- {
- GivePlayerWeapon(playerid, 31, 99999);
- SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken an M4!");
- }
- if(listitem == 6) // SPAS-12
- {
- GivePlayerWeapon(playerid, 27, 99999);
- SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a SPAS-12!");
- }
- if(listitem == 7) // Sniper
- {
- GivePlayerWeapon(playerid, 34, 99999);
- SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Sniper!");
- }
- if(listitem == 8) // Kevlar vest
- {
- SetPlayerArmour(playerid, 100.0);
- SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Kevlar vest!");
- }
- if(listitem == 9)
- {
- SetPlayerHealth(playerid, 100);
- }
- }
- return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
- }
- return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
- }
- CMD:opencrate(playerid, params[])
- {
- if(dynamiccrate != 0)
- {
- new Float:Position[3];
- GetDynamicObjectPos(dynamiccrate, Position[0], Position[1], Position[2]);
- if(IsPlayerInRangeOfPoint(playerid, 5.0, Position[0], Position[1], Position[2]))
- {
- ShowPlayerDialog(playerid, CRATEGUN, DIALOG_STYLE_LIST, "Crate Equipment","Shotgun\nMP5\nRifle\nDesert Eagle\nAK-47\nM4\nSPAS-12\nSniper\nKevlar vest\nFirst Aid Kit", "Take", "Cancel");
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "* You're not near the crate!");
- }
- }
- return 1;
- }
- CMD:spawncrate(playerid, params[])
- {
- if (IsPlayerAdmin(playerid))
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- SendClientMessage(playerid, COLOR_GREY, "You must be on foot to use this command.");
- return 1;
- }
- new Float:Position[4];
- if(dynamiccrate == 0)
- {
- GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
- GetPlayerFacingAngle(playerid, Position[3]);
- dynamiccrate = CreateDynamicObject(964, Position[0], Position[1], Position[2]-1.28, 0.0, 0.0, Position[3], -1, -1, -1, 200.0);
- dynamiccrate3DText = CreateDynamic3DTextLabel("/opencrate\nTo open the crate.",COLOR_ORANGE,Position[0], Position[1], Position[2]+0.0,8.0);
- SetPlayerPos(playerid, Position[0], Position[1], Position[2]+3);
- SendClientMessageToAll(COLOR_LIGHTRED, "Crate: The crate has been placed!");
- }
- else
- {
- DestroyDynamicObject(dynamiccrate);
- dynamiccrate = 0;
- DestroyDynamic3DTextLabel( Text3D:dynamiccrate3DText );
- SendClientMessageToAll(COLOR_LIGHTRED, "Crate: The crate has been destroyed!");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement