Код:
CMD:setcomp(playerid, params[])
{
new string[128];
if(PlayerInfo[playerid][pAdmin] >= 99999)
{
new id = SpawnedCompany+1;
if(id >= MAX_FAMILY)
{
SCME( playerid, COLOR_WHITE, "Too many Company are currently spawned!");
}
format( string, sizeof( string ), "Company/%d.ini", id);
if(dini_Exists(string))
{
SpawnedCompany++;
format( string, sizeof( string ), "Company (ID: %d) already exist!", id);
SCME( playerid, COLOR_GREY, string);
SCME( playerid, COLOR_YELLOW, "Please try again by typing /setcomp complete" );
}
else
{
dini_Create(string);
CompanyInfo[id][PriceStone] = 0;
SaveCompany(id);
SpawnedCompany++;
format(string, sizeof( string ), "ID Company baru: %d | EDIT DAHULU :3", id);
SCME(playerid, COLOR_WHITE, string);
}
}
else
{
SCME( playerid, COLOR_GREY, "You are not authorized to use this command!" );
}
return 1;
}
Код:
CMD:editcomp(playerid, params[])
{
new choice[800], id, string[800], x;
if( sscanf( params, "ds[128]d", id,choice,x) )
{
if( PlayerInfo[playerid][pAdmin] >= 99999)
{
SCME( playerid, COLOR_WHITE, "USAGE: /editcomp [id] [type] [amount] || Type :Owner, RockPrice" );
}
}
else
{
if( PlayerInfo[playerid][pAdmin] >= 99999)
{
format( string, sizeof( string ), "Company/%d.ini", id);
if(!dini_Exists(string))
{
SCME( playerid, COLOR_GREY, "Invalid Company ID!" );
return 1;
}
else
{
if(strcmp(choice,"owner",true) == 0)
{
if(!IsPlayerConnected(x)) return SCME(playerid, COLOR_WHITE,"Player tidak online.");
PlayerInfo[x][pCompMember] = id;
PlayerInfo[x][pCompLeader] = id;
SFM(x, COLOR_WHITE,"Anda telah dijadikan owner perusahaan ID %d oleh admin %s.", id, pName(playerid));
SFM(playerid, COLOR_LIGHTBLUE,"Anda telah menjadikan %s sebagai owner perusahaan ID %d.", pName(x), id);
format(CompanyInfo[id][Owner], 255, "%s", pName(x)); //{00FFFF}[id: %d]\n{FFFF00}%s\n{FFFFFF}Tekan '{FF0000}Enter{FFFFFF}' atau '{FF0000}F{FFFFFF}' untuk masuk
format(string, sizeof(string),"[Office]\n%s\nOwner: %s\n{FFFFFF}Tekan '{FF0000}Enter{FFFFFF}' atau '{FF0000}F{FFFFFF}' untuk masuk",CompanyInfo[id][Name],CompanyInfo[id][Owner]);
UpdateDynamic3DTextLabelText(office[id], COLOR_WHITE, string);
SaveCompany(id);
}
else if(strcmp(choice,"rockprice",true) == 0)
{
CompanyInfo[id][PriceStone] = x;
format(string, sizeof(string),"[Warehouse]\nMilik Perusahaan\n%s\nHarga Pembelian $%s/kg\nIsi: %d/2000\n{C0C0C0}/storerock untuk menjual hasil tambang anda disini",CompanyInfo[id][Name],FormatMoney(CompanyInfo[id][PriceStone]),CompanyInfo[id][Storage]);
UpdateDynamic3DTextLabelText(storage[id], COLOR_WHITE, string);
}
else
{
return 0;
}
}
}
}
return 1;
}