SA-MP Forums Archive
Distance to Number. (+REP!) - 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: Distance to Number. (+REP!) (/showthread.php?tid=583259)



Distance to Number. (+REP!) - Lirbo - 27.07.2015

I want use the function GetPlayerDistanceOfPoint but i want to transform the distance to cash, I mean if it's more far so it would give you more cash, it's pretty hard to explain it but i hope u understood me


Re: Distance to Number. (+REP!) - SickAttack - 27.07.2015

Just convert the floating point number into a whole number:
pawn Код:
new cash = floatround(GetPlayerDistanceFromPoint(playerid, 0.0, 0.0, 0.0));
GivePlayerMoney(playerid, cash);



Re: Distance to Number. (+REP!) - Roberto80 - 27.07.2015

You can use something like this:
PHP код:
new Float:distance GetPlayerDistanceFromPoint(playerid,x,y,x);
if(
distance 10) return GivePlayerMoney(playerid,100);
else if(
distance 10 || distance 20) return GivePlayerMoney(playerid,200); 
And continue like this