Hallo Community!
Habe eben mein BIZ system anfang fertig gemacht aber wenn ich InGame /createbiz eingebe kommt nix...
enum business{
b_name,
b_besitzer[40],
b_level,
b_epreis,
b_kaufpreis,
b_kasse,
b_interior,
b_pickup,
Float:bx,
Float:by,
Float:bz
}
enum bizinterior{
Float:ix,
Float:iy,
Float:iz,
binterior
}
new bInfo[200][business];
new bInterior[][bizinterior] = {
{-2159.122802,641.517517,1052.381713,1},
{2169.461181,1618.798339,999.976562,1}
};
#define MAX_BIZ 200
new inBiz[MAX_PLAYERS] = -1;
OnGameModelInit
//Business
for(new biz=1;biz<MAX_BIZ;biz++)
{
LadeBiz(biz);
}
printf("bInfo[1][b_besitzer]");
OnGameModeexit:
for(new biz=1;biz<MAX_BIZ;biz++)
{
KillBiz(biz);
}
OnPlayerDisConnected
inBiz[playerid] = -1;
//Business
ocmd:createbiz(playerid,params[])
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
CreateBiz(x,y,z,"Keiner",100,2,0);
return 1;
}
ocmd:kaufen(playerid,params[])
{
for(new biz=1;biz<MAX_BIZ;biz++)
{
if(IsPlayerInRangeOfPoint(playerid,5,bInfo[biz][bx],bInfo[biz][by],bInfo[biz][bz]))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof name);
if(strcmp(bInfo[biz][b_besitzer],name,false) == 0)return SendClientMessage(playerid,0x00FF00,"Dieses Haus gehört dir bereits!");
if(strcmp(bInfo[biz][b_besitzer],"Keiner",false))return SendClientMessage(playerid,0x00FF00,"Dieses Haus steht nicht zum Verkauf!");
if(GetPlayerMoney(playerid) < bInfo[biz][b_kaufpreis])return SendClientMessage(playerid,0x00FF00,"Du hast nicht genug Geld!");
GivePlayerMoney(playerid,-bInfo[biz][b_kaufpreis]);
new pfad[50];
format(pfad,50,"/biz/%d.txt",biz);
dini_Set(pfad,"besitzer",name);
KillBiz(biz);
LadeBiz(biz);
}
}
return 1;
}
ocmd:enter(playerid,params[])
{
for(new biz=1;biz<MAX_BIZ;biz++)
{
if(IsPlayerInRangeOfPoint(playerid,5,bInfo[biz][bx],bInfo[biz][by],bInfo[biz][bz]))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof name);
if(strcmp(bInfo[biz][b_besitzer],name,false) == 0)
{
new innenraum = bInfo[biz][b_interior];
SetPlayerPos(playerid,bInterior[innenraum][ix],bInterior[innenraum][iy],bInterior[innenraum][iz]);
SetPlayerInterior(playerid,bInterior[innenraum][binterior]);
inBiz[playerid] = biz;
}
else SendClientMessage(playerid,0x00FF00,"Du bist nicht der Besitzer! Du darfst hier nicht rein!");
}
}
return 1;
}
ocmd:exit(playerid,params[])
{
if(inBiz[playerid] == -1)return SendClientMessage(playerid,0x00FF00,"Du bist in keinem Haus!");
new biz = inBiz[playerid];
new innenraum = bInfo[biz][b_interior];
if(!IsPlayerInRangeOfPoint(playerid,5,bInterior[innenraum][ix],bInterior[innenraum][iy],bInterior[innenraum][iz]))return SendClientMessage(playerid,0x00FF00,"Du bist nicht am Ausgang!");
SetPlayerPos(playerid,bInfo[biz][bx],bInfo[biz][by],bInfo[biz][bz]);
SetPlayerInterior(playerid,0);
SendClientMessage(playerid,0x00FF00,"Du hast das Biz verlassen!");
inBiz[playerid] = -1;
return 1;
}
OnPlayerPickupPickup
for(new i=1;i<MAX_BIZ;i++)
{
if(bInfo[i][b_pickup] == pickupid)
{
new string[128];
format(string,sizeof(string),"Besitzer: %s\nPreis: %d\nLevel: %d",bInfo[i][b_besitzer],bInfo[i][b_kaufpreis],bInfo[i][b_level]);
Create3DTextLabel(string,GRAU,bInfo[i][bx],bInfo[i][by],bInfo[i][bz],20.0,0,1);
}
stock CreateBiz(Float:x,Float:y,Float:z,besitzer[40],preis,level,interior)
{
new pfad[64];
for(new biz; biz<MAX_BIZ; biz++)
{
format(pfad,sizeof(pfad),"/Biz/%d.txt",biz);
if(!fexist(pfad))
{
dini_Create(pfad);
dini_FloatSet(pfad,"x",x);
dini_FloatSet(pfad,"y",y);
dini_FloatSet(pfad,"z",z);
dini_IntSet(pfad,"preis",preis);
dini_Set(pfad,"besitzer",besitzer);
dini_IntSet(pfad,"level",level);
dini_IntSet(pfad,"interior",interior);
return LadeBiz(biz);
}
}
return 0;
}
stock LadeBiz(bizid)
{
new pfad[64];
format(pfad,50,"/biz/%d.txt",bizid);
if(!fexist(pfad))return 0;
bInfo[bizid][bx] = dini_Float(pfad,"x");
bInfo[bizid][by] = dini_Float(pfad,"y");
bInfo[bizid][bz] = dini_Float(pfad,"z");
bInfo[bizid][b_kaufpreis] = dini_Int(pfad,"preis");
format(bInfo[bizid][b_besitzer],40,"%s",dini_Get(pfad,"besitzer"));
bInfo[bizid][b_level] = dini_Int(pfad,"level");
bInfo[bizid][b_interior] = dini_Int(pfad,"interior");
bInfo[bizid][b_pickup] = CreatePickup(1272,1,bInfo[bizid][bx],bInfo[bizid][by],bInfo[bizid][bz],0);
return print("Das Business wurde erfolgreich geladen");
}
stock KillBiz(bizid)
{
return DestroyPickup(bInfo[bizid][b_pickup]);
}