IsAtGasStation Function
#1

For people who might need it, i made this for DRPG

Top of your code:
Код:
forward IsAtGasStation(playerid);
End of your code:
Код:
public IsAtGasStation(playerid)
{
	if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2)
	{
		if(PlayerToPoint(5.0, playerid, -245.8878, 1207.6628, 19.7422) || PlayerToPoint(5.0, playerid, -245.8870, 1211.9666, 19.7422))
		{
			return 1;
		}
		else if(PlayerToPoint(5.0, playerid, 623.7903, 1678.2412, 6.9922) || PlayerToPoint(5.0, playerid, 617.9302, 1687.8840, 6.9922) || PlayerToPoint(5.0, playerid, 611.1439, 1697.2592, 6.9922) || PlayerToPoint(5.0, playerid, 603.8867, 1706.3608, 6.9922))
		{
	  	return 1;
		}
		else if(PlayerToPoint(7.0, playerid, 70.5051, 1219.3641, 18.8117))
		{
		  SendClientMessage(playerid, COLOR_RED, "Sorry, This Gas Station isn't in use!");
		  return 0;
		}
		SendClientMessage(playerid, COLOR_RED, "You must be at a Gas Station!");
		return 0;
	}
	SendClientMessage(playerid, COLOR_RED, "You must be in a vehicle and you must be the driver!");
	return 0;
}
To use this code (i.e. in an /refill command) use:
Код:
if(IsAtGasStation(playerid))
{
// Do here what should happen if the player is at a gas station
}
No else is required, because the messages come from the function!
Feel free to edit the coordinates, the ones used here are:
1. My custom gas station in Fort Carson
2. The unused gas station near the Clucking Bell in Fort Carson
3. The big gas station east of Las Venturas

Enjoy!

- Goz3rr
Reply


Messages In This Thread
IsAtGasStation Function - by Gozerr - 28.05.2009, 12:07
Re: IsAtGasStation Function - by lol2112 - 28.05.2009, 12:09
Re: IsAtGasStation Function - by Gozerr - 28.05.2009, 12:20
Re: IsAtGasStation Function - by lol2112 - 28.05.2009, 12:25
Re: IsAtGasStation Function - by Gozerr - 28.05.2009, 12:30
Re: IsAtGasStation Function - by Luka P. - 28.05.2009, 12:32
Re: IsAtGasStation Function - by Gozerr - 28.05.2009, 12:34

Forum Jump:


Users browsing this thread: 3 Guest(s)