public AracBenzin()
{
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
new vehicleid;
if((vehicleid = GetPlayerVehicleID(playerid)) && aBenzin[playerid] != INVALID_BAR_ID)
{
SetProgressBarValue(aBenzin[vehicleid], Fuel);
UpdateProgressBar(aBenzin[playerid], playerid);
}
}
}
|
Point out the exact line? Where does "Fuel" come from? More information please?
We are not psychic, a little more information always helps. EDIT: Ok I just had to find the "include"(I had expected you to use a third party library for the progress bars). The "Fuel" variable has to be a float, if it is not declared as such, well there you have it. |
new Float:Fuel[MAX_VEHICLES] = {100.0, ...};
enum pInfo
{
pPass,
pCash,
pAdmin,
pLevel,
pExp,
pSex,
pAge,
Float:pPos_x,
Float:pPos_y,
Float:pPos_z,
pSkin,
pJob,
pFaction,
pRank,
pAccent,
pInterior,
pVW,
pDriveLic,
pBankaHesap,
pVIP,
pTDefter,
pNumber,
pAclik,
pQuiz
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new levelcost = 25000;
new levelexp = 4;
new ScoreOld;
new ghour = 0;
new realtime = 1;
new timeshift = -1;
new shifthour;
new ntimer[MAX_PLAYERS];
new adds = 1;
new gNews[MAX_PLAYERS];
new Sirenf;
new Text:Textdraw1;
new Text:Textdraw2;
new Bar:aCan[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
new Bar:aBenzin[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
forward AracHasar();
forward AracBenzin();
new Bar:aBenzin[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
SetProgressBarValue(aBenzin[vehicleid], Fuel); // Notice how fuel has no index?
public AracBenzin()
{
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
new vehicleid;
if((vehicleid = GetPlayerVehicleID(playerid)) && aBenzin[playerid] != INVALID_BAR_ID)
{
SetProgressBarValue(aBenzin[vehicleid]/* This isn't right is it? It's supposed to be playerid */, Fuel /* which fuel? Fuel is an array but you didn't specify any index here? shouldnt you reference the array to a specific index? */);
UpdateProgressBar(aBenzin[playerid], playerid);
}
}
}
|
Код:
new Bar:aBenzin[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
Код:
SetProgressBarValue(aBenzin[vehicleid], Fuel); // Notice how fuel has no index? I think that should be the mistake. You still havent told me what line the error is on so I can't know for sure. EDIT 2: pawn Код:
|
public AracBenzin()
{
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
new vehicleid;
if((vehicleid = GetPlayerVehicleID(playerid)) && aBenzin[playerid] != INVALID_BAR_ID)
{
SetProgressBarValue(aBenzin[playerid]/* This isn't right is it? It's supposed to be playerid */, Float:Fuel /* which fuel? Fuel is an array but you didn't specify any index here? shouldnt you reference the array to a specific index? */);
UpdateProgressBar(aBenzin[playerid], playerid);
}
}
}
public AracBenzin()
{
// Here you begin to loop through all players I guess you understand that the code below repeats each time.
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
new vehicleid;
// here you fetch the vehicleid the player is in and make sure that the progress bar has been created for that player
if((vehicleid = GetPlayerVehicleID(playerid)) && aBenzin[playerid] != INVALID_BAR_ID)
{
// Here you change the progress bar of the >VEHICLEID< to an ARRAY without index. This line is the actual error!
SetProgressBarValue(aBenzin[vehicleid], Fuel);
UpdateProgressBar(aBenzin[playerid], playerid);
}
}
}
new Bar:aBenzin[MAX_PLAYERS];
SetProgressBarValue(aBenzin[vehicleid], Fuel);
new Bar:aBenzin[MAX_PLAYERS];
// Here you begin to loop through all players I guess you understand that the code below repeats each time.
for(new playerid; playerid < MAX_PLAYERS; playerid++)
SetProgressBarValue(aBenzin[playerid], Fuel);
new Fuel[MAX_VEHICLES] = {100,...};
if((vehicleid = GetPlayerVehicleID(playerid)) && aBenzin[playerid] != INVALID_BAR_ID)
SetProgressBarValue(aBenzin[playerid], Fuel[vehicleid]);
#include <a_samp>
#include <progress>
new Bar:aCan[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
new Bar:aBenzin[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
forward AracHasar();
forward AracBenzin();
public OnFilterScriptInit()
{
SetTimer("AracHasar", 500, 1);
SetTimer("AracBenzin", 500, 1);
return 1;
}
public AracHasar()
{
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
new vehicleid;
if((vehicleid = GetPlayerVehicleID(playerid)) && aCan[playerid] != INVALID_BAR_ID)
{
new Float:health;
GetVehicleHealth(vehicleid, health);
SetProgressBarValue(aCan[playerid], health);
UpdateProgressBar(aCan[playerid], playerid);
}
}
}
public AracBenzin()
{
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
// new vehicleid;
// if((vehicleid = GetPlayerVehicleID(playerid)) && aCan[playerid] != INVALID_BAR_ID)
{
new Float:Fuel;
SetProgressBarValue(aBenzin[playerid], Fuel);
UpdateProgressBar(aBenzin[playerid], playerid);
}
}
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_DRIVER)
{
DestroyProgressBar(aCan[playerid]);
aCan[playerid] = INVALID_BAR_ID;
DestroyProgressBar(aBenzin[playerid]);
aBenzin[playerid] = INVALID_BAR_ID;
}
if(newstate == PLAYER_STATE_DRIVER)
{
aCan[playerid] = CreateProgressBar(502.00, 397.00, 102.50, 3.20, -132901633, 1000.0);
aBenzin[playerid] = CreateProgressBar(502.00, 418.00, 102.50, 3.20, 161022207, 100.0);
ShowProgressBarForPlayer(playerid, aCan[playerid]);
ShowProgressBarForPlayer(playerid, aBenzin[playerid]);
}
return 1;
}
SetProgressBarValue(aBenzin[playerid], Fuel[vehicleid]);