SA-MP Forums Archive
Is this right? - 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: Is this right? (/showthread.php?tid=499739)



Is this right? - Lajko1 - 09.03.2014

I need to ask here cuz I can't test on my own :/

Is this code right or is there any mistake?

pawn Код:
stock IsPlayerBehindPlayer(playerid,targetid,Float:distance,Float:range)
{
    if(!IsPlayerConnected(playerid) || !IsPlayerConnected(targetid))return 0;
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(targetid, x, y, z);//my pos
        GetXYInBehindPlayer(targetid,x,y,distance);
        if(IsPlayerInRangeOfPoint(playerid,range,x,y,z))return 1;
    }
    return 0;
}
pawn Код:
stock GetXYInBehindPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    a -= 180.0;
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
What I want to detect are coords behind player for /cuff and /uncuff cmd ^^, thanks for checking and answering.


Re : Is this right? - Clad - 09.03.2014

What is going wrong ?


Re: Is this right? - Lajko1 - 09.03.2014

Well nothing is wrong I just want to know if this is right code to detect coords behind another player? I wouldn't post that if I would be able to test with my friend but I can't port forward... :/


Re : Re: Is this right? - Clad - 09.03.2014

Quote:
Originally Posted by Lajko1
Посмотреть сообщение
Well nothing is wrong I just want to know if this is right code to detect coords behind another player? I wouldn't post that if I would be able to test with my friend but I can't port forward... :/
Advice, try to port forward because you must always test your server man.


Re: Re : Re: Is this right? - Lajko1 - 09.03.2014

Quote:
Originally Posted by Clad
Посмотреть сообщение
Advice, try to port forward because you must always test your server man.
Seriously man, I'm asking under Server Support for help also I'm asking on Portforward.com for help I'm not getting any answers how to solve this error when I want to port forward:

"IP ERROR: LAN Side IP Address
description: Out of LAN side network address range"

if you can help go ahead

Anyway on topic I would like someone to check that code I posted for me if it will work, thanks alot.