SA-MP Forums Archive
Replacement for this? - 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: Replacement for this? (/showthread.php?tid=466138)



Replacement for this? - CrossWindGaming - 26.09.2013

Code:
	else if(!IsPlayerInRangeOfVehicle(playerid, vehicleid, 7.5) || LockStatus[vehicleid] >= 1) { // G-bugging fix
		ClearAnimations(playerid);
	}
	return 1;
The !IsPlayerInRangeOfVehicle brings up an undefined symbol error. Is there a replacement for the code or a way to fix it


Re: Replacement for this? - iZN - 26.09.2013

I may suggest you MP2's gBug include.


Re: Replacement for this? - RajatPawar - 26.09.2013

pawn Code:
stock IsPlayerInRangeOfVehicle(playerid, veh, Float: range)
{
    if( !IsPlayerConnected(playerid) ) return 0 ;
   
    if( IsValidVehicle( veh ) )
    {
         new Float: x,
                Float: y,
                Float: z;
          GetVehiclePos( veh, x, y, z );
         
           if( IsPlayerInRangeOfPoint( playerid, range, x, y, z ) ) return true;
           else
                return false;
      }
}
This stock?


Re: Replacement for this? - Konstantinos - 26.09.2013

Quote:
Originally Posted by Rajat_Pawar
View Post
pawn Code:
stock IsPlayerInRangeOfVehicle(playerid, veh, Float: range)
{
    if( !IsPlayerConnected(playerid) ) return 0 ;
   
    if( IsValidVehicle( veh ) )
    {
         new Float: x,
                Float: y,
                Float: z;
          GetVehiclePos( veh, x, y, z );
         
           if( IsPlayerInRangeOfPoint( playerid, range, x, y, z ) ) return true;
           else
                return false;
      }
}
This stock?
The IsValidVehicle will be undefined. You need to declare the native:
pawn Code:
#include <a_samp>
// some other includes..

native IsValidVehicle( vehicleid );
Plus, the function should return a value at the end.

EDIT:
pawn Code:
stock IsPlayerInRangeOfVehicle(playerid, veh, Float: range)
{
    if( !IsPlayerConnected( playerid ) ) return 0;
    if( !IsValidVehicle( veh ) ) return 0;
   
    new Float: x,
        Float: y,
        Float: z
    ;
    GetVehiclePos( veh, x, y, z );

    if( IsPlayerInRangeOfPoint( playerid, range, x, y, z ) ) return 1;
    return 0;
}