SA-MP Forums Archive
need help with getting coordinates - 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: need help with getting coordinates (/showthread.php?tid=634196)



need help with getting coordinates - whip - 14.05.2017

heeello guys, i'll try to write it short as i can.
i'll inform you, that i will make few mistakes in my "english", so...

i need help with taking the coords from player to car.
i think, that that's the problem.

Код HTML:
CMD:krauti(playerid)
{
    new randomSk;
    new msg[128];
   	new Float:vehx, Float:vehy, Float:vehz;
	new Float:distance = GetVehicleDistanceFromPoint(meddzip[0]|| meddzip[1]|| meddzip[2]||meddzip[3], vehx, vehy, vehz);
  	//if(!PlayerToPoint(2, playerid, -1770.6323, 2415.2854, 80.5659)) return SendClientMessage(playerid,Raudona, "* Љalia jūsų nėra malkų kurias galima pakrauti.");
	if(playerDB[playerid][nupjove]<10)
	{
	    format(msg,sizeof(msg),"* Galima neљti nupjovus visas malkas.");
	    SendClientMessage(playerid, Zalia, msg);
	}
	if(playerDB[playerid][pakrove]>10)
	{
	    format(msg,sizeof(msg),"* Jau pakrauta.");
	    SendClientMessage(playerid, Zalia, msg);
	}
	if(PlayerToPoint(2, playerid, -1770.6323, 2415.2854, 80.5659))
    {
        randomSk = randomNumb(1, 11);
        ApplyAnimation(playerid,"CARRY","crry_prtial",4.1,1,1,1,1,1,1);
        playerDB[playerid][nesa]+=randomSk;
        SetPlayerAttachedObject(playerid, 1, 19793, 1, 0.002953, 0.469660, -0.009797, 269.851104, 88.443557, 0.000000, 0.804894, 1.000000, 0.822361);
	}
	if(distance <=3 && playerDB[playerid][nesa]>0)
    {
        format(msg,sizeof(msg),"* Padėjote %i malkas.",playerDB[playerid][nesa]);
	    SendClientMessage(playerid, Zalia, msg);
	    playerDB[playerid][nupjove]-=playerDB[playerid][nesa];
	    playerDB[playerid][pakrove]+=playerDB[playerid][nesa];
    }
	return 1;
}



Re: need help with getting coordinates - park4bmx - 14.05.2017

Код:
new Float:distance = GetVehicleDistanceFromPoint(meddzip[0]|| meddzip[1]|| meddzip[2]||meddzip[3], vehx, vehy, vehz);
??
if you have more then 1 vehicleID then use more then one function to get the distance...
e.g. make it into a loop ?
Код:
GetPlayerPos(playerid, Px, Py, Pz);
new Float:Px, Float:Py, Float:Pz,new Float:distance[3];
for (new i = 0; i < 4; i++)
{
   distance[i] = GetVehicleDistanceFromPoint(meddzip[i], vehx, vehy, vehz);
}
distance[??] will hold the multiple vehicleID with the distance between the car and the palyerposition


Re: need help with getting coordinates - whip - 15.05.2017

understood, i think, that we found a solution to that problem, thanks!