31.01.2013, 00:38
I am making a server that is related to the fallout game series, so I have added some features such as hunger, thirst, and radiation. I am using the progress bar include to represent those values. The hunger and thirst values work fine, but the radiation one doesn't work right. What I'm trying to script is that the bar will start out as 9% (since 0% appears behind the bar) and raises when you eat irradiated food or drinks along with an admin command that will set your radiation level. The problem is that it won't go up at all. If I eat irradiated food, it doesn't go up, if I drink irradiated drinks, it doesn't go up, and even if I try setting the value, it doesn't go up. Here's the code that I have so far.
Near the top of the script.
I have a enum titled pData with Radiation being one of the values.
/setradiation command code:
This is located under OnPlayerUpdate:
Since I have a sql saving system, I have this line for the radiation:
Along with that, I have a format(query, sizeof(query) line with the radiation value in it as:
And this is apart of the saving stats system:
This is the line that makes the progress bar:
When a player registers, this is what the variable is suppose to be set to by default:
I hope you understand what I'm saying here, but I'm just asking this:
How do I make it so that the radiation bar starts at zero and work perfectly?
Near the top of the script.
Код:
new PlayerBar:PlayerRadiation[MAX_PLAYERS];
Код:
Radiation
Код:
CMD:setradiation(playerid, params[]) { if(Player[playerid][AdminLevel] >= 1) { new id, amount, string[128]; if(sscanf(params, "ud", id, amount))return SendClientMessage(playerid, GREY, "Command Usage: /setradiation [playerid] [amount]"); { Player[id][Radiation] = amount; format(string, sizeof(string), "You have set {FFFFFF}%s's {FF0000}radiation level to {00FF00}%d.", GetName(id), amount); SendClientMessage(playerid, RED, string); format(string, sizeof(string), "Admin {FFFFFF}%s {FF0000}has set your radiation level to {00FF00}%d.", GetName(playerid), amount); SendClientMessage(id, RED, string); } } else return SendClientMessage(playerid, GREY, "You are not an administrator."); return 1; }
Код:
SetPlayerProgressBarValue(playerid, PlayerRadiation[playerid], Player[playerid][Radiation]); UpdatePlayerProgressBar(playerid, PlayerRadiation[playerid]);
Код:
mysql_fetch_field_row(savingstring, "radiation"); Player[playerid][Radiation] = strval(savingstring);
Код:
`radiation` = %d
Код:
Player[playerid][Radiation],
Код:
PlayerRadiation[playerid] = CreatePlayerProgressBar(playerid, 560.000000, 30.000000, 35, 7.5, YELLOW, 100.0);//Want that to be 9, but for now I just have it at 100 ShowPlayerProgressBar(playerid, PlayerRadiation[playerid]);//Makes the progress bar show up.
Код:
Player[playerid][Radiation] = 9;
How do I make it so that the radiation bar starts at zero and work perfectly?