13.01.2019, 14:45
I've been checking for like one hour now, but still can't figure out what I did whrong here.
I scripted a refuel command, if you don't have a fuel can.. it'll check if you're near a pump.
If you're near a pump and don't have a vehicle it checks if u got a gas can to refuel. Also if ur not near a pump it'll check if u have a gas can and near an owned vehicle.
But when I get IG, It just keeps saying you don't have a fuel can. :O
I scripted a refuel command, if you don't have a fuel can.. it'll check if you're near a pump.
If you're near a pump and don't have a vehicle it checks if u got a gas can to refuel. Also if ur not near a pump it'll check if u have a gas can and near an owned vehicle.
But when I get IG, It just keeps saying you don't have a fuel can. :O
Code:
CMD:refuel(playerid, params[]) { if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFC800FF,"SERVER: You can not refuel a vehicle from the inside."); new engine, lights, alarm, doors, bonnet, boot, objective; new veh = GetClosestVehicle(playerid, 5.0); if(IsPlayerInRangeOfPoint(playerid, 5.0, 572.5297+11400,-2759.7271-10000,13.9872) && IsPlayerInRangeOfPoint(playerid, 5.0, 12368.1885,-11937.6396,5.5338) && IsPlayerInRangeOfPoint(playerid, 5.0, 12368.8154,-11943.2422,5.5425) && IsPlayerInRangeOfPoint(playerid, 5.0, 12371.4863,-11948.7529,5.5312) && IsPlayerInRangeOfPoint(playerid, 5.0, 12365.1885,-11938.9287,5.5332)) { if(!IsPlayerNearAnyVehicle(playerid, 5.0) && PlayerInfo[playerid][pFuelCan] == 1 && PlayerInfo[playerid][pCanFuel] < 100) { SetTimerEx("RefuelingCan2", 20000, 0, "i", playerid); GameTextForPlayer(playerid, "Refueling!", 17000, 1); TogglePlayerControllable(playerid, 0); SetCameraBehindPlayer(playerid); return 1; } if(IsPlayerNearAnyVehicle(playerid, 5.0)) { if(owner[veh] == -1) return ERROR(playerid, "SERVER: You can't refill this vehicle!"); if (fuel[veh] == 100) return SendClientMessage(playerid,0xFFC800FF,"SERVER: You're vehicle is full, you can't refuel it."); GetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(veh, 1, lights, alarm, doors, bonnet, boot, objective); SetTimerEx("Refueling", 20000, 0, "id", playerid, veh); TogglePlayerControllable(playerid, 0); GameTextForPlayer(playerid, "Refueling!", 17000, 1); SetCameraBehindPlayer(playerid); return 1; } } else if(PlayerInfo[playerid][pFuelCan] == 1) { if(PlayerInfo[playerid][pCanFuel] < 1) return SCM(playerid, COLOR_WHITE, "SERVER: Your fuel can is empty, refill it at the gas station."); if(owner[veh] == -1) return ERROR(playerid, "SERVER: You can't refill this vehicle!"); if (fuel[veh] == 100) return SendClientMessage(playerid,0xFFC800FF,"SERVER: You're vehicle is full, you can't refuel it."); GetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(veh, 1, lights, alarm, doors, bonnet, boot, objective); SetTimerEx("RefuelingCan", 20000, 0, "id", playerid, veh); TogglePlayerControllable(playerid, 0); GameTextForPlayer(playerid, "Refueling!", 17000, 1); SetCameraBehindPlayer(playerid); return 1; } else { SCM(playerid, COLOR_WHITE, "SERVER: You need to be near a gas station or have a fuel can in order to use this command."); } new str[128]; format(str, sizeof(str), "%s has issued the /refuel command.", GetName(playerid)); Log("logs/playercmds/veh.log", str); return 1; }