Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=================== | INCLUDES | ====================
- #include <a_samp>
- #include <zcmd>
- #include <streamer>
- //==================== | MACROS | =====================
- #define CALL::%0(%1) forward %0(%1); public %0(%1)
- //==================== | DEFINES | ====================
- #define MAX_SMOKE 100
- #define COR_ROXOCLARO 0xC2A2DAFF
- #define COR_VERMELHO 0xCD5C5CFF
- //=================== | VARIÁVEIS | ===================
- new Armas[MAX_PLAYERS][13][2];
- new bool:Mask[MAX_PLAYERS];
- //GRANADA SMOKE
- enum SMKInfo
- {
- ObjSmoke,
- EfeitoSmoke,
- Float:SPosX,
- Float:SPosY,
- Float:SPosZ,
- SWorld,
- SInterior
- }
- new SmokeInfo[MAX_SMOKE][SMKInfo];
- new bool:GranadaSmoke[MAX_PLAYERS];
- new bool:RespirandoSmoke[MAX_PLAYERS];
- new Float:DisX[MAX_PLAYERS], Float:DisY[MAX_PLAYERS], Float:DisZ[MAX_PLAYERS];
- //BOMBA C4
- new bool:GranadaC4[MAX_PLAYERS];
- new bool:AcionadorC4[MAX_PLAYERS];
- new ObjC4[MAX_PLAYERS];
- new Float:PosC4[3][MAX_PLAYERS];
- //=============== | SA-MP CALLBACKS | =================
- public OnFilterScriptInit()
- {
- print(" Explosivos13 Carregado!");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- RespirandoSmoke[playerid] = false;
- Mask[playerid] = false;
- SetTimerEx("CheckProx", 1000, true, "i", playerid);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- RespirandoSmoke[playerid] = false;
- GranadaSmoke[playerid] = false;
- GranadaC4[playerid] = false;
- AcionadorC4[playerid] = false;
- Mask[playerid] = false;
- return 1;
- }
- public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
- {
- if(newkeys == KEY_FIRE && GranadaSmoke[playerid] == true)
- {
- GranadaSmoke[playerid] = false;
- ApplyAnimation(playerid, "GANGS", "DRUGS_BUY", 4.1, 0, 1, 1, 1, 1, 1);
- SetTimerEx("PlantarSmoke1", 900, 0, "i", playerid);
- }
- if(newkeys == KEY_FIRE && GranadaC4[playerid] == true)
- {
- GranadaC4[playerid] = false;
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.1, 0, 1, 1, 1, 1, 1);
- SetTimerEx("PlantarC4", 1000, 0, "i", playerid);
- }
- if(newkeys == KEY_FIRE && AcionadorC4[playerid] == true)
- {
- ApplyAnimation(playerid, "BD_FIRE", "BD_Fire1", 4.1, 0, 1, 1, 1, 1, 1);
- if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) RemovePlayerAttachedObject(playerid, 1);
- AcionadorC4[playerid] = false;
- CreateExplosion(PosC4[0][playerid], PosC4[1][playerid], PosC4[2][playerid], 7, 3.0);
- DestroyDynamicObject(ObjC4[playerid]);
- SetTimerEx("SetarArmas", 300, false, "i", playerid);
- }
- return 1;
- }
- //==================== | MINHAS CALLBACKS | ====================
- CALL::GuardarArmas(playerid)
- {
- new weapons[13][2];
- for (new i = 0; i <= 12; i++)
- {
- GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
- Armas[playerid][i][0] = weapons[i][0];
- Armas[playerid][i][1] = weapons[i][1];
- }
- ResetPlayerWeapons(playerid);
- return 1;
- }
- CALL::SetarArmas(playerid)
- {
- for (new i = 0; i <= 12; i++)
- {
- GivePlayerWeapon(playerid, Armas[playerid][i][0], Armas[playerid][i][1]);
- }
- }
- CALL::CheckProx(playerid)
- {
- if(Mask[playerid] == true) return 1;
- if(RespirandoSmoke[playerid] == false || !IsPlayerInAnyVehicle(playerid))
- {
- for(new i = 0; i < sizeof(SmokeInfo); i++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 6.0, SmokeInfo[i][SPosX], SmokeInfo[i][SPosY], SmokeInfo[i][SPosZ]))
- {
- if(GetPlayerVirtualWorld(playerid) == SmokeInfo[i][SWorld] && GetPlayerInterior(playerid) == SmokeInfo[i][SInterior])
- {
- RespirandoSmoke[playerid] = true;
- ApplyAnimation(playerid, "PED", "gas_cwr", 4.1, 0, 1, 1, 1, 1, 1);
- DisX[playerid] = SmokeInfo[i][SPosX];
- DisY[playerid] = SmokeInfo[i][SPosY];
- DisZ[playerid] = SmokeInfo[i][SPosZ];
- SetTimerEx("AnimSmoke", 100, false, "i", playerid);
- break;
- }
- }
- }
- }
- return 1;
- }
- CALL::PlantarSmoke1(playerid)
- {
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant_2Idle", 4.1, 0, 1, 1, 1, 1, 1);
- SetTimerEx("PlantarSmoke2", 400, 0, "i", playerid);
- return 1;
- }
- CALL::PlantarSmoke2(playerid)
- {
- ApplyAnimation(playerid, "BD_FIRE", "BD_Fire1", 4.1, 0, 1, 1, 1, 1, 1);//stop animes (clearanimatios fail D: )
- if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) RemovePlayerAttachedObject(playerid, 1);
- SetarArmas(playerid);
- new Float:X, Float:Y, Float:Z;
- new worldid = GetPlayerVirtualWorld(playerid);
- new interiorid = GetPlayerInterior(playerid);
- GetPlayerPos(playerid, X, Y, Z);
- for(new i = 0; i < sizeof(SmokeInfo); i++)
- {
- if(SmokeInfo[i][SPosX] == 0.0 && SmokeInfo[i][SPosY] == 0.0 && SmokeInfo[i][SPosZ] == 0.0)
- {
- SmokeInfo[i][ObjSmoke] = CreateDynamicObject(343, X, Y, Z-0.90, 0.0, 90.0, 0.0, worldid, interiorid);
- SmokeInfo[i][EfeitoSmoke] = CreateDynamicObject(18715, X, Y, Z-0.90, 0.0, 0.0, 0.0, worldid, interiorid);
- SmokeInfo[i][SPosX] = X;
- SmokeInfo[i][SPosY] = Y;
- SmokeInfo[i][SPosZ] = Z;
- SmokeInfo[i][SWorld] = worldid;
- SmokeInfo[i][SInterior] = interiorid;
- SetTimerEx("RemoveSmoke", 30000, false, "ddddd", SmokeInfo[i][ObjSmoke], SmokeInfo[i][EfeitoSmoke], i, i, i);
- break;
- }
- }
- return 1;
- }
- CALL::RemoveSmoke(granaid, smokeid, SmokeX, SmokeY, SmokeZ)
- {
- DestroyDynamicObject(granaid);
- DestroyDynamicObject(smokeid);
- SmokeInfo[SmokeX][SPosX] = 0.0;
- SmokeInfo[SmokeY][SPosY] = 0.0;
- SmokeInfo[SmokeZ][SPosZ] = 0.0;
- return 1;
- }
- CALL::AnimSmoke(playerid)
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- if(IsPlayerInRangeOfPoint(playerid, 6.0, DisX[playerid], DisY[playerid], DisZ[playerid]) && RespirandoSmoke[playerid] == true)
- {
- ApplyAnimation(playerid, "PED", "gas_cwr", 4.1, 0, 1, 1, 1, 1, 1);
- SetTimerEx("AnimSmoke", 100, false, "i", playerid);
- return 1;
- }
- RespirandoSmoke[playerid] = false;
- ApplyAnimation(playerid, "PED", "IDLE_tired", 4.1, 0, 1, 1, 1, 1, 1);
- SetTimerEx("StopAnim", 600, false, "i", playerid);
- return 1;
- }
- CALL::StopAnim(playerid)
- {
- ApplyAnimation(playerid, "BD_FIRE", "BD_Fire1", 4.1, 0, 1, 1, 1, 1, 1);
- return 1;
- }
- CALL::PlantarC4(playerid)
- {
- ApplyAnimation(playerid, "BD_FIRE", "BD_Fire1", 4.1, 0, 1, 1, 1, 1, 1);//stop animes (clearanimatios fail D: )
- if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) RemovePlayerAttachedObject(playerid, 1);
- new Float:X, Float:Y, Float:Z;
- new worldid = GetPlayerVirtualWorld(playerid);
- new interiorid = GetPlayerInterior(playerid);
- GetPlayerPos(playerid, X, Y, Z);
- ObjC4[playerid] = CreateDynamicObject(1654, X, Y, Z-0.90, 0.0, 90.0, 0.0, worldid, interiorid);
- PosC4[0][playerid] = X;
- PosC4[1][playerid] = Y;
- PosC4[2][playerid] = Z;
- AcionadorC4[playerid] = true;
- SetPlayerAttachedObject(playerid, 1, 364, 5, 0.074481, 0.121008, -0.062193, 145.491744, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000); // bomb - Acionador C4
- return 1;
- }
- //==================== | COMANDOS | ====================
- CMD:granada(playerid)
- {
- if(GranadaC4[playerid] == true || AcionadorC4[playerid] == true) return SendClientMessage(playerid, -1, "-Erro- Você já está com as mãos ocupadas");
- GuardarArmas(playerid);
- SetPlayerAttachedObject(playerid, 1, 343, 6, 0.078793, 0.008405, -0.007976, 13.225624, 5.088777, 74.662277, 1.000000, 1.000000, 1.000000 ); // teargas - Bomba de fumaça
- GranadaSmoke[playerid] = true;
- return 1;
- }
- CMD:c4(playerid)
- {
- if(GranadaSmoke[playerid] == true || AcionadorC4[playerid] == true) return SendClientMessage(playerid, -1, "-Erro- Você já está com as mãos ocupadas");
- GuardarArmas(playerid);
- SetPlayerAttachedObject( playerid, 1, 1654, 5, 0.123819, 0.016621, 0.000729, 336.107452, 351.245513, 52.185253, 1.000000, 1.000000, 1.000000 ); // dynamite - Bomba C4
- GranadaC4[playerid] = true;
- return 1;
- }
- CMD:mask(playerid)
- {
- if(RespirandoSmoke[playerid] == true) return 1;
- if(Mask[playerid] == false)
- {
- ApplyAnimation(playerid, "FIGHT_B", "FightB_block", 4.1, 0, 1, 1, 1, 1, 1);
- SetTimerEx("StopAnim", 400, false, "i", playerid);
- SetPlayerAttachedObject(playerid, 0, 19036, 2, 0.091755, 0.030188, 0.001176, 94.722915, 90.211921, 0.000000, 1.000000, 1.000000, 1.000000); // HockeyMask1 - Mask
- Mask[playerid] = true;
- }
- else
- {
- ApplyAnimation(playerid, "FIGHT_B", "FightB_block", 4.1, 0, 1, 1, 1, 1, 1);
- SetTimerEx("StopAnim", 400, false, "i", playerid);
- if(IsPlayerAttachedObjectSlotUsed(playerid, 0)) RemovePlayerAttachedObject(playerid, 0);
- Mask[playerid] = false;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement