/refuel - IsPlayerInRangeOfPoint... Please Help
#1

Код:
COMMAND:refuel(playerid, cmdtext)
{
	if(!IsPlayerInRangeOfPoint(playerid, 1593.8867,2200.9028,10.4804,268.8124)) return SendClientMessage(playerid, COLOR_RED, "Please go to any of the gas stations located around San Andreas");
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must be in a vehicle");
	if(isrefuelling[playerid]) return SendClientMessage(playerid, COLOR_RED, "You are already refuelling");
	if (GetPlayerMoney(playerid) - 1500 <0) return SendClientMessage(playerid,COLOR_RED,"You need $1500 to refuel");
	{
		GivePlayerMoney(playerid, -1500);
		SetCameraBehindPlayer(playerid);
		TogglePlayerControllable(playerid, 0);
		isrefuelling[playerid] = 1;
		TextDrawSetString(td_fuel[playerid], "Refuelling, please wait...");
		SetTimerEx("timer_refuel", 4500, false, "i", playerid);
	}
	return 1;
}
Please can you help me. When I enter the position x,y,z of Isplayerinrange... it still says I have to go to any of the Gas Stations around San Andreas, and doesn't refuel the car, please help me?
Reply
#2

As I see u have multi gas station so u have do smth like this
pawn Код:
if(!IsPlayerInRangeOfPoint(playerid,RANGE,X_GAS_STATION1 ,Y_GAS_STATION1,Z_GAS_STATION1) ||
!IsPlayerInRangeOfPoint(playerid,RANGE,X_GAS_STATION2 ,Y_GAS_STATION2,Z_GAS_STATION2) ||
!IsPlayerInRangeOfPoint(playerid,RANGE,X_GAS_STATION3 ,Y_GAS_STATION3,Z_GAS_STATION3)) //and so on....
return SendClientMessage(playerid, COLOR_RED, "Please go to any of the gas stations located around San Andreas");
Reply
#3

Quote:
Originally Posted by marrcko
Посмотреть сообщение
As I see u have multi gas station so u have do smth like this
pawn Код:
if(!IsPlayerInRangeOfPoint(playerid,RANGE,X_GAS_STATION1 ,Y_GAS_STATION1,Z_GAS_STATION1) ||
!IsPlayerInRangeOfPoint(playerid,RANGE,X_GAS_STATION2 ,Y_GAS_STATION2,Z_GAS_STATION2) ||
!IsPlayerInRangeOfPoint(playerid,RANGE,X_GAS_STATION3 ,Y_GAS_STATION3,Z_GAS_STATION3)) //and so on....
return SendClientMessage(playerid, COLOR_RED, "Please go to any of the gas stations located around San Andreas");
He'll need to add new GAS_STATION3; etc.. why to do that while you can set the Telecodes to em

pawn Код:
if(IsPlayerInRangeOfPoint(playerid,10,1595.5406, 2198.0520, 10.3863) || IsPlayerInRangeOfPoint(playerid,10,2202.0649, 2472.6697, 10.5677) ||
    IsPlayerInRangeOfPoint(playerid,10,2115.1929, 919.9908, 10.5266) || IsPlayerInRangeOfPoint(playerid,10,2640.7209, 1105.9565, 10.5274) ||
    IsPlayerInRangeOfPoint(playerid,10,608.5971, 1699.6238, 6.9922) || IsPlayerInRangeOfPoint(playerid,10,618.4878, 1684.5792, 6.9922) ||
    IsPlayerInRangeOfPoint(playerid,10,2146.3467, 2748.2893, 10.5245) || IsPlayerInRangeOfPoint(playerid,10,-1679.4595, 412.5129, 6.9973) ||
    IsPlayerInRangeOfPoint(playerid,10,-1327.5607, 2677.4316, 49.8093) || IsPlayerInRangeOfPoint(playerid,10,-1470.0050, 1863.2375, 32.3521) ||
    IsPlayerInRangeOfPoint(playerid,10,-2409.2200, 976.2798, 45.2969) || IsPlayerInRangeOfPoint(playerid,10,-2244.1396, -2560.5833, 31.9219) ||
    IsPlayerInRangeOfPoint(playerid,10,-1606.0544, -2714.3083, 48.5335) || IsPlayerInRangeOfPoint(playerid,10,1937.4293, -1773.1865, 13.3828) ||
    IsPlayerInRangeOfPoint(playerid,10,-91.3854, -1169.9175, 2.4213) || IsPlayerInRangeOfPoint(playerid,10,1383.4221, 462.5385, 20.1506) ||
    IsPlayerInRangeOfPoint(playerid,10,660.4590, -565.0394, 16.3359) || IsPlayerInRangeOfPoint(playerid,10,1381.7206, 459.1907, 20.3452) ||
    IsPlayerInRangeOfPoint(playerid,10,-1605.7156, -2714.4573, 48.5335) || IsPlayerInRangeOfPoint(playerid,20,1882.2546,-2393.9824,16.5144) ||
    IsPlayerInRangeOfPoint(playerid,10,1386.5360,-271.5511,-0.4857) || IsPlayerInRangeOfPoint(playerid,10,2017.3016,-229.9219,-0.2183) ||
    IsPlayerInRangeOfPoint(playerid,10,279.1325,1940.4025,17.6406) || IsPlayerInRangeOfPoint(playerid,250,X, Y, Z))
Add these, If you want them to be more Organized use this :

PHP код:
IsAtFuelStation(playerid)
{
    new 
Float:XFloat:YFloat:Z;
    
GetObjectPos(Carrier[0], XYZ);
    if(
IsPlayerInRangeOfPoint(playerid,10,1595.54062198.052010.3863) || IsPlayerInRangeOfPoint(playerid,10,2202.06492472.669710.5677) ||
    
IsPlayerInRangeOfPoint(playerid,10,2115.1929919.990810.5266) || IsPlayerInRangeOfPoint(playerid,10,2640.72091105.956510.5274) ||
    
IsPlayerInRangeOfPoint(playerid,10,608.59711699.62386.9922) || IsPlayerInRangeOfPoint(playerid,10,618.48781684.57926.9922) ||
    
IsPlayerInRangeOfPoint(playerid,10,2146.34672748.289310.5245) || IsPlayerInRangeOfPoint(playerid,10,-1679.4595412.51296.9973) ||
    
IsPlayerInRangeOfPoint(playerid,10,-1327.56072677.431649.8093) || IsPlayerInRangeOfPoint(playerid,10,-1470.00501863.237532.3521) ||
    
IsPlayerInRangeOfPoint(playerid,10,-2409.2200976.279845.2969) || IsPlayerInRangeOfPoint(playerid,10,-2244.1396, -2560.583331.9219) ||
    
IsPlayerInRangeOfPoint(playerid,10,-1606.0544, -2714.308348.5335) || IsPlayerInRangeOfPoint(playerid,10,1937.4293, -1773.186513.3828) ||
    
IsPlayerInRangeOfPoint(playerid,10,-91.3854, -1169.91752.4213) || IsPlayerInRangeOfPoint(playerid,10,1383.4221462.538520.1506) ||
    
IsPlayerInRangeOfPoint(playerid,10,660.4590, -565.039416.3359) || IsPlayerInRangeOfPoint(playerid,10,1381.7206459.190720.3452) ||
    
IsPlayerInRangeOfPoint(playerid,10,-1605.7156, -2714.457348.5335) || IsPlayerInRangeOfPoint(playerid,20,1882.2546,-2393.9824,16.5144) ||
    
IsPlayerInRangeOfPoint(playerid,10,1386.5360,-271.5511,-0.4857) || IsPlayerInRangeOfPoint(playerid,10,2017.3016,-229.9219,-0.2183) ||
    
IsPlayerInRangeOfPoint(playerid,10,279.1325,1940.4025,17.6406) || IsPlayerInRangeOfPoint(playerid,250,XYZ))
    { return 
true; }
    return 
false;

But, You're gonna need to fix the CMD that you have, So its better using the 1st one.

Edit: These are the location of All the Gas Stations located in the Game
Reply
#4

Wow... It works with mines, Thanks bro!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)