05.11.2011, 10:07
Hey guys!
Im about to finish my full script ...
Now I just added the bizz system ...
Here it is ...( if u copy it , u should feel shitty !)
on game mode in it LoadBiz();
and "sbiz" command that uses the SaveBiz();
A timer witch saves the biz every 5 seconds ...
bla bla bla
Okey so here is the problem..
When I create thie bizzes everything is okey !
the 3Dtexctlabels with the biz info are showing up ... the pickups are showing up ... the buy and sell biz commands are working okey !
now when i use a command to save the bizzes every thing is okey , when I close my server and load it again , the biz pickups are showing up , but the 3dtextlabels arent !
I need help , please
Im about to finish my full script ...
Now I just added the bizz system ...
Here it is ...( if u copy it , u should feel shitty !)
pawn Код:
enum bInfo
{
bOwned,
bName[128],
Float:bExteriorX,
Float:bExteriorY,
Float:bExteriorZ,
bMoney,
bPickupID,
Text3D: bTextID,
bValue,
bOwner[MAX_PLAYER_NAME],
bMoney2,
bCreatePickup,
bCreatedAlready,
};
new BizInfo[MAX_BIZ][bInfo];
pawn Код:
SaveBiz() {
new szFileStr[1024],File:fHandle = fopen("bizzes.cfg",io_write);
for(new iIndex; iIndex < MAX_BIZ; iIndex++)
{
format(szFileStr,sizeof(szFileStr),"%d|%s|%f|%f|%f|%d|%d|%d|%d|%s|%d\r\n",
BizInfo[iIndex][bOwned],
BizInfo[iIndex][bName],
BizInfo[iIndex][bExteriorX],
BizInfo[iIndex][bExteriorY],
BizInfo[iIndex][bExteriorZ],
BizInfo[iIndex][bMoney],
BizInfo[iIndex][bMoney2],
BizInfo[iIndex][bPickupID],
BizInfo[iIndex][bValue],
BizInfo[iIndex][bOwner],
BizInfo[iIndex][bCreatedAlready]
);
fwrite(fHandle, szFileStr);
}
return fclose(fHandle);
}
LoadBiz() {
if(!fexist("bizzes.cfg")) return 1;
new szFileStr[1024],File:iFileHandle = fopen("bizzes.cfg",io_read),iIndex;
while(iIndex < sizeof(BizInfo) && fread(iFileHandle,szFileStr)){
sscanf(szFileStr,"p<|>ds[32]fffdddds[128]d",
BizInfo[iIndex][bOwned],
BizInfo[iIndex][bName],
BizInfo[iIndex][bExteriorX],
BizInfo[iIndex][bExteriorY],
BizInfo[iIndex][bExteriorZ],
BizInfo[iIndex][bMoney],
BizInfo[iIndex][bMoney2],
BizInfo[iIndex][bPickupID],
BizInfo[iIndex][bValue],
BizInfo[iIndex][bOwner],
BizInfo[iIndex][bCreatedAlready]
);
if(BizInfo[iIndex][bCreatedAlready] == 1)
{
Delete3DTextLabel(BizInfo[iIndex][bTextID]);
DestroyDynamicPickup(BizInfo[iIndex][bCreatePickup]);
}
new Str[1024];
if(BizInfo[iIndex][bOwned] == 1)
{
format(Str,sizeof(Str),"This bizz is owned by %s \n Bizz name : %s",BizInfo[iIndex][bOwner],BizInfo[iIndex][bName]);
}else{
format(Str,sizeof(Str),"This bizz is for sale ! \n Bizz price : %d \n Bizz name : %s \n Paycheck bonus : %d-%d",BizInfo[iIndex][bValue],BizInfo[iIndex][bName],BizInfo[iIndex][bMoney],BizInfo[iIndex][bMoney2]);
}
BizInfo[iIndex][bCreatePickup] = CreateDynamicPickup(BizInfo[iIndex][bPickupID],1,BizInfo[iIndex][bExteriorX],BizInfo[iIndex][bExteriorY],BizInfo[iIndex][bExteriorZ],0,0,-1,40.0);
BizInfo[iIndex][bTextID] = Create3DTextLabel(Str,COLOR_YELLOW,BizInfo[iIndex][bExteriorX],BizInfo[iIndex][bExteriorY],BizInfo[iIndex][bExteriorZ],30.0,0,0);
++iIndex;
}
return fclose(iFileHandle);
}
pawn Код:
CMD:createbiz(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 4)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
return 1;
}
new bizid,value,payprice1,payprice2,bzname[128],string[256],pkid;
if(!sscanf(params,"dddds[128]d",bizid,value,payprice1,payprice2,bzname,pkid))
{
if(bizid < 0 || bizid > MAX_BIZ)
{
format(string,sizeof(string),"Biz ID must be from 0 till %d",MAX_BIZ);
SendClientMessage(playerid,COLOR_YELLOW,string);
return 1;
}
if(payprice1 > payprice2) return SendClientMessage(playerid,COLOR_WHITE,"Minimum price cant be higher then the maximum price ! FOOL !");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
BizInfo[bizid][bOwned] = 0;
format( BizInfo[bizid], 128, "Nobody" );
format( BizInfo[bizid], 128, "%s",bzname);
BizInfo[bizid][bExteriorX] = X;
BizInfo[bizid][bExteriorY] = Y;
BizInfo[bizid][bExteriorZ] = Z;
BizInfo[bizid][bMoney] = payprice1;
BizInfo[bizid][bMoney2] = payprice2;
BizInfo[bizid][bPickupID] = pkid;
BizInfo[bizid][bValue] = value;
SendClientMessageEx(playerid,COLOR_YELLOW,"Bizz created !");
if(BizInfo[bizid][bCreatedAlready] != 1) { BizInfo[bizid][bCreatedAlready] = 1; }
SaveBiz();
LoadBiz();
}else return SendClientMessageEx(playerid,COLOR_WHITE,"USAGE: /createbiz [bizid] [value] [min-paycheckprice] [max-paycheckprice] [biz name] [pickup model]");
return 1;
}
and "sbiz" command that uses the SaveBiz();
A timer witch saves the biz every 5 seconds ...
bla bla bla
Okey so here is the problem..
When I create thie bizzes everything is okey !
the 3Dtexctlabels with the biz info are showing up ... the pickups are showing up ... the buy and sell biz commands are working okey !
now when i use a command to save the bizzes every thing is okey , when I close my server and load it again , the biz pickups are showing up , but the 3dtextlabels arent !
I need help , please