GPS Calculation - Professional Scripter required
#1

Hey there,

im actually doing a GPS System,more advanced than its ever been.
After i created a net of waypoints all over San Fierro,
i now need to script the gps itself.

I already tried things like this:
pawn Код:
new Float:gpsp[8],tmpoutput3[128];
                GetPlayerPos(playerid,gpsp[0],gpsp[1],gpsp[2]);
                gpsp[6] = GetDistance(gpsp[0],gpsp[1],gpsp[2],gx,gy,gz);
                gpsp[3]=gx-gpsp[0]/(gpsp[6]*50);
        gpsp[4]=gy-gpsp[1]/(gpsp[6]*50);
        for(new gc=25;gc<=150;gc+=25)
        {
            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;
        }
        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();
but they aint working.

So, all informations in a few points:
*Given starting point (xyz 1)
*Given target (xyz 2)
*Given waypoints (xyz n)

What i now want to do is to calculate the closest waypoint from the position of the player (starting point) in the direction of the target.

As im not a genious mathematic, and discussed with other good scripter about this more than an hour, and tried it more than 3 hours, i think, i can now try to get an answer from you.

Regards,
Trooper
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)