05.03.2017, 01:40
Try this please
Код:
COMMAND:buystore(playerid, params[]) { foreach(new i : Stores) { if(Store[i][StoreOwner] == pData[playerid][RealID]) return Message(playerid, COLOR_RED, "You can't buy more stores"); } if(GetPlayerScore(playerid) >= 1000) { new i, bool:found = false; if(sscanf(params, "d", i)) return Usage(playerid, "buystore [storeid]"); foreach(new x : Stores) { if(Store[x][StoreID] == i) { i = x; found = true; break; } } if(!found) return 1; if(!Store[i][StoreOwner]) { if(Store[i][StorePrice] == 1337) return 1; if(GetPlayerMoney(playerid) >= Store[i][StorePrice]) { GivePlayerMoney(playerid, -Store[i][StorePrice]); Store[i][StoreOwner] = pData[playerid][RealID]; Message(playerid, COLOR_GREEN, "You bought %s for $%m, use /storemenu while inside store to access store menu", Store[i][StoreName], Store[i][StorePrice]); new label[256]; format(label, 256, "{FF0000}[%s]\n{FFFFFF}{FFFF66}ID: {FFFFFF}%d\n{FFFF66}Owner: {FFFFFF}%d\n{FFFF66}Price: {FFFFFF}$%m\n{FFFF66}Level: {FFFFFF}%d\n{FFFF66}$%m per gameday", Store[i][StoreName], Store[i][StoreID], playerid, Store[i][StorePrice], Store[i][StoreLevel], CountMoneyPerDay(i)); UpdateDynamic3DTextLabelText(Store[i][StoreEnterLabel], -1, label); mysql_format(connectionHandle, label, 256, "UPDATE store SET owner = %d WHERE id = %d", pData[playerid][RealID], Store[i][StoreID]); mysql_query(connectionHandle, label, false); } else Message(playerid, COLOR_RED, "Not enough money to buy this store"); } else Message(playerid, COLOR_RED, "This store is owned"); } else Message(playerid, COLOR_RED, "You must have 1000 score or more as a requirement to buy any store"); return 1; }