SA-MP Forums Archive
GetNearest problem - 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: GetNearest problem (/showthread.php?tid=598599)



GetNearest problem - Squirrel - 14.01.2016

Alright so it does give u the guns but it gives you all in range. It should give u nearest one only.

PHP код:
for(new GunId 0GunId MAX_GUNDROPGunId++) {
        new 
Float:PosSome[3];
        
GetDynamicObjectPos(GunObject[GunId],PosSome[0],PosSome[1],PosSome[2]);
        if(
IsPlayerInRangeOfPoint(playerid,5.0,PosSome[0],PosSome[1],PosSome[2])) {
            if(
GetPlayerVirtualWorld(playerid) == GunInfo[GunId][GunWorld]) {
                
GivePlayerWeapon(playerid,GunInfo[GunId][GunWeaponID],GunInfo[GunId][GunWeaponAmmo]);
                
DestroyDynamicObject(GunObject[GunId]);
                
GunInfo[GunId][GunX] = 2000.00;
                
GunInfo[GunId][GunY] = 2000.00;
                
GunInfo[GunId][GunZ] = 3000.00;
                
GunInfo[GunId][GunWorld] = 666;
                
GunInfo[GunId][GunX] = 2000.00;
            }
        }
    } 



Re: GetNearest problem - Eth - 14.01.2016

pawn Код:
for(new GunId = 0; GunId < MAX_GUNDROP; GunId++) {
        new Float:PosSome[3];
        GetDynamicObjectPos(GunObject[GunId],PosSome[0],PosSome[1],PosSome[2]);
        if(IsPlayerInRangeOfPoint(playerid,5.0,PosSome[0],PosSome[1],PosSome[2])) {
            if(GetPlayerVirtualWorld(playerid) == GunInfo[GunId][GunWorld]) {
                GivePlayerWeapon(playerid,GunInfo[GunId][GunWeaponID],GunInfo[GunId][GunWeaponAmmo]);
                DestroyDynamicObject(GunObject[GunId]);
                GunInfo[GunId][GunX] = 2000.00;
                GunInfo[GunId][GunY] = 2000.00;
                GunInfo[GunId][GunZ] = 3000.00;
                GunInfo[GunId][GunWorld] = 666;
                GunInfo[GunId][GunX] = 2000.00;
                break;
            }
        }
    }



Re: GetNearest problem - Squirrel - 14.01.2016

Thanks!


Re: GetNearest problem - yvoms - 14.01.2016

Squirrel, don't i know you from something?
OT: let me know if it works.


Re: GetNearest problem - Squirrel - 14.01.2016

Quote:
Originally Posted by yvoms
Посмотреть сообщение
Squirrel, don't i know you from something?
OT: let me know if it works.
Hehe yup it works, well I used to play on trucking servers mostly so I Doubt