16.10.2011, 18:49
Hello
I'm making a serverhop system and I ran into some big complications...
Ok so I made an enum and an array, in wich I store all the items that the player can buy...
look:
simple...
Next I made a little command that pops up a list dialog
ok now the special thing about this is
that all the items that u have bought yet are displayed on top of the list in sexygreen
then all the items that u haven't bought so far are under all the displayed sexygreen yet bought items
in white...
now as you can see, every item has 2 lines in the list
line 1: "item name"
line 2: "item price"
so line 1 in the box is f.e 'free armour'
and line in the box should be the price of free arour...
when I go in my server and type /servershop
I get this beautifull list box, just like it should be...
The last thing I had to do was making the response for the dialog
and here I got some trouble...
I need it that when the player hits a green one (already bought item) he gets a message that he has already bought the item.
and when he hits a white one he must get a message that he will recieve the item(just to test)
so f.e when the player hits our line one thingy he will get a message that he has already bought the item
when he hits line too he will get the same message since it is a part of line one...
so on the response I had to create that line 2 is part of line 1, and line 4 part of line 3 and so on...
and here I failed...
this is what I made:
I thought this would work but it didn't
for every even list item 1 got the you cannot buy shop items twice message and every ineven item gave me the proceeded message...
Can anyone help me that when a player hits line 2 it's part of line 1, and line 4 part of line 3, and so on
thanks in advance...
rep++ for helpers
I'm making a serverhop system and I ran into some big complications...
Ok so I made an enum and an array, in wich I store all the items that the player can buy...
look:
pawn Код:
enum Shops
{
shop_name[500],
shop_costmoney,
shop_costscore,
shop_reward[500],
shop_unlocked[MAX_PLAYERS]
}
new ServerShop[10][Shops]=
{
{"No more speeding control", 150000, 10 , "You have bought 'No More Speeding Control' you cannot be caught by speedtraps no more!", 0},
{"Instant Level 2", 100000, 0 , "You have bought 'Instant Level 2' and you are now Level 2 (120 score)", 1},
{"Instant Level 3", 200000, 0 , "You have bought 'Instant Level 3' and you are now Level 3 (180 score)", 0},
{"Save Deathpos", 500000, 50 , "You have bought 'Save Deathpos' and you will be auto spawned to your death pos when you!", 1},
{"10 Score", 25000, 0 , "You have bought 10 score points", 1},
{"50 Score", 100000, 0, "You have bought 50 score points", 1},
{"100 Score", 1750000, 0 , "You have bought 100 score points", 0},
{"Free Weather", 10000, 5 , "You have bought Free Weather and u can now use /fweather to chose ur weather!", 0},
{"Auto Armour", 50000, 7 , "You have bought 'Auto Armour' and u can now use the command: /auto armour once every 10 minuts", 1},
{"Auto Health", 750000, 12 , "You have bought 'Auto Armour' and u can now use the command: /autp health once every 10 minuts", 0}//removed the ',' here too
};
Next I made a little command that pops up a list dialog
pawn Код:
if ( !strcmp( "/servershop", cmdtext, true, 11 ) )
{
for(new i; i<sizeof ServerShop ; i++)
{
if(ServerShop[i][shop_unlocked][playerid] == 1)
{
format(shop1, sizeof(shop1), "%s{FFFF00}| {00FF00}-%s \n{FFFF00}| \t{00FF00}Already Bought\n",shop1,ServerShop[i][shop_name]);
sAvCount[playerid] = i;
}else
format(shop2, sizeof(shop2), "%s{FFFF00}| {FFFFFF}-%s \n{FFFF00}| \t{FFFFFF}%i Money{FFFF00}\n",shop2,ServerShop[i][shop_name], ServerShop[i][shop_costmoney]);
}
format(shop3, sizeof(shop3), "%s%s",shop1,shop2);
ShowPlayerDialog(playerid,72,DIALOG_STYLE_LIST,"{E4FF47}Server Shop", shop3 ,"Select", "Cancel");
return 1;
}
that all the items that u have bought yet are displayed on top of the list in sexygreen
then all the items that u haven't bought so far are under all the displayed sexygreen yet bought items
in white...
now as you can see, every item has 2 lines in the list
line 1: "item name"
line 2: "item price"
so line 1 in the box is f.e 'free armour'
and line in the box should be the price of free arour...
when I go in my server and type /servershop
I get this beautifull list box, just like it should be...
The last thing I had to do was making the response for the dialog
and here I got some trouble...
I need it that when the player hits a green one (already bought item) he gets a message that he has already bought the item.
and when he hits a white one he must get a message that he will recieve the item(just to test)
so f.e when the player hits our line one thingy he will get a message that he has already bought the item
when he hits line too he will get the same message since it is a part of line one...
so on the response I had to create that line 2 is part of line 1, and line 4 part of line 3 and so on...
and here I failed...
this is what I made:
pawn Код:
if(dialogid == 72)
{
if(!response) return 1;
new index = 0;
if(!isEven(listitem))
return index = listitem - 1;
if(ServerShop[index][shop_unlocked][playerid] == 0)
return SendClientMessage(playerid,COLOR_RED,"*You cannot buy shop items twice!");
else
return SendClientMessage(playerid,COLOR_SEXYGREEN,"*Proceeded");
}
for every even list item 1 got the you cannot buy shop items twice message and every ineven item gave me the proceeded message...
Can anyone help me that when a player hits line 2 it's part of line 1, and line 4 part of line 3, and so on
thanks in advance...
rep++ for helpers