01.12.2013, 07:41
cessil, exactly, nothing is wrong with the code but something is wrong with the dialog that's why I'm so frustrated
Since you all still want the code
Realise I printf in the stock? Here's the result. In my word editor, I see it without the * but the forum changed my code, what??
I hope that's enough information, can some one find the problem now?
Since you all still want the code
pawn Код:
if(!strcmp(cmdtext, "/shop", true) && (GetPlayerTeam(playerid) == 0 || GetPlayerTeam(playerid) == 2) && GetGVarInt("RoundStarted") == 1)
{
new Content[5000];
Content = GetHumanShopContentForPlayer(playerid);
ShowPlayerDialog(playerid, 4730, DIALOG_STYLE_LIST, "Human Item Shop", Content, "Buy", "Cancel");
return 1;
}
pawn Код:
stock GetHumanShopContentForPlayer(playerid)
{
new HumanShopDialogContent[5000];
new NewLine[5] = "\n";
new Content[150];
new Query[500];
mysql_format(DB, Query, sizeof(Query), "SELECT * FROM `items` WHERE id=(SELECT MAX(id) FROM `items`)");
mysql_query(DB, Query);
new MAXID = cache_get_field_content_int(0, "id");
new FBT[20];
for(new W = 1; W <= MAXID; W++)
{
mysql_format(DB, Query, sizeof(Query), "SELECT * FROM `items` WHERE id='%i'", W);
mysql_query(DB, Query);
if(cache_get_field_content_int(0, "id"))
{
new WeaponName[250];
cache_get_field_content(0, "name", WeaponName);
if(cache_get_field_content_int(0, "availability") == 2)
{
format(FBT, sizeof(FBT), "(For both teams)");
}
else
{
format(FBT, sizeof(FBT), "\0");
}
if(cache_get_field_content_int(0, "availability") == 0 || cache_get_field_content_int(0, "availability") == 2)
{
if(!cache_get_field_content_int(0, "price_type") && !cache_get_field_content_int(0, "premium_item"))
{
if(GetPVarInt(playerid, "Level") >= cache_get_field_content_int(0, "level_lock") && GetPlayerMoney(playerid) >= cache_get_field_content_int(0, "price"))
{
format(Content, sizeof(Content), "{FFBB00}%s {FF0000}%s{BDBDBD}[$%i]", WeaponName, FBT, cache_get_field_content_int(0, "price"));
}
else
{
format(Content, sizeof(Content), "{7A7A7A}%s {FF0000}%s{BDBDBD}[$%i]", WeaponName, FBT, cache_get_field_content_int(0, "price"));
}
strcat(HumanShopDialogContent, Content);
strcat(HumanShopDialogContent, NewLine);
}
else if(cache_get_field_content_int(0, "price_type") && !cache_get_field_content_int(0, "premium_item"))
{
if(GetPVarInt(playerid, "Level") >= cache_get_field_content_int(0, "level_lock") && GetPVarInt(playerid, "Cash") >= cache_get_field_content_int(0, "price"))
{
format(Content, sizeof(Content), "{32CD32}%s {FF0000}%s{BDBDBD}[%i Cash]", WeaponName, FBT, cache_get_field_content_int(0, "price"));
}
else
{
format(Content, sizeof(Content), "{7A7A7A}%s {FF0000}%s{BDBDBD}[%i Cash]", WeaponName, FBT, cache_get_field_content_int(0, "price"));
}
strcat(HumanShopDialogContent, Content);
strcat(HumanShopDialogContent, NewLine);
}
else if(cache_get_field_content_int(0, "premium_item"))
{
if(!cache_get_field_content_int(0, "price_type"))
{
if(GetPVarInt(playerid, "Level") >= cache_get_field_content_int(0, "level_lock") && GetPlayerMoney(playerid) >= cache_get_field_content_int(0, "price") && GetPVarInt(playerid, "Package") >= 2)
{
format(Content, sizeof(Content), "{FFBB00}%s {FF0000}%s{BDBDBD}[$%i]", WeaponName, FBT, cache_get_field_content_int(0, "price"));
}
else
{
format(Content, sizeof(Content), "{7A7A7A}%s {FF0000}%s{BDBDBD}[$%i]", WeaponName, FBT, cache_get_field_content_int(0, "price"));
}
strcat(HumanShopDialogContent, Content);
strcat(HumanShopDialogContent, NewLine);
}
else if(cache_get_field_content_int(0, "price_type"))
{
if(GetPVarInt(playerid, "Level") >= cache_get_field_content_int(0, "level_lock") && GetPVarInt(playerid, "Cash") >= cache_get_field_content_int(0, "price") && GetPVarInt(playerid, "Package") >= 2)
{
format(Content, sizeof(Content), "{32CD32}%s {FF0000}%s{BDBDBD}[%i Cash]", WeaponName, FBT, cache_get_field_content_int(0, "price"));
}
else
{
format(Content, sizeof(Content), "{7A7A7A}%s {FF0000}%s{BDBDBD}[%i Cash]", WeaponName, FBT, cache_get_field_content_int(0, "price"));
}
strcat(HumanShopDialogContent, Content);
strcat(HumanShopDialogContent, NewLine);
}
}
}
}
}
if(HumanShopDialogContent[0] == EOS)
{
HumanShopDialogContent = "Empty";
}
printf("%s", HumanShopDialogContent);
return HumanShopDialogContent;
}
Код:
[16:34:15] {7A7A7A}Antidote {FF0000}{BDBDBD}[$7000] {7A7A7A}Exploding Bullet {FF0000}{BDBDBD}[250 Cash] {7A7A7A}Fuel {FF0000}{BDBDBD}[$2000] {7A7A7A}Premium Fuel {FF0000}{BDBDBD}[350 Cash] {7A7A7A}Zombie Detector {FF0000}{BDBDBD}[$6000] {7A7A7A}Premium Zombie Detector {FF0000}{BDBDBD}[300 Cash] {7A7A7A}Fire Power Boost LVL 1 {FF0000}{BDBDBD}[$8000] {7A7A7A}Fire Power Boost LVL 2 {FF0000}{BDBDBD}[$10000] {7A7A7A}Fire Power Boost LVL 3 {FF0000}{BDBDBD}[300 Cash] {7A7A7A}Premium Fire Power Boost {FF0000}{BDBDBD}[450 Cash] {7A7A7A}Money Bonus LVL*1 {FF0000}(For both teams){BDBDBD}[$7000] {7A7A7A}Money Bonus LVL 2 {FF0000}(For both teams){BDBDBD}[$9500] {7A7A7A}Money Bonus LVL 3 {FF0000}(For both teams){BDBDBD}[550 Cash] {7A7A7A}Premium Money Bonus {FF0000}(For both teams){BDBDBD}[600 Cash] {7A7A7A}Score Bonus LVL 1 {FF0000}(For both teams){BDBDBD}[$5000] {7A7A7A}Score Bonus LVL 2 {FF0000}(For both teams){BDBDBD}[$6000] {7A7A7A}Score Bonus LVL 3 {FF0000}(For both teams){BDBDBD}[650 Cash] {7A7A7A}Premium Score Bonus {FF0000}(For both teams){BDBDBD}[700 Cash]
I hope that's enough information, can some one find the problem now?