17.05.2013, 12:55
Hello, im coding a hideout system for my server and everything works. But i have a problem when i create hideouts with /cbase, after i pickup the created pickup, it dissapears and doesn't create anymore. I wanna create a "freezed" pickup, means i don't want destroy it after pickuped:
Hope i explained myself good.
pawn Код:
CMD:cbase(playerid, params[])
{
if(pInfo[playerid][Admin] == 5)
{
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: /createbiz [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(BaseInfo);h++)//Loops through all the businesses
{
if(BaseInfo[h][bPrice] == 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
BaseInfo[id][bInsideInt] = inti;
BaseInfo[id][bExitX] = Xi;
BaseInfo[id][bExitY] = Yi;
BaseInfo[id][bExitZ] = Zi;
BaseInfo[id][bOwned] = 0;
BaseInfo[id][bPrice] = price;
BaseInfo[id][bType] = level;
BaseInfo[id][bEntranceX] = X;
BaseInfo[id][bEntranceY] = Y;
BaseInfo[id][bEntranceZ] = Z;
BaseInfo[id][bEntranceA] = A;
BaseInfo[id][bLocked] = 1;
BaseInfo[id][bInt] =int;
BaseInfo[id][bWorld] =world;
BaseInfo[id][bInsideWorld] =id;
format(string, sizeof(string), "None");
strmid(BaseInfo[id][bName], string, 0, strlen(string), 255);
if(BaseInfo[id][bOutsideIcon]) DestroyDynamicPickup(BaseInfo[id][bOutsideIcon]);
if(BaseInfo[id][bInsideIcon]) DestroyDynamicPickup(BaseInfo[id][bInsideIcon]);
BaseInfo[id][bOutsideIcon] = CreateDynamicPickup(1272, 19, BaseInfo[id][bEntranceX], BaseInfo[id][bEntranceY], BaseInfo[id][bEntranceZ], BaseInfo[id][bWorld]);//Creates a pickup at your location
BaseInfo[id][bInsideIcon] = CreateDynamicPickup(1272, 19, BaseInfo[id][bExitX], BaseInfo[id][bExitY], BaseInfo[id][bExitZ], BaseInfo[id][bInsideWorld]);//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", BaseInfo[id][bOwned]);
INI_WriteInt(File,"bPrice", BaseInfo[id][bPrice]);
INI_WriteString(File,"bOwner", BaseInfo[id][bOwner]);
INI_WriteInt(File,"bType", BaseInfo[id][bType]);
INI_WriteInt(File,"bLocked", BaseInfo[id][bLocked]);
INI_WriteInt(File,"bMoney", BaseInfo[id][bMoney]);
INI_WriteFloat(File,"bEntranceX", BaseInfo[id][bEntranceX]);
INI_WriteFloat(File,"bEntranceY", BaseInfo[id][bEntranceY]);
INI_WriteFloat(File,"bEntranceZ", BaseInfo[id][bEntranceZ]);
INI_WriteFloat(File,"bEntranceA", BaseInfo[id][bEntranceA]);
INI_WriteFloat(File,"bExitX", BaseInfo[id][bExitX]);
INI_WriteFloat(File,"bExitY", BaseInfo[id][bExitY]);
INI_WriteFloat(File,"bExitZ", BaseInfo[id][bExitZ]);
INI_WriteFloat(File,"bExitA", BaseInfo[id][bExitA]);
INI_WriteInt(File,"bInt", BaseInfo[id][bInt]);
INI_WriteInt(File,"bWorld", BaseInfo[id][bWorld]);
INI_WriteInt(File,"bInsideInt", BaseInfo[id][bInsideInt]);
INI_WriteInt(File,"bInsideWorld", BaseInfo[id][bInsideWorld]);
INI_WriteString(File,"bName", BaseInfo[id][bName]);
INI_Close(File);
}
return 1;
}