12.04.2013, 22:01
when i /refuel when i have a ticket its fine but if i dont i pay with cash and i get charged 0$ whats wrong with it?
here is the full cmd
here is the full cmd
pawn Код:
if(strcmp(cmd, "/refuel", true) == 0 || strcmp(cmd, "/fuel", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(PInfo[playerid][Tickets] > 0)
{
new id = GetPlayerVehicleID(playerid);
vfuel[id] = 100;
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(id, 1, lights, alarm, doors, bonnet, boot, objective);
PInfo[playerid][Tickets]=PInfo[playerid][Tickets]-1;
format(string,sizeof(string),"You have used a ticket and refueled your vehicle for free! [{FF9900}%d {FFFFFF}tickets remaining]",PInfo[playerid][Tickets]);
GameTextForPlayer(playerid, "~w~Ticket Spent", 4000, 3);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(IsAtGasStation(playerid))
{
new id = GetPlayerVehicleID(playerid);
new Fuel = vfuel[id];
if(Fuel == 100)
{
SendClientMessage(playerid, COLOR_ERROR, "Your vehicle already has a full tank of fuel!");
GameTextForPlayer(playerid, "~w~Vehicle Full Refueled.", 4000, 3);
return 1;
}
new Total;
Total = 100-Fuel;
Total = Total*55;
if(PInfo[playerid][Vip] == 1) { Total=Total/100; Total=Total*75; }
if(PInfo[playerid][AdminLevel] != 0) { Total=Total/100; Total=Total*0; }
if(PInfo[playerid][Money] < Total)
{
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to refuel your vehicle!");
return 1;
}
PInfo[playerid][Money] = PInfo[playerid][Money]-Total;
GivePlayerMoney(playerid, -Total);
format(string,sizeof(string),"You have refueled your vehicle for a total of {FF9900}$%d.", Total);
SendClientMessage(playerid, COLOR_WHITE, string);
new amtearn[24];
format(amtearn,sizeof(amtearn),"-$%d", Total);
GameTextCostumeForPlayer(playerid,amtearn,3,2,COLOR_ERROR); //style 2, 3 seconds, $1,250 (text)!
vfuel[id] = 100;
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(id, 1, lights, alarm, doors, bonnet, boot, objective);
PayLog(PlayerName(playerid), Total, "Refueled Vehicle", "Server", "N/A");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "You are not at a refueling zone! (Refueling zones are at a few main airports)");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "You are not in a vehicle !");
return 1;
}
}