26.12.2012, 11:58
(
Последний раз редактировалось Dinnozor; 26.12.2012 в 12:51.
)
Actually I tried with these functions but couldn't get a nice result... It has been a while I haven't changed the script but I remember having trouble with these, and not only with the deer hunting stuff...
So you can indeed shoot a deer aiming 100m above it (just blame gravity ? :P ), but once again this is for fun, so if people just want to "cheat" that way that's their problem..
For the moment I don't plan to modify it, but I note your suggestion and might be trying and pulling my hair off again to make it work with GetPlayerCameraFrontVector and GetPlayerCameraPos... Also I kind of have some trouble running SAMP with Wine (under Mac OS X Lion) ; it used to work but for a little while it just hasn't been working So I'll have to fix this before modifying the script...
Edit : adapted from another of my scripts, I will try this when my SAMP on Mac problem will be fixed :
It worked fine for another script. However it only had to check for a short distance (4), not like here, where it checks until 100. So maybe that would make a lot of calculation. I will make tests when I can, but tell me if you think something may be approved...
So you can indeed shoot a deer aiming 100m above it (just blame gravity ? :P ), but once again this is for fun, so if people just want to "cheat" that way that's their problem..
For the moment I don't plan to modify it, but I note your suggestion and might be trying and pulling my hair off again to make it work with GetPlayerCameraFrontVector and GetPlayerCameraPos... Also I kind of have some trouble running SAMP with Wine (under Mac OS X Lion) ; it used to work but for a little while it just hasn't been working So I'll have to fix this before modifying the script...
Edit : adapted from another of my scripts, I will try this when my SAMP on Mac problem will be fixed :
pawn Код:
stock IsPlayerAimingObject(playerid, aimid)
{
new Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2,Float:xv,Float:yv,Float:zv,Float:xc,Float:yv,Float:zc,Float:xt,Float:yt,Float:zt;
GetPlayerPos(playerid, X1, Y1, Z1);
GetPlayerCameraPos(playerid,xc,yc,zc);
GetPlayerCameraFrontVector(playerid,xv,yv,zv);
GetDynamicObjectPos(aimid, X2, Y2, Z2);
new Float:Dist = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
if(Dist < 100)
{
for(new i=1;i<=100;i++)
{
xt=X1+i*xv;
yt=Y1+yv*i;
GetPointZPos(xt,yt,zt);
Dist=floatsqroot(floatpower(floatabs(xt-X2), 2) + floatpower(floatabs(yt-Y2), 2)+floatpower(floatabs(zt-Z2),2));
if (Dist<=0.5)
{
return true
}
}
}
return false;
}