(1197) : error 035: argument type mismatch (argument 2) (1214) : error 035: argument type mismatch (argument 1) (1215) : error 035: argument type mismatch (argument 1) (1220) : error 035: argument type mismatch (argument 1) (1221) : error 035: argument type mismatch (argument 1) (1225) : error 035: argument type mismatch (argument 1) (1226) : error 035: argument type mismatch (argument 1)
Line 1197 SetProgressBarValue(gGas[playerid], gas); Lines 1214 and up public BenzinUpdate() { for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { new vehicle = GetPlayerVehicleID(i); if(IsPlayerInAnyVehicle(i) == 1) { if(gGas[vehicle] >= 0 && gGas[vehicle] <= 3) { SetProgressBarValue(gas, 0.0); ShowProgressBarForAll(gas); TogglePlayerControllable(i, 0); } else if(gGas[vehicle] >= 0 && gGas[vehicle] <= 10) { SetProgressBarValue(gas, 10.0); ShowProgressBarForAll(gas); } else if(gGas[vehicle] >= 10 && gGas[vehicle] <= 20) { SetProgressBarValue(gas, 20.0); ShowProgressBarForAll(gas); } else if(gGas[vehicle] >= 20 && gGas[vehicle] <= 30) { SetProgressBarValue(gas, 30.0); ShowProgressBarForAll(gas); } else if(gGas[vehicle] >= 30 && gGas[vehicle] <= 40) { SetProgressBarValue(gas, 40.0); ShowProgressBarForAll(gas); } else if(gGas[vehicle] >= 40 && gGas[vehicle] <= 50) { SetProgressBarValue(gas, 50.0); ShowProgressBarForAll(gas); } else if(gGas[vehicle] >= 50 && gGas[vehicle] <= 60) { SetProgressBarValue(gas, 60.0); ShowProgressBarForAll(gas); } else if(gGas[vehicle] >= 60 && gGas[vehicle] <= 70) { SetProgressBarValue(gas, 70.0); ShowProgressBarForAll(gas); } else if(gGas[vehicle] >= 70 && gGas[vehicle] <= 80) { SetProgressBarValue(gas, 80.0); ShowProgressBarForAll(gas); } else if(gGas[vehicle] >= 80 && gGas[vehicle] <= 90) { SetProgressBarValue(gas, 90.0); ShowProgressBarForAll(gas); } else if(gGas[vehicle] >= 90 && gGas[vehicle] <= 100) { SetProgressBarValue(gas, 100.0); ShowProgressBarForAll(gas); } } } } return 1; }
SetProgressBarValue(gas, 0.0);
//or
if(gGas[vehicle] >= 0 && gGas[vehicle] <= 3)
#define LoopVehicles(%1) for(new %1=0; %1<MAX_VEHICLES; %1++)
public BenzinUpdate()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
LoopVehicles(a) {
new vehicle = GetPlayerVehicleID(i);
if(IsPlayerInAnyVehicle(i) == 1)
{
if(gGas[vehicle] >= 0 && gGas[vehicle] <= 3)
{
SetProgressBarValue(gas, 0.0);
ShowProgressBarForAll(gas);
TogglePlayerControllable(i, 0);
}
else if(gGas[vehicle] >= 0 && gGas[vehicle] <= 10)
{
SetProgressBarValue(gas, 10.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 10 && gGas[vehicle] <= 20)
{
SetProgressBarValue(gas, 20.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 20 && gGas[vehicle] <= 30)
{
SetProgressBarValue(gas, 30.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 30 && gGas[vehicle] <= 40)
{
SetProgressBarValue(gas, 40.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 40 && gGas[vehicle] <= 50)
{
SetProgressBarValue(gas, 50.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 50 && gGas[vehicle] <= 60)
{
SetProgressBarValue(gas, 60.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 60 && gGas[vehicle] <= 70)
{
SetProgressBarValue(gas, 70.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 70 && gGas[vehicle] <= 80)
{
SetProgressBarValue(gas, 80.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 80 && gGas[vehicle] <= 90)
{
SetProgressBarValue(gas, 90.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 90 && gGas[vehicle] <= 100)
{
SetProgressBarValue(gas, 100.0);
ShowProgressBarForAll(gas);
}
}
}
}
}
return 1;
}
SetProgressBarValue(gas, 0.0);
new bar:gGas[MAX_PLAYERS];
Isn't the second argument supposed to be an integer value not a floating/fixed point value? If i remember correctly its an integer. (not sure havn't used that include in a while)
EDIT: Also you must declare the bar variable with the bar indentifier eg, pawn Код:
|
I've never used that include although can you give me a code that links to gas?
and where the variable is created. |
new Bar:gas[MAX_PLAYERS] = {INVALID_BAR_ID, ...}; public ProgressBar() { for(new playerid; playerid < MAX_PLAYERS; playerid++) { new vehicleid; if((vehicleid = GetPlayerVehicleID(playerid)) && gGas[playerid] != INVALID_BAR_ID) { CheckGas(vehicleid, gGas); SetProgressBarValue(playerid, gas); UpdateProgressBar(gas[playerid], playerid); } } } if(newstate == PLAYER_STATE_DRIVER) { gas[playerid] = CreateProgressBar(50.0, 300.0, _, _, 0xFF0000FF, 100.0); ShowProgressBarForPlayer(playerid, gas[playerid]);
That does nothing but give me an "gGas is already defined" error.
pawn Код:
|
public ProgressBar()
{
new vehicleid;
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
vehicleid = GetPlayerVehicleID(playerid);
if(gas[playerid] != INVALID_BAR_ID)
{
CheckGas(vehicleid, gGas);
SetProgressBarValue(gas[playerid], 100);// this must be set to a value not a bar id change 100 for the fuel variable
UpdateProgressBar(gas[playerid], playerid);
}
}
}