20.05.2015, 11:02
YCMD command error
Код:
YCMD:cbizz(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_GREY, "You aren't authorized to use this command!");//Checks if player is a RCON admin..Change this with your admin system.
new price, level, id, int, world, string[128], Float:Xi, Float:Yi, Float:Zi, inti;//All the new defines we will need.
if(sscanf(params, "dddfff", price, level, inti, Xi, Yi, Zi)) return SendClientMessage(playerid, COLOR_GREY, "YCMD: /cbizz [price] [type] [interior] [X] [Y] [Z]");//d stands for integer, f stands for float.
if(level < 0 || level > 4) return SendClientMessage(playerid, COLOR_GREY, "YCMD: Type cannot go below 0, or above 10.");//
if(price < 10000) return SendClientMessage(playerid, COLOR_GREY, "YCMD: Price cannot go below $10,000.");// Check if the price is below 1000, if it is it will return a message saying it.
for(new h = 1;h < sizeof(BusinessInfo);h++)//Loops through all the businesses
{
if(BusinessInfo[h][bizzPrice] == 0)//Checks if the price of a business is 0.
{
id = h;
break;//It stops looping if it is.
}
}
new Float:X,Float:Y,Float:Z,Float:A;//More new defines.
GetPlayerPos(playerid, X, Y, Z);//Gets your player position, and saves it into floats.
GetPlayerFacingAngle(playerid, A);//Gets your facing angle, and saves it into a float.
int = GetPlayerInterior(playerid);//Gets your interior, and saves it into a integer.
world = GetPlayerVirtualWorld(playerid);//Gets your Virtual World, and saves it into a integer
BusinessInfo[id][bizzInsideInt] = inti;
BusinessInfo[id][bizzExitX] = Xi;
BusinessInfo[id][bizzExitY] = Yi;
BusinessInfo[id][bizzExitZ] = Zi;
BusinessInfo[id][bizzOwned] = 0;
BusinessInfo[id][bizzPrice] = price;
BusinessInfo[id][bizzType] = level;
BusinessInfo[id][bizzEntranceX] = X;
BusinessInfo[id][bizzEntranceY] = Y;
BusinessInfo[id][bizzEntranceZ] = Z;
BusinessInfo[id][bizzEntranceA] = A;
BusinessInfo[id][bizzLocked] = 1;
BusinessInfo[id][bizzInt] =int;
BusinessInfo[id][bizzWorld] =world;
BusinessInfo[id][bizzInsideWorld] =id;
format(string, sizeof(string), "None");
strmid(BusinessInfo[id][bizzName], string, 0, strlen(string), 255);
if(BusinessInfo[id][bizzOutsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bizzOutsideIcon]);
if(BusinessInfo[id][bizzInsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bizzInsideIcon]);
BusinessInfo[id][bizzOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[id][bizzEntranceX], BusinessInfo[id][bizzEntranceY], BusinessInfo[id][bizzEntranceZ], BusinessInfo[id][bizzWorld]);//Creates a pickup at your location
BusinessInfo[id][bizzInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[id][bizzExitX], BusinessInfo[id][bizzExitY], BusinessInfo[id][bizzExitZ], BusinessInfo[id][bizzInsideWorld]);//Creates a pickup at your location
new file4[40];
format(file4, sizeof(file4), BPATH, id);
new INI:File = INI_Open(file4);
INI_SetTag(File,"data");
INI_WriteInt(File,"bOwned", BusinessInfo[id][bizzOwned]);
INI_WriteInt(File,"bPrice", BusinessInfo[id][bizzPrice]);
INI_WriteString(File,"bOwner", BusinessInfo[id][bizzOwner]);
INI_WriteInt(File,"bType", BusinessInfo[id][bizzType]);
INI_WriteInt(File,"bLocked", BusinessInfo[id][bizzLocked]);
INI_WriteInt(File,"bMoney", BusinessInfo[id][bizzMoney]);
INI_WriteFloat(File,"bEntranceX", BusinessInfo[id][bizzEntranceX]);
INI_WriteFloat(File,"bEntranceY", BusinessInfo[id][bizzEntranceY]);
INI_WriteFloat(File,"bEntranceZ", BusinessInfo[id][bizzEntranceZ]);
INI_WriteFloat(File,"bEntranceA", BusinessInfo[id][bizzEntranceA]);
INI_WriteFloat(File,"bExitX", BusinessInfo[id][bizzExitX]);
INI_WriteFloat(File,"bExitY", BusinessInfo[id][bizzExitY]);
INI_WriteFloat(File,"bExitZ", BusinessInfo[id][bizzExitZ]);
INI_WriteFloat(File,"bExitA", BusinessInfo[id][bizzExitA]);
INI_WriteInt(File,"bInt", BusinessInfo[id][bizzInt]);
INI_WriteInt(File,"bWorld", BusinessInfo[id][bizzWorld]);
INI_WriteInt(File,"bInsideInt", BusinessInfo[id][bizzInsideInt]);
INI_WriteInt(File,"bInsideWorld", BusinessInfo[id][bizzInsideWorld]);
INI_WriteString(File,"bName", BusinessInfo[id][bizzName]);
INI_Close(File);
return 1;
}


