SA-MP Forums

Go Back   SA-MP Forums > SA-MP > Bug Reports

Reply
 
Thread Tools Display Modes
Old 06/12/2018, 08:41 AM   #1
Yashas
Gangsta
 
Join Date: Jun 2012
Location: India
Posts: 869
Reputation: 296
Default GetPlayerLastShotVector returns wrong information

The wiki states that "If the player hit nothing, the hit positions will be 0. This means you can't currently calculate how far a bullet travels through open air. ".

While looking into the data, I found that it does not always return (0, 0 ,0). Sometimes, it returns (X, 0, 0) where X appears to be some coordinate not anywhere close to the origin.

Screenshots attached.

UPDATE:
It returns a random hit position far away from origin sometimes. Screenshot attached.

Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
	new data[E_SHOT_VECTOR];
    CollectDataOPWS(data, playerid, weaponid, hittype, hitid, fX, fY, fZ);
    
    new buffer[1024];
    EncodeShotVector(data, buffer);
    
    new Float:X, Float:Y, Float:Z, Float:x, Float:y, Float:z;
     GetPlayerLastShotVectors(playerid, X, Y, Z, x, y, z);
     
    
    fwrite(dataFile[playerid], buffer);
    fwrite(dataFile[playerid], "\r\n");
    
    format(buffer, 1024, "O: %.2f %.2f %.2f H: %.2f %.2f %.2f", X, Y, Z, x, y, z);
    SendClientMessageToAll(0x00FF00FF, buffer);
    format(buffer, 1024, "O: %.2f %.2f %.2f H: %.2f %.2f %.2f", data[fOriginX], data[fOriginY], data[fOriginZ],
 								    data[fHitPosX], data[fHitPosY], data[fHitPosZ]);
    SendClientMessageToAll(0x0000FFFF, buffer);
    return 1;
}
Please ignore the blue messages (they are expected to match exactly with the green messages).

EDIT:
I checked the hittype and it's zero in both cases: (0, 0, 0) and the weird number case
Attached Images
File Type: jpg sa-mp-005.jpg (191.5 KB, 30 views)
File Type: jpg sa-mp-006.jpg (213.0 KB, 25 views)
Yashas is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CreateDynamicPickup returns wrong id sagosagi1 Scripting Help 3 06/05/2014 04:11 AM
housing system returns fault information SomebodyAndMe Scripting Help 6 11/06/2012 06:19 AM
This returns the wrong timestamp. Dokins Scripting Help 1 02/04/2012 07:09 PM
Enum Information returns C? knackworst Scripting Help 29 02/10/2011 03:03 AM
Returns wrong Unknown123 Help Archive 2 24/06/2011 05:51 AM


All times are GMT. The time now is 01:58 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.