15.10.2011, 11:47
Hello, I'm creating a simple servershop system where you can buy some stuff that gives u advantages on my server...
ofcourse this is not that hard, but I wanna make it a bit professional, so instead of just doing: if(listitem == 1)
then SetPlayerMoney++
or something, no...
I'm making that u have a list of stuff to buy, and when u already bought something it turns green
else its just white...
ok so I have this enum to make easy buyable stuff(achievements in this case)
ok as u can see theres:
I do this to check if the player has already bought the shop item...
then the command to show the shop:
but I get these errors:
error line: [look at the code]
thanks in advance
ofcourse this is not that hard, but I wanna make it a bit professional, so instead of just doing: if(listitem == 1)
then SetPlayerMoney++
or something, no...
I'm making that u have a list of stuff to buy, and when u already bought something it turns green
else its just white...
ok so I have this enum to make easy buyable stuff(achievements in this case)
pawn Код:
enum Shops
{
shop_name[500],
shop_costmoney,
shop_costscore,
shop_reward[500],
shop_unlocked[MAX_PLAYERS],
}
new ServerShop[1][Shops]=
{
{"No more speeding control", 150000, 10 , "You have bought 'No More Speeding Control' you cannot be caught by speedtraps no more!", 0}
};
pawn Код:
shop_unlocked[MAX_PLAYERS],
then the command to show the shop:
pawn Код:
if ( !strcmp( "/servershop", cmdtext, true, 11 ) )
{
for(new i; i<sizeof ServerShop ; i++)
{
if(ServerShop[i][shop_unlocked[playerid]] == 0]) //Error line
{
format(string, sizeof(string), "{00FF00}%s \n\t{00FF00}Already Bought",ServerShop[i][shop_name], ServerShop[i][shop_costmoney], ServerShop[i][shop_costscore]);
ShowPlayerDialog(playerid,72,DIALOG_STYLE_LIST,"{E4FF47}Server Shop", string ,"Select", "Cancel");
}
else if(ServerShop[i][shop_unlocked[playerid]] == 1])
{
format(string, sizeof(string), "{FFFFFF}%s \n\t{FFFFFF}%i Money\n\t{FFFFFF}%i Score",ServerShop[i][shop_name], ServerShop[i][shop_costmoney], ServerShop[i][shop_costscore]);
ShowPlayerDialog(playerid,72,DIALOG_STYLE_LIST,"{E4FF47}Server Shop", string ,"Select", "Cancel");
}
return 1;
}
}
Код:
C:\Users\William\Documents\Famous' World\Famous' World\gamemodes\Famous.pwn(3835) : error 028: invalid subscript (not an array or too many subscripts): "shop_unlocked" C:\Users\William\Documents\Famous' World\Famous' World\gamemodes\Famous.pwn(3835) : warning 215: expression has no effect C:\Users\William\Documents\Famous' World\Famous' World\gamemodes\Famous.pwn(3835) : error 001: expected token: ";", but found "]" C:\Users\William\Documents\Famous' World\Famous' World\gamemodes\Famous.pwn(3835) : error 029: invalid expression, assumed zero C:\Users\William\Documents\Famous' World\Famous' World\gamemodes\Famous.pwn(3835) : fatal error 107: too many error messages on one line
thanks in advance


