Hallo,
Ich hab leider Probleme mit dem Autohaussystem das Problem ist wenn ich ein Autohaus erstelle das es erst nach restart ein PickUp da ist, Ich habe es schon versucht etwas umzuschreiben aber leider finde ich den Fehler nicht.
Bitte ich bräuchte hilfe wenn ihr noch Code braucht sagt es mir ruhig
ocmd@2:ccd,createcardealer(playerid,params[])
{
new name[32],price,level,Float:xPos[3];
if(pInfo[playerid][pAdmin] != 5)return 1;
if(sscanf(params,"dds[32]",price,level,name))return SendClientMessage(playerid,COLOR_GREY,"Benutze: /ccd [Preis] [Level] [Name]");
for(new i;i<MAX_AUTOHAUS;i++) {
if(AHInfo[i][zCreated])continue;
new str[256];
GetPlayerPos(playerid,xPos[0],xPos[1],xPos[2]);
format(str,sizeof str,"INSERT INTO `cardealers` (`Owner`, `PosX`, `PosY`, `PosZ`, `Name`, `Price`, `Level`, `LPosX`, `LPosY`, `LPosZ`, `cbought`) VALUES ('Niemand', '%f', '%f', '%f', '%s', '%d', '%d', '%f', '%f', '%f', '%f')",xPos[0],xPos[1],xPos[2],name,price,level,xPos[0],xPos[1],xPos[2],cbought);
mysql_pquery(dbHandle,str);
format(str,256,"SELECT * FROM `cardealers` WHERE `ID` = '%d'",i);
return mysql_pquery(dbHandle,str,"OnQueryFinish","sd",str,QuerySelectAllCarDealers);
}
return 1;
}
for(new i;i<MAX_AUTOHAUS;i++) {
if(!AHInfo[i][zCreated])continue;
if(IsPlayerInRangeOfPoint(playerid,3,AHInfo[i][zPosX],AHInfo[i][zPosY],AHInfo[i][zPosZ]))
{
if((!strcmp(AHInfo[i][zOwner],"Niemand",true)))
{
if(pInfo[playerid][pMoney] >= AHInfo[i][zPrice])
{
if(GetPlayerScore(playerid) >= AHInfo[i][zLevel])
{
new q[128];
GetPlayerName(playerid,sendername,sizeof sendername);
pInfo[playerid][pMoney] -= AHInfo[i][zPrice];
pInfo[playerid][pAH] = i+1;
format(AHInfo[i][zOwner],24,"%s",sendername);
SendClientMessage(playerid,COLOR_LIGHTGREEN,"Du hast dir das Autohaus erfolgreich gekauft!");
SendClientMessage(playerid,COLOR_GREY,"Autohaus verwalten: /cardealer");
KillCarDealer(i);
format(q,128,"SELECT * FROM `cardealers` WHERE `ID` = '%d'",i+1);
return mysql_pquery(dbHandle,q,"OnQueryFinish","sd",q,QueryCallCarDealer);
}
else
{
return SendClientMessage(playerid,COLOR_LIGHTRED,"Dein Level reicht nicht aus, um dieses Autohaus zu kaufen!");
}
}
else
{
return SendClientMessage(playerid,COLOR_LIGHTRED,"Du hast nicht genug Geld, um dieses Autohaus zu kaufen!");
}
}
else
{
return SendClientMessage(playerid,COLOR_LIGHTRED,"Dieses Autohaus ist nicht zu verkaufen!");
}
}
}
case QueryCallCarDealer:
{
cache_get_data(rows,fields);
printf("CallCarDealer Rows: %d",rows);
if(rows == 1) {
for(new i;i<MAX_AUTOHAUS;i++) {
if(AHInfo[i][zCreated])continue;
cache_get_field_content(0,"ID",result);
AHInfo[i][zID] = strval(result);
cache_get_field_content(0,"Owner",result);
format(AHInfo[i][zOwner],32,"%s",result);
cache_get_field_content(0,"PosX",result);
AHInfo[i][zPosX] = floatstr(result);
cache_get_field_content(0,"PosY",result);
AHInfo[i][zPosY] = floatstr(result);
cache_get_field_content(0,"PosZ",result);
AHInfo[i][zPosZ] = floatstr(result);
cache_get_field_content(0,"Bank",result);
AHInfo[i][zBank] = strval(result);
cache_get_field_content(0,"Name",result);
format(AHInfo[i][zName],24,"%s",result);
cache_get_field_content(0,"Price",result);
AHInfo[i][zPrice] = strval(result);
cache_get_field_content(0,"Level",result);
AHInfo[i][zLevel] = strval(result);
cache_get_field_content(0,"OrderCap",result);
AHInfo[i][zOrderCap] = strval(result);
cache_get_field_content(0,"StoreCap",result);
AHInfo[i][zStoreCap] = strval(result);
cache_get_field_content(0,"LPosX",result);
AHInfo[i][zLPosX] = floatstr(result);
cache_get_field_content(0,"LPosY",result);
AHInfo[i][zLPosY] = floatstr(result);
cache_get_field_content(0,"LPosZ",result);
AHInfo[i][zLPosZ] = floatstr(result);
cache_get_field_content(0,"LPosA",result);
AHInfo[i][zLPosA] = floatstr(result);
if(AHInfo[i][cbought] == 0)
{
AHInfo[i][zPickup]=CreatePickup(1273,1,AHInfo[i][zPosX],AHInfo[i][zPosY],AHInfo[i][zPosZ],0);
format(str,128,"** %s **\n Besitzer: %s\n Dieses Autohaus ist zu verkaufen!\nPreis: %s€\nLevel: %d\nAutohaus kaufen: /buy",AHInfo[i][zName],AHInfo[i][zOwner],inspoints(AHInfo[i][zPrice]),AHInfo[i][zLevel]);
AHInfo[i][zLabel]=Create3DTextLabel(str,COLOR_AHLABEL,AHInfo[i][zPosX],AHInfo[i][zPosY],AHInfo[i][zPosZ],20,0,1);
}
else
{
AHInfo[i][zPickup]=CreatePickup(1272,1,AHInfo[i][zPosX],AHInfo[i][zPosY],AHInfo[i][zPosZ],0);
format(str,128,"** %s **\nBesitzer: %s",AHInfo[i][zName],AHInfo[i][zOwner]);
AHInfo[i][zLabel]=Create3DTextLabel(str,COLOR_AHLABEL,AHInfo[i][zPosX],AHInfo[i][zPosY],AHInfo[i][zPosZ],20,0,1);
}
return AHInfo[i][zCreated] = true;
}
}
}
case QuerySelectAllCarDealers:
{
cache_get_data(rows,fields);
if(rows > 0 && rows < 6) {
oldtime=GetTickCount();
new idx,string[128];
for(;idx<rows;idx++) {
cache_get_field_content(idx,"ID",result);
AHInfo[idx][zID] = strval(result);
cache_get_field_content(idx,"Owner",result);
format(AHInfo[idx][zOwner],32,"%s",result);
cache_get_field_content(idx,"PosX",result);
AHInfo[idx][zPosX] = floatstr(result);
cache_get_field_content(idx,"PosY",result);
AHInfo[idx][zPosY] = floatstr(result);
cache_get_field_content(idx,"PosZ",result);
AHInfo[idx][zPosZ] = floatstr(result);
cache_get_field_content(idx,"Bank",result);
AHInfo[idx][zBank] = strval(result);
cache_get_field_content(idx,"Name",result);
format(AHInfo[idx][zName],24,"%s",result);
cache_get_field_content(idx,"Price",result);
AHInfo[idx][zPrice] = strval(result);
cache_get_field_content(idx,"Level",result);
AHInfo[idx][zLevel] = strval(result);
cache_get_field_content(idx,"OrderCap",result);
AHInfo[idx][zOrderCap] = strval(result);
cache_get_field_content(idx,"StoreCap",result);
AHInfo[idx][zStoreCap] = strval(result);
cache_get_field_content(idx,"LPosX",result);
AHInfo[idx][zLPosX] = floatstr(result);
cache_get_field_content(idx,"LPosY",result);
AHInfo[idx][zLPosY] = floatstr(result);
cache_get_field_content(idx,"LPosZ",result);
AHInfo[idx][zLPosZ] = floatstr(result);
cache_get_field_content(idx,"LPosA",result);
AHInfo[idx][zLPosA] = floatstr(result);
if(AHInfo[idx][cbought] == 0)
{
AHInfo[idx][zPickup]=CreatePickup(1273,1,AHInfo[idx][zPosX],AHInfo[idx][zPosY],AHInfo[idx][zPosZ],0);
format(string,128,"** %s **\nBesitzer: %s \n Dieses Autohaus ist zu verkaufen!\nPreis: %s€\nLevel: %d\nAutohaus kaufen: /buy",AHInfo[idx][zName],AHInfo[idx][zOwner],inspoints(AHInfo[idx][zPrice]),AHInfo[idx][zLevel]);
AHInfo[idx][zLabel]=Create3DTextLabel(string,COLOR_AHLABEL,AHInfo[idx][zPosX],AHInfo[idx][zPosY],AHInfo[idx][zPosZ],20,0,1);
AHInfo[idx][zCreated] = true;
}
else
{
AHInfo[idx][zPickup]=CreatePickup(1272,1,AHInfo[idx][zPosX],AHInfo[idx][zPosY],AHInfo[idx][zPosZ],0);
format(string,128,"** %s **\nBesitzer: %s",AHInfo[idx][zName],AHInfo[idx][zOwner]);
AHInfo[idx][zLabel]=Create3DTextLabel(string,COLOR_AHLABEL,AHInfo[idx][zPosX],AHInfo[idx][zPosY],AHInfo[idx][zPosZ],20,0,1);
AHInfo[idx][zCreated] = true;
}
}
printf("<-| [MYSQL-LOAD] Es wurden %d Autohäuser geladen - Dauer: %dms",rows,GetTickCount()-oldtime);
}
}
//push 3.02.2016