06.08.2013, 16:55
hello am having a issue with my script i been trying to fix this issue for 3 days now and i cant seem to fix it so am gonna need good help with it everytime i buyfuel from a gas station or a vehicle the money goes down and backup again i am not using any anti cheat system or anything if you needing any code parts please let me know.
this is one of them whenever i buy it the money drops & goes back up again
am not sure if this is needed but showing you it anyways just in case if this might be the issue
this is one of them whenever i buy it the money drops & goes back up again
Код:
public MainTimer() { new string[128]; new Float:x, Float:y, Float:z; for(new i=0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(GetPlayerState(i) == PLAYER_STATE_DRIVER) { new vehicleid = GetPlayerVehicleID(i); if(!IsBicycle(vehicleid) && Fuel[vehicleid] > 0) { Fuel[vehicleid] -= GetPlayerSpeed(i)/1000.0; if(Fuel[vehicleid] <= 0) { ToggleEngine(vehicleid, VEHICLE_PARAMS_OFF); GameTextForPlayer(i, "~r~out of fuel", 3000, 3); SendClientMessage(i, COLOR_RED, "This vehicle is out of fuel!"); } } } if(RefuelTime[i] > 0 && GetPVarInt(i, "FuelStation")) { new vehicleid = GetPlayerVehicleID(i); Fuel[vehicleid] += 2.0; RefuelTime[i]--; if(RefuelTime[i] == 0) { if(Fuel[vehicleid] >= 100.0) Fuel[vehicleid] = 100.0; new stationid = GetPVarInt(i, "FuelStation"); new cost = floatround(Fuel[vehicleid]-GetPVarFloat(i, "Fuel"))*FUEL_PRICE; if(GetPlayerState(i) != PLAYER_STATE_DRIVER || Fuel[vehicleid] >= 100.0 || GetPlayerMoney(i) < cost || !IsPlayerInRangeOfPoint(i, 10.0, FuelStationPos[stationid][0], FuelStationPos[stationid][1], FuelStationPos[stationid][2])) { if(GetPlayerMoney(i) < cost) cost = GetPlayerMoney(i); GivePlayerMoney(i, -cost); format(string, sizeof(string), "~r~-$%d", cost); GameTextForPlayer(i, string, 2000, 3); format(string, sizeof(string), "You pay $%d for fuel", cost); SendClientMessage(i, COLOR_WHITE, string); SetPVarInt(i, "FuelStation", 0); SetPVarFloat(i, "Fuel", 0.0); } else { RefuelTime[i] = 5; format(string, sizeof(string), "~w~refueling...~n~~r~-$%d", cost); GameTextForPlayer(i, string, 2000, 3); } } } if(TrackCar[i]) { GetVehiclePos(TrackCar[i], x, y, z); SetPlayerCheckpoint(i, x, y, z, 3); } } } }
Код:
stock SetPlayerMoney(playerid) { GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]-GetPlayerMoney(playerid)); return 1; }