28.01.2012, 20:04
Can anyone see why it returns unknown command (sucess == 0)
It still works although that is returned.
It still works although that is returned.
pawn Код:
CMD:refuel(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
if(AdminLevel[playerid] < 2) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOUR_GREY, "You are not in a vehicle.");
if(!IsPlayerInRangeOfPoint(playerid, 10.0, -240.2907,1209.9883,19.7422) || IsPlayerInRangeOfPoint(playerid, 10.0,-1327.7439,2675.7014,50.0625)|| IsPlayerInRangeOfPoint(playerid, 10.0, 609.0861,1698.3657,6.9922))return SendClientMessage(playerid, COLOUR_GREY, "You must be at a Gas Station to refuel.");
new amount, sum, string[128], num;
num = 100;
new vehicleid = GetPlayerVehicleID(playerid);
new name = GetVehicleModel(vehicleid)- 200;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(engine == 1) return SendClientMessage(playerid, COLOUR_GREY, "Please turn your engine off before refuelling.");
if(VehFuel[vehicleid] == num)return SendClientMessage(playerid, COLOUR_GREY, "Your vehicle's fuel tank is full.");
sum = num -= VehFuel[vehicleid];
if(amount > sum) return SendClientMessage(playerid, COLOUR_GREY, "Your vehicle cannot hold this much fuel.");
format(string, sizeof(string), "Usage: /refuel [amount] - Use /refuel %d to fill the tank. (You have %d percent fuel left.)", sum, VehFuel[vehicleid]);
if(sscanf(params, "d", amount)) return SendClientMessage(playerid, COLOUR_GREY, string);
RefuelTimer[playerid] = SetTimerEx("RefuelUpdate", 1000, true, "i", playerid);
RefuelAmount[playerid] = amount;
printf("Refuel amount %d", RefuelAmount[playerid]);
format(string, sizeof(string), "* %s has begun refuelling the %s. *", GetNameEx(playerid), VehicleNames[name]);
ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
return 1;
}