Undefined symbol "playerid"
#1

Hi, I'am getting a Undefined Symbol "playerid" on these lines?

Код:
				
format(erpstring, sizeof(erpstring), "%.2f GAL", VehicleFuel[vehicleid]);
TextDrawSetString(FuelText[playerid],erpstring);
Thanks
Reply
#2

What callback did you place that code under?
Reply
#3

Show the full code. The problem is playerid is not defined.
Reply
#4

please post the full code.
and the problem is that playerid is not defined
Reply
#5

This is the full code:

Код:
Timer:FuelUpdate[15000](playerid)
{
    new engine,lights,alarm,doors,bonnet,boot,objective,modelid;
    for(new v = 0; v < MAX_VEHICLES; v++) if(GetVehicleModel(v)) {

		modelid = GetVehicleModel(v);
	    GetVehicleParamsEx(v,engine,lights,alarm,doors,bonnet,boot,objective);
		switch(modelid) {
			case 520, 476, 593, 553, 513, 512, 577, 592, 511, 539, 464, 519: VehicleFuel[v] = 100;
			case 509, 481, 510: VehicleFuel[v] = 100, arr_Engine{v} = 1, SetVehicleParamsEx(v,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
		}
	    if(engine == VEHICLE_PARAMS_ON) {
			if(VehicleFuel[v] > 0.0 && !IsVIPcar(v) && !IsATruckerCar(v))
			{
				VehicleFuel[v]-=0.01;
				format(erpstring, sizeof(erpstring), "%.2f GAL", VehicleFuel[vehicleid]);
				TextDrawSetString(FuelText[playerid],erpstring);
			}
	      }
	   }
	}
Reply
#6

How about this ?
pawn Код:
Timer:FuelUpdate[15000]()
{
    new engine,lights,alarm,doors,bonnet,boot,objective,modelid;
    for(new v = 0; v < MAX_VEHICLES; v++) if(GetVehicleModel(v))
    {

        modelid = GetVehicleModel(v);
        GetVehicleParamsEx(v,engine,lights,alarm,doors,bonnet,boot,objective);
        switch(modelid) {
            case 520, 476, 593, 553, 513, 512, 577, 592, 511, 539, 464, 519: VehicleFuel[v] = 100;
            case 509, 481, 510: VehicleFuel[v] = 100, arr_Engine{v} = 1, SetVehicleParamsEx(v,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        }
        if(engine == VEHICLE_PARAMS_ON) {
            if(VehicleFuel[v] > 0.0 && !IsVIPcar(v) && !IsATruckerCar(v))
            {
                VehicleFuel[v]-=0.01;
                format(erpstring, sizeof(erpstring), "%.2f GAL", VehicleFuel[v]);
                for(new i = 0; i < MAX_PLAYERS; i++) {
                    if(IsPlayerInAnyVehicle(i)) {
                        if(GetPlayerVehicleID(i) == v)
                        {
                            TextDrawSetString(FuelText[i],erpstring);
                        }
                    }
                }
          }
    }
}
Reply
#7

Just add
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
                {
                      if(IsPlayerInAnyVehicle(i)) //if he is in vehicle
                     {
                            if(GetPlayerVehicleID(i) == v) //if his car is with fuel
                           {
                                       format(erpstring, sizeof(erpstring), "%.2f GAL", VehicleFuel[vehicleid]);
                                                   TextDrawSetString(FuelText[i],erpstring);
                           }
                     }
                }
Under:
pawn Код:
if(VehicleFuel[v] > 0.0 && !IsVIPcar(v) && !IsATruckerCar(v))
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)