04.03.2014, 18:39
I want to make this command for Admin Rank 99998 + and ShopTechs only only ,but whenever i try to do it it says "You aren't authorized to use this command"
pawn Код:
CMD:bedit(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1339 && PlayerInfo[playerid][pShopTech] == 1)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
return 1;
}
new string[128], choice[32], houseid, amount;
if(sscanf(params, "s[32]dD", choice, houseid, amount))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /bedit [name] [business id] [(Optional)amount]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, CustomInterior, Type (1-3) (Leisure, Consumer, Retail), Level, Price, Delete");
return 1;
}
if(strcmp(choice, "delete", true) == 0)
{
ClearBusiness(houseid);
format(string, sizeof(string), "%s has removed Business ID %d", GetPlayerNameEx(playerid), houseid);
Log("logs/bedit.log", string);
SaveBusinesses();
}
else if(strcmp(choice, "interior", true) == 0)
{
GetPlayerPos(playerid, BizInfo[houseid][bInteriorX], BizInfo[houseid][bInteriorY], BizInfo[houseid][bInteriorZ]);
GetPlayerFacingAngle(playerid, BizInfo[houseid][bInteriorA]);
BizInfo[houseid][bHInteriorWorld] = GetPlayerInterior( playerid );
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the interior!" );
SaveBusinesses();
format(string, sizeof(string), "%s has edited Business ID %d's Interior.", GetPlayerNameEx(playerid), houseid);
Log("logs/bedit.log", string);
return 1;
}
else if(strcmp(choice, "custominterior", true) == 0)
{
if(BizInfo[houseid][bCustomInterior] == 0)
{
BizInfo[houseid][bCustomInterior] = 1;
SendClientMessageEx( playerid, COLOR_WHITE, "House set to custom interior!" );
}
else
{
BizInfo[houseid][bCustomInterior] = 0;
SendClientMessageEx( playerid, COLOR_WHITE, "House set to normal (not custom) interior!" );
}
SaveBusinesses();
format(string, sizeof(string), "%s has edited Business ID %d's Custom Interior.", GetPlayerNameEx(playerid), houseid);
Log("logs/bedit.log", string);
return 1;
}
else if(strcmp(choice, "customexterior", true) == 0)
{
if(BizInfo[houseid][bCustomExterior] == 0)
{
BizInfo[houseid][bCustomExterior] = 1;
SendClientMessageEx( playerid, COLOR_WHITE, "House set to custom exterior!" );
}
else
{
BizInfo[houseid][bCustomExterior] = 0;
SendClientMessageEx( playerid, COLOR_WHITE, "House set to normal (not custom) exterior!" );
}
SaveBusinesses();
format(string, sizeof(string), "%s has edited Business ID %d's Custom Exterior.", GetPlayerNameEx(playerid), houseid);
Log("logs/bedit.log", string);
return 1;
}
else if(strcmp(choice, "exterior", true) == 0)
{
GetPlayerPos(playerid, BizInfo[houseid][bExteriorX], BizInfo[houseid][bExteriorY], BizInfo[houseid][bExteriorZ]);
GetPlayerFacingAngle(playerid, BizInfo[houseid][bExteriorA]);
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the exterior!" );
//DestroyDynamicPickup(BizInfo[houseid][bPickupID]);
SaveBusinesses();
format(string, sizeof(string), "%s has edited Business ID %d's Exterior.", GetPlayerNameEx(playerid), houseid);
Log("logs/bedit.log", string);
if(BizInfo[houseid][bOwned] ==0)
{
DestroyDynamicPickup(BizInfo[houseid][bPickupID]);
DestroyDynamic3DTextLabel(BizInfo[houseid][bTextID]);
format(string, sizeof(string), "This business is\n for sale!\nDescription: %s\nCost: $%d\n Level: %d\nType: %d\nID: %d\nTo buy this business type /buybusiness",BizInfo[houseid][bDescription],BizInfo[houseid][bValue],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
BizInfo[houseid][bTextID] = CreateDynamic3DTextLabel( string, COLOR_LIGHTBLUE, BizInfo[houseid][bExteriorX], BizInfo[houseid][bExteriorY], BizInfo[houseid][bExteriorZ]+0.5,30.0, .testlos = 1, .streamdistance = 30.0);
BizInfo[houseid][bPickupID] = CreateDynamicPickup(1274, 23, BizInfo[houseid][bExteriorX], BizInfo[houseid][bExteriorY], BizInfo[houseid][bExteriorZ]);
}
else
{
DestroyDynamicPickup(BizInfo[houseid][bPickupID]);
DestroyDynamic3DTextLabel(BizInfo[houseid][bTextID]);
format(string, sizeof(string), "This business is owned by\n%s\nDescription: %s\nLevel: %d\nType: %d\nID: %d",BizInfo[houseid][bOwner],BizInfo[houseid][bDescription],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
BizInfo[houseid][bTextID] = CreateDynamic3DTextLabel(string,COLOR_LIGHTBLUE,BizInfo[houseid][bExteriorX], BizInfo[houseid][bExteriorY], BizInfo[houseid][bExteriorZ]+0.5,30.0, .testlos = 1, .streamdistance = 30.0);
BizInfo[houseid][bPickupID] = CreateDynamicPickup(1274, 23, BizInfo[houseid][bExteriorX], BizInfo[houseid][bExteriorY], BizInfo[houseid][bExteriorZ]);
}
SaveBusinesses();
}
else if(strcmp(choice, "level", true) == 0)
{
BizInfo[houseid][bLevel] = amount;
format(string, sizeof(string), "You have set the business level to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(BizInfo[houseid][bOwned] ==0)
{
format(string, sizeof(string), "This business is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nType: %d\nID: %d\nTo buy this business type /buybusiness",BizInfo[houseid][bDescription],BizInfo[houseid][bValue],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
UpdateDynamic3DTextLabelText(BizInfo[houseid][bTextID], COLOR_LIGHTBLUE, string);
}
else
{
format(string, sizeof(string), "This business is owned by\n%s\nDescription: %s\nLevel: %d\nType: %d\nID: %d",BizInfo[houseid][bOwner],BizInfo[houseid][bDescription],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
UpdateDynamic3DTextLabelText(BizInfo[houseid][bTextID], COLOR_LIGHTBLUE, string);
}
format(string, sizeof(string), "%s has edited Business ID %d's Level to %d.", GetPlayerNameEx(playerid), houseid, amount);
Log("logs/bedit.log", string);
SaveBusinesses();
}
else if(strcmp(choice, "price", true) == 0)
{
BizInfo[houseid][bValue] = amount;
format(string, sizeof(string), "You have set the businesses price to $%d.", amount );
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(BizInfo[houseid][bOwned] ==0)
{
format(string, sizeof(string), "This business is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nType: %d\nID: %d\nTo buy this business type /buybusiness",BizInfo[houseid][bDescription],BizInfo[houseid][bValue],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
UpdateDynamic3DTextLabelText(BizInfo[houseid][bTextID], COLOR_LIGHTBLUE, string);
}
format(string, sizeof(string), "%s has edited Business ID %d's Price to $%d.", GetPlayerNameEx(playerid), amount);
Log("logs/bedit.log", string);
SaveBusinesses();
}
else if(strcmp(choice, "type", true) == 0)
{
switch(amount)
{
case 1:
{
BizInfo[houseid][bType] = 1;
SendClientMessageEx(playerid, COLOR_WHITE, "You have set the businesses type to 1 (Leisure)" );
}
case 2:
{
BizInfo[houseid][bType] = 2;
SendClientMessageEx(playerid, COLOR_WHITE, "You have set the businesses type to 2 (Consumer)" );
}
case 3:
{
BizInfo[houseid][bType] = 3;
SendClientMessageEx(playerid, COLOR_WHITE, "You have set the businesses type to 3 (Retail)" );
}
}
if(BizInfo[houseid][bOwned] ==0)
{
format(string, sizeof(string), "This business is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nType: %d\nID: %d\nTo buy this business type /buybusiness",BizInfo[houseid][bDescription],BizInfo[houseid][bValue],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
UpdateDynamic3DTextLabelText(BizInfo[houseid][bTextID], COLOR_LIGHTBLUE, string);
}
format(string, sizeof(string), "%s has edited Business ID %d's Type to %d.", GetPlayerNameEx(playerid), houseid, amount);
Log("logs/bedit.log", string);
SaveBusinesses();
}
SaveBusinesses();
return 1;
}