GPS Calculation - Professional Scripter required
#9

pawn Код:
angle=-GetAngleBetweenPoints(gpsp[0],gpsp[1],gx,gy);
        gpsp[3]=gpsp[0]+(100 * floatsin(-angle, degrees));
        gpsp[4]=gpsp[1]+(100 * floatcos(-angle, degrees));
        for(new gc=20;gc<=80;gc+=20)
        {
            format(mysqlquery[playerid],256,"SELECT * FROM streetview_lv WHERE x BETWEEN '%f' AND '%f' && y BETWEEN '%f' AND '%f' ORDER BY x ASC",gpsp[3]-gc,gpsp[3]+gc,gpsp[4]-gc,gpsp[4]+gc);
            mysql_query(mysqlquery[playerid]);
            mysql_store_result();
            if(mysql_fetch_field("x",tmpoutput3)) break;
        }
        mysql_fetch_field("x",tmpoutput3);
        SetPVarFloat(playerid,"knotx",floatstr(tmpoutput3));
        mysql_fetch_field("y",tmpoutput3);
        SetPVarFloat(playerid,"knoty",floatstr(tmpoutput3));
        mysql_fetch_field("z",tmpoutput3);
        SetPVarFloat(playerid,"knotz",floatstr(tmpoutput3));
        mysql_free_result();
        SetPlayerRaceCheckpoint(playerid,3,GetPVarFloat(playerid,"knotx"),GetPVarFloat(playerid,"knoty"),GetPVarFloat(playerid,"knotz"),0,0,0,3);


Float:GetAngleBetweenPoints(Float:X1,Float:Y1,Float:X2,Float:Y2)
{
  new Float:angle=atan2(X2-X1,Y2-Y1);
  if(angle>360)angle-=360;
  if(angle<0)angle+=360;
  return angle;
}
Tested it multiple times,
looks like its working...
Thought i share it with you,
as you tried to help me.

Now i only have another problem, but thats a new topic
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 7 Guest(s)