Problem with Command
#5

Then Try This
Код:
CMD:refill(playerid, params[])
{
	if(PlayerInfo[playerid][pJob] != 7 && PlayerInfo[playerid][pJob2] != 7)
	{
		return SendClientMessageEx(playerid, COLOR_GREY, "You're not a mechanic.");
	}

	new string[128];
	if(PlayerInfo[playerid][pMechTime] >= 1)
	{
		format(string, sizeof(string), "You must wait %d seconds!", PlayerInfo[playerid][pMechTime]);
		return SendClientMessageEx(playerid, COLOR_GRAD1,string);
	}
	new giveplayerid, money;
	if(sscanf(params, "ud", giveplayerid, money)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /refill [playerid] [price]");

	if(!(money >= 1 && money < 100000))
	{
		return SendClientMessageEx(playerid, COLOR_GREY, "Invalid price specified - can't be lower than 1 or higher than $99,999.");
	}
	if(IsPlayerConnected(giveplayerid))
	{
		if(ProxDetectorS(8.0, playerid, giveplayerid) && IsPlayerInAnyVehicle(giveplayerid))
		{

			new Float: fueltogive;
			switch(PlayerInfo[playerid][pMechSkill])
			{
			case 0 .. 49: fueltogive = 10.0;
			case 50 .. 99: fueltogive = 20.0;
			case 100 .. 199: fueltogive = 30.0;
			case 200 .. 399: fueltogive = 40.0;
			default: fueltogive = 50.0;
			}
			if(giveplayerid == playerid)
			{
				if(PlayerInfo[playerid][pMechSkill] >= 400)
				{
					new vehicleid = GetPlayerVehicleID(playerid);
					VehicleFuel[vehicleid] = VehicleFuel[vehicleid] + fueltogive;
					if(VehicleFuel[vehicleid] > 100.0) VehicleFuel[vehicleid] = 100.0;
					format(string, sizeof(string), "* %s has refilled their vehicle.", GetPlayerNameEx(playerid));
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					format(string, sizeof(string), "* You added %.2f fuel to your car.",fueltogive);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					return 1;
				}
				SendClientMessageEx(playerid, COLOR_GREY, "You can't offer a refill to yourself."); return 1;
			}
			format(string, sizeof(string), "* You offered %s to add %.2f fuel to their car for $%d.",GetPlayerNameEx(giveplayerid),fueltogive,money);
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
			format(string, sizeof(string), "* Car Mechanic %s wants to add %.2f fuel to your car for $%d, type /accept refill to accept.",GetPlayerNameEx(playerid),fueltogive,money);
			SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
			PlayerInfo[playerid][pMechTime] = 60;
			RefillOffer[giveplayerid] = playerid;
			RefillPrice[giveplayerid] = money;
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GREY, "That player is not near you, or isn't in a car.");
		}
	}
	else SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
	return 1;
}
Reply


Messages In This Thread
Problem with Command - by SpiderWalk - 08.05.2012, 20:08
Re: Problem with Command - by 2KY - 08.05.2012, 20:13
Re: Problem with Command - by SpiderWalk - 08.05.2012, 20:17
Re: Problem with Command - by Disturn - 08.05.2012, 20:33
Re: Problem with Command - by DamienWalter - 15.05.2012, 12:35
Re: Problem with Command - by $$inSane - 15.05.2012, 14:19

Forum Jump:


Users browsing this thread: 2 Guest(s)