Problem with gas variables.
#2

I couldn't understand hardly anything you were saying. Anyway, the following code has a few (possible) errors:
pawn Код:
public Speed(playerid)
{
if(model != 481 && model != 510 && model != 509)//if not bikes
{
if(vehicleDB[vehicleid][gas] > 2)// if more than 2 gas
{
SetPVarFloat(vehicleid,"PravAfter",vehicleDB[vehicleid][prav]/10000);//Other pvar who i set after prav(vehicle distance).
if(GetPVarFloat(vehicleid,"PravBefore") + GetPVarFloat(playerid,"PravAfter") >= 0.1)
{
vehicleDB[vehicleid][gas] -=0.1;
return 1;
}
SendClientMessage(playerid,COLOR_GREEN,"Before prav has been set");
SetPVarFloat(vehicleid,"PravBefore",vehicleDB[vehicleid][prav]/10000); // Save the float into a player variable
}
}
return 1;
}
How does that code even compile? You never create a vehicleid variable, yet you use it. Another potential flaw is that you mean to, assumed by the comments, set the player's PVar value. However, you set it based on the vehicleid, which may cause a problem if the vehicle ID of the driver does not match the player's ID.

I cannot assist you any further as I just simply cannot understand what you're saying.
Reply


Messages In This Thread
Problem with gas variables. - by budelis - 11.08.2011, 08:34
Re: Problem with gas variables. - by Grim_ - 11.08.2011, 08:41
Re: Problem with gas variables. - by budelis - 11.08.2011, 10:38

Forum Jump:


Users browsing this thread: 1 Guest(s)