fix hs system pls
#1

this system when player is AFK steel hs him please fix it for me

PHP код:
#include <a_samp>
#define SERVER_MAX_PLAYERS 500
new RecentlyShot[SERVER_MAX_PLAYERS];
public 
OnFilterScriptInit()
{
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
RecentlyShot[playerid] = 0;
    return 
1;
}
public 
OnPlayerUpdate(playerid)
{
    return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
newkeys KEY_FIRE && newkeys KEY_HANDBRAKE) {
        if(
RecentlyShot[playerid] == 0) {
            
RecentlyShot[playerid] = 1;
            
SetTimerEx("AntiSpam"1000false"d"playerid);
            if(
GetPlayerWeapon(playerid) == 34) {
                new 
Float:blahxFloat:blahyFloat:blahz;
                
HeadshotCheck(playeridblahxblahyblahz);
                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(playeridnamesizeof(name));
    return 
name;
}
stock HeadshotCheck(playerid, &Float:x, &Float:y, &Float:z)
{
    new 
Float:fx,Float:fy,Float:fz;
    
GetPlayerCameraFrontVector(playeridfxfyfz);
    new 
Float:cx,Float:cy,Float:cz;
    
GetPlayerCameraPos(playeridcxcycz);
    for(new 
Float:0.0500.5)
    {
        
fx cx;
        
fy cy;
        
fz cz;
        
#if defined SHOWPATH
        
CreatePickup(12394xyz, -1);
        
#endif
        
for(new player 0player SERVER_MAX_PLAYERSplayer ++)
        {
            if(
IsPlayerConnected(playerid))
            {
                if(
player != playerid)
                {
                    if(
GetPlayerSpecialAction(player) == SPECIAL_ACTION_DUCK)
                    {
                        if(
IsPlayerInRangeOfPoint(player0.3xyz))
                        {
                            
GameTextForPlayer(playerid"~r~HEADSHOT!"20006);
                            
GameTextForPlayer(player"~r~HEADSHOT!"20006);
                            
SetPlayerHealth(player0.0);
                            
CallRemoteFunction("OnPlayerDeath""ddd"playerplayerid34);
                        }
                    }
                    else
                    {
                        if(
IsPlayerInRangeOfPoint(player0.3xy0.7))
                        {
                            
GameTextForPlayer(playerid"~r~HEADSHOT!"20006);
                            
GameTextForPlayer(player"~r~HEADSHOT!"20006);
                            
SetPlayerHealth(player0.0);
                            
CallRemoteFunction("OnPlayerDeath""ddd"playerplayerid34);
                        }
                    }
                }
            }
        }
    }
    return 
1;

Reply
#2

https://sampforum.blast.hk/showthread.php?tid=283306
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)