Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define COLOR_VIOLETA 0xC2A2DAAA
- // -----------------------------------------------------------------------------
- new BigEar[MAX_PLAYERS];
- new Seguro[MAX_PLAYERS];
- // -----------------------------------------------------------------------------
- new GunNames[48][] = { // Nombre de armas.
- "nada",
- "puño americano",
- "palo de golf",
- "porra policial",
- "navaja",
- "bate de baseball",
- "pala",
- "palo de pool",
- "katana",
- "motosierra",
- "consolador violeta",
- "consolador corto blanco",
- "consolador largo blanco",
- "consolador",
- "ramo de flores",
- "bastón",
- "granada explosiva",
- "granada de humo",
- "cóctel molotov",
- "misil de hunter o hydra",
- "fuego de hydra",
- "propulsor",
- "pistola 9mm",
- "pistola 9mm silenciada",
- "pistola desert eagle",
- "escopeta normal",
- "escopeta recortada",
- "escopeta de combate",
- "micro subfusil uzi",
- "subfusil mp5",
- "rifle automático ak47",
- "rifle automático m4",
- "micro subfusil tec9",
- "rifle de caza",
- "rifle de francotirador",
- "lanzacohetes",
- "lanzamisiles busca calor",
- "lanzallamas",
- "minigun",
- "carga explosiva",
- "detonador de carga explosiva",
- "aerosol de gas pimienta",
- "extintor de fuego",
- "cámara fotográfica",
- "gafas de visión nocturna",
- "gafas de visión infrarroja",
- "paracaídas",
- "pistola falsa"
- };
- // -----------------------------------------------------------------------------
- public OnPlayerConnect(playerid)
- {
- Seguro[playerid] = 0;
- return 0;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys & KEY_FIRE)
- {
- if(Seguro[playerid] == 1)
- {
- new Float:PosX, Float:PosY, Float:PosZ;
- GetPlayerPos(playerid, PosX, PosY, PosZ);
- SetPlayerPos(playerid, PosX, PosY, PosZ+1);
- SendClientMessage(playerid, 0x33AA3300, "Tu arma tiene el mecanismo de seguro activo, el disparo no se efectuará.");
- return 1;
- }
- return 1;
- }
- return 0;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- if(strcmp(cmd, "/seguro", true) == 0 || strcmp(cmd, "/seg", true) == 0)
- {
- new gunname[25];
- new string[100];
- GetWeaponNameEx(gunID, gunname, sizeof(gunname));
- format(string, sizeof(string), "* %s le coloca el seguro a su %s.", PlayerName(playerid), gunname);
- ProxDetector(30.0, playerid, string, COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA);
- Seguro[playerid] = 1;
- return 1;
- }
- }
- if(strcmp(cmd, "/qseguro", true) == 0 || strcmp(cmd, "/qseg", true) == 0)
- {
- GetWeaponNameEx(gunID, gunname, sizeof(gunname));
- format(string, sizeof(string), "* %s le quita el seguro a su %s.", PlayerName(playerid), gunname);
- ProxDetector(30.0, playerid, string, COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA);
- Seguro[playerid] = 0;
- return 1;
- }
- }
- return 0;
- }
- // -----------------------------------------------------------------------------
- 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);
- //radi = 2.0; //Trigger Radius
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
- {
- if(!BigEar[i])
- {
- GetPlayerPos(i, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- 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);
- }
- }
- else
- {
- SendClientMessage(i, col1, string);
- }
- }
- }
- }//not connected
- return 1;
- }
- stock GetWeaponNameEx(id, name[], len) return format(name,len, "%s", GunNames[id]);
- stock PlayerName(playerid)
- {
- new Nombre[24];
- GetPlayerName(playerid,Nombre,24);
- new N[24];
- strmid(N,Nombre,0,strlen(Nombre),24);
- for(new i = 0; i < MAX_PLAYER_NAME; i++)
- {
- if (N[i] == '_') N[i] = ' ';
- }
- return N;
- }
Advertisement
Add Comment
Please, Sign In to add comment