SA-MP Forums Archive
HEADSHOT DISTANCE HELP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: HEADSHOT DISTANCE HELP (/showthread.php?tid=613198)



HEADSHOT DISTANCE HELP - Hunud - 25.07.2016

Hello Guys,

How should i get a distance in player stats of top headshots distance! here is codes in stats

Код:
new Float:x, Float:y, Float:z, Float:fDistance;
Код:
GetPlayerPos(playerid, x, y, z);
        fDistance = GetPlayerDistanceFromPoint(playerid, x, y, z);
Код:
Top distance Headshot |{FFFFFF} %0.2f",fDistance
When I Headshots player from 100 meters there is nothing in /stats top distance headshot: 0.00

everything is under /stats cmd


Re: HEADSHOT DISTANCE HELP - Deadpoop - 25.07.2016

PHP код:
GetPlayerPos(targetxyz);
        
fDistance GetPlayerDistanceFromPoint(playeridxyz); 
You get distance from yourself not from the player you shot!


Re: HEADSHOT DISTANCE HELP - Hunud - 25.07.2016

Quote:
Originally Posted by Deadpoop
Посмотреть сообщение
PHP код:
GetPlayerPos(targetxyz);
        
fDistance GetPlayerDistanceFromPoint(playeridxyz); 
You get distance from yourself not from the player you shot!
I did it but no work ;/


Re: HEADSHOT DISTANCE HELP - DRIFT_HUNTER - 25.07.2016

You are checking player distance from himself.
You need to know target and killer/issuer

So something like these:
pawn Код:
GetPlayerPos(playerid, x, y, z);
        fDistance = GetPlayerDistanceFromPoint(killerid, x, y, z);



Re: HEADSHOT DISTANCE HELP - PrO.GameR - 25.07.2016

You are checking a player's distance with his own position? and expect it to be more than 0?


Re: HEADSHOT DISTANCE HELP - Logic_ - 26.07.2016

Nice work copying xd from my release that got removed xd

anyways, heres my code.
PHP код:
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart

// Headshot System 
            
if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9
            { 
            
SetPlayerHealth(playerid0.0); 
            
GameTextForPlayer(playerid"~r~HEADSHOT"30003); 
            
GameTextForPlayer(issuerid"~g~HEADSHOT"30003); 
            new 
Float:xFloat:yFloat:zFloat:fDistancehsMessage[90], KName[MAX_PLAYER_NAME], PName[MAX_PLAYER_NAME]; 
        
GetPlayerPos(playeridxyz); 
        
fDistance GetPlayerDistanceFromPoint(issueridxyz); 
        
GetPlayerName(issueridKNameMAX_PLAYER_NAME); 
        
GetPlayerName(playeridPNameMAX_PLAYER_NAME); 
            
format(hsMessagesizeof(hsMessage), "%s has Headshotted %s from the distance of %0.2f"KNamePNamefDistance); 
            
SendClientMessageToAll(0xFCFC18AAhsMessage); 
EDIT: This is a out-dated version, I have optimized my script very much.


Re: HEADSHOT DISTANCE HELP - Bolex_ - 26.07.2016

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
Nice work copying xd from my release that got removed xd

PHP код:
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart

// Headshot System 
            
if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9
            { 
            
SetPlayerHealth(playerid0.0); 
            
GameTextForPlayer(playerid"~r~HEADSHOT"30003); 
            
GameTextForPlayer(issuerid"~g~HEADSHOT"30003); 
            new 
Float:xFloat:yFloat:zFloat:fDistancehsMessage[90], KName[MAX_PLAYER_NAME], PName[MAX_PLAYER_NAME]; 
        
GetPlayerPos(playeridxyz); 
        
fDistance GetPlayerDistanceFromPoint(issueridxyz); 
        
GetPlayerName(issueridKNameMAX_PLAYER_NAME); 
        
GetPlayerName(playeridPNameMAX_PLAYER_NAME); 
            
format(hsMessagesizeof(hsMessage), "%s has Headshotted %s from the distance of %0.2f"KNamePNamefDistance); 
            
SendClientMessageToAll(0xFCFC18AAhsMessage); 
So whats the problem ? So you are just posted this useless shit to prove to someone thats your ? Everyone copy someone same like me xd


Re: HEADSHOT DISTANCE HELP - GhostHacker - 26.07.2016

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
Nice work copying xd from my release that got removed xd

anyways, heres my code. *pussyman*
PHP код:
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart

// Headshot System 
            
if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9
            { 
            
SetPlayerHealth(playerid0.0); 
            
GameTextForPlayer(playerid"~r~HEADSHOT"30003); 
            
GameTextForPlayer(issuerid"~g~HEADSHOT"30003); 
            new 
Float:xFloat:yFloat:zFloat:fDistancehsMessage[90], KName[MAX_PLAYER_NAME], PName[MAX_PLAYER_NAME]; 
        
GetPlayerPos(playeridxyz); 
        
fDistance GetPlayerDistanceFromPoint(issueridxyz); 
        
GetPlayerName(issueridKNameMAX_PLAYER_NAME); 
        
GetPlayerName(playeridPNameMAX_PLAYER_NAME); 
            
format(hsMessagesizeof(hsMessage), "%s has Headshotted %s from the distance of %0.2f"KNamePNamefDistance); 
            
SendClientMessageToAll(0xFCFC18AAhsMessage); 
Lol this guy make small and noobish things and consider them as great thing any kid can do it and no need to copy paste lol.