26.05.2018, 00:08
Alguem tem Fs pra compartilhar de HeadShot de Deagle e Sniper quem ajuda vlw pela ajuda
#include <a_samp>
#define SERVER_MAX_PLAYERS 100 //MUDE PARA O NUMERO MAXIMO DE JOGADORES DO SEU SERVIDOR
//#define SHOWPATH //DESCOMENTE ISSO SE QUISER MOSTRAR O RASTRO DA BALA
new RecentlyShot[SERVER_MAX_PLAYERS];
public OnFilterScriptInit()
{
print("\n\n__________________________________________________________________");
print(" Boom Headshot System by inark loaded!");
print(" Copyright SAMPLITE 2013");
print(" ---------------------------");
LoadModules(0,1);
print("__________________________________________________________________\n\n");
return 1;
}
public OnFilterScriptExit()
{
print("\n\n__________________________________________________________________");
print(" Boom Headshot System by inark unloaded!");
print(" Copyright SAMPLITE 2013");
print(" ---------------------------");
LoadModules(0,1);
print("__________________________________________________________________\n\n");
return 1;
}
public OnPlayerConnect(playerid) {
SendClientMessage(playerid, 0xFFFFFFFF, "");
LoadModules(playerid,2);
return 1;
}
public OnPlayerSpawn(playerid)
{
//GivePlayerWeapon(playerid, 34, 15);
RecentlyShot[playerid] = 0;
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE) {
if(RecentlyShot[playerid] == 0) {
RecentlyShot[playerid] = 1;
SetTimerEx("AntiSpam", 1000, false, "d", playerid);
if(GetPlayerWeapon(playerid) == 34) {
new Float:blahx, Float:blahy, Float:blahz;
HeadshotCheck(playerid, blahx, blahy, blahz);
return 1;
}
return 1;
}
return 1;
}
return 1;
}
forward AntiSpam(playerid);
public AntiSpam(playerid) {
RecentlyShot[playerid] = 0;
return 1;
}
stock PlayerName(playerid) {
new name[24];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
stock HeadshotCheck(playerid, &Float:x, &Float:y, &Float:z)
{
new Float:fx,Float:fy,Float:fz;
GetPlayerCameraFrontVector(playerid, fx, fy, fz);
new Float:cx,Float:cy,Float:cz;
GetPlayerCameraPos(playerid, cx, cy, cz);
for(new Float:i = 0.0; i < 50; i = i + 0.5)
{
x = fx * i + cx;
y = fy * i + cy;
z = fz * i + cz;
#if defined SHOWPATH
CreatePickup(1239, 4, x, y, z, -1);
#endif
for(new player = 0; player < SERVER_MAX_PLAYERS; player ++)
{
if(IsPlayerConnected(playerid))
{
if(player != playerid)
{
if(GetPlayerSpecialAction(player) == SPECIAL_ACTION_DUCK) //CROUCHING
{
if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z))
{
new string[128];
format(string, sizeof(string), "{00ff00}Headshot:{ffffff} %s levou um Headshot de {00ff00} %s", PlayerName(player), PlayerName(playerid));
SendClientMessageToAll(0xFF9900AA, string);
GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);
SetPlayerHealth(player, 0.0);
CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, 34);
}
}
else //NOT CROUCHING
{
if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z - 0.7))
{
new string[128];
format(string, sizeof(string), "{00ff00}HeadShot: {ffffff}%s levou um Headshot de {00ff00}%s", PlayerName(player), PlayerName(playerid));
SendClientMessageToAll(0xFF9900AA, string);
GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);
SetPlayerHealth(player, 0.0);
CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, 34);
}
}
}
}
}
}
return 1;
}
stock LoadModules(playerid,funcao)
{
if(funcao==1) print("");
if(funcao==2)
{
SendClientMessage(playerid, 0xFFFFFFFF, "");
SendClientMessage(playerid, 0xFFFFFFFF, "");
}
}