PHP код:
CMD:createbp(playerid, params[])
{
new string[128];
if(PlayerInfo[playerid][pAdmin] >= 99999)
{
new NewBPID = SpawnedBlackMarket+1;
if(NewBPID >= MAX_BLACKMARKET)
{
SendClientMessageEx( playerid, COLOR_WHITE, "Too many MPs are currently spawned!");
}
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
format( string, sizeof( string ), "Black Market/BP_%d.ini", NewBPID);
if(dini_Exists(string))
{
SpawnedBlackMarket++;
format( string, sizeof( string ), "Map (ID: %d) already exist!", NewBPID);
SendClientMessageEx( playerid, COLOR_GREY, string);
SendClientMessageEx( playerid, COLOR_YELLOW, "Please try again by typing /createbp complete" );
}
else
{
new bex[128];
BlackMarketInfo[NewBPID][BPX] = x;
BlackMarketInfo[NewBPID][BPY] = y;
BlackMarketInfo[NewBPID][BPZ] = z;
dini_Create(string);
for(new c; c < MAX_BMITEMS; c++)
{
BMItemsInfo[NewBPID][c][Price] = 0;
BMItemsInfo[NewBPID][c][ExDate] = 999;
BMItemsInfo[NewBPID][c][ExYear] = 9999;
BMItemsInfo[NewBPID][c][GunAmmo] = 0;
BMItemsInfo[NewBPID][c][GunID] = 0;
format(BMItemsInfo[NewBPID][c][Owner], 255, "None");
format(bex, sizeof(bex), "Price%d", c);
dini_Set(string, bex, BMItemsInfo[NewBPID][c][Price]);
format(bex, sizeof(bex), "Date%d", c);
dini_Set(string, bex, BMItemsInfo[NewBPID][c][ExDate]);
format(bex, sizeof(bex), "Year%d", c);
dini_Set(string, bex, BMItemsInfo[NewBPID][c][ExYear]);
format(bex, sizeof(bex), "GunID%d", c);
dini_Set(string, bex, BMItemsInfo[NewBPID][c][GunID]);
format(bex, sizeof(bex), "GunAmmo%d", c);
dini_Set(string, bex, BMItemsInfo[NewBPID][c][GunAmmo]);
format(bex, sizeof(bex), "Owner%d", c);
dini_Set(string, bex, BMItemsInfo[NewBPID][c][Owner]);
}
dini_FloatSet( string, "X", BlackMarketInfo[NewBPID][BPX]);
dini_FloatSet( string, "Y", BlackMarketInfo[NewBPID][BPY]);
dini_FloatSet( string, "Z", BlackMarketInfo[NewBPID][BPZ]);
SpawnedBlackMarket++;
format(string, sizeof(string), "{FFFF00}[Black Market ID %d]\n{FFFFFF}/blackmarket untuk membuka opsi", NewBPID);
blackmarket[NewBPID] = CreateStreamed3DTextLabel(string, COLOR_GREEN, BlackMarketInfo[NewBPID][BPX], BlackMarketInfo[NewBPID][BPY], BlackMarketInfo[NewBPID][BPZ], 10.0, 0);
SendClientMessageEx( playerid, COLOR_LIGHTBLUE, "Black Market berhasil dibuat!" );
BlackMarketInfo[NewBPID][Pickup] = CreateDynamicPickup(1239, 23, BlackMarketInfo[NewBPID][BPX], BlackMarketInfo[NewBPID][BPY], BlackMarketInfo[NewBPID][BPZ], -1, -1, -1, 10.0);
BlackMarketInfo[NewBPID][CP] = CreateDynamicCP(BlackMarketInfo[NewBPID][BPX], BlackMarketInfo[NewBPID][BPY],BlackMarketInfo[NewBPID][BPZ], 2, 0, 0, -1, 8.0);
format(string, sizeof( string ), "ID Black Market baru: %d.", NewBPID);
SendClientMessageEx(playerid, COLOR_WHITE, string);
}
}
else
{
SendClientMessageEx( playerid, COLOR_GREY, "You are not authorized to use this command!" );
}
return 1;
}
If it's on its own, you should use another name for that one, and go through and change the CP references which aren't part of this section, or the enum.
It's almost like you've made one syatem, then added another and used the same variable names without thinking.
but its not a Um good practice. add the CP option inside BlackMarket enum as Sew_Sumi said and remove the different CP variable.