Guten Abend alle zusammen,
Ich bin dabei ein Tankstellen System zu schreiben und habe folgendes Problem:
Wenn ich den Befehl zum Erstellen der Tankstelle eingebe wird Kein Pickup erstellt und kein Text3dLabel hir der code:
ocmd:createtank(playerid, params[])
{
new Level, Preis,string[128],Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
for(new t = 0; t<sizeof(TankInfo); t++) {
if(IsPlayerAdmin(playerid)) {
new Slot = GetFreeTankstslot();
if(Slot != -1) {
if(sscanf(params,"dd",Level,Preis))return SendClientMessage(playerid,Gelb,"[Benutze]: /createtank [KaufLevel] [KaufPreis]");
TankInfo[Slot][KaufPreis] = Preis;
TankInfo[Slot][KaufLevel] = Level;
TankInfo[Slot][TX] = X;
TankInfo[Slot][TY] = Y;
TankInfo[Slot][TZ] = Z;
mysql_query("INSERT INTO `tankstellen`(`besetzt`) VALUES (1)");
mysql_query("SELECT max(id) FROM `tankstellen`");
mysql_store_result();
mysql_fetch_row_format(string);
UpdateFactionCar(Slot);
CreatePickUpofMap(Slot);
}
}
}
return 1;
}
{
new Level, Preis,string[128],Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
for(new t = 0; t<sizeof(TankInfo); t++) {
if(IsPlayerAdmin(playerid)) {
new Slot = GetFreeTankstslot();
if(Slot != -1) {
if(sscanf(params,"dd",Level,Preis))return SendClientMessage(playerid,Gelb,"[Benutze]: /createtank [KaufLevel] [KaufPreis]");
TankInfo[Slot][KaufPreis] = Preis;
TankInfo[Slot][KaufLevel] = Level;
TankInfo[Slot][TX] = X;
TankInfo[Slot][TY] = Y;
TankInfo[Slot][TZ] = Z;
mysql_query("INSERT INTO `tankstellen`(`besetzt`) VALUES (1)");
mysql_query("SELECT max(id) FROM `tankstellen`");
mysql_store_result();
mysql_fetch_row_format(string);
UpdateFactionCar(Slot);
CreatePickUpofMap(Slot);
}
}
}
return 1;
}
stock GetFreeTankstslot()
{
for(new i = 0; i < sizeof(TankInfo); i++)
{
if(TankInfo[i][fExist]==false)return i;
}
return -1;
}
{
for(new i = 0; i < sizeof(TankInfo); i++)
{
if(TankInfo[i][fExist]==false)return i;
}
return -1;
}
stock LoadTankst()
{
new Load[16], idx;
mysql_query("SELECT * FROM tankstellen");
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_fetch_field_row(Load, "Besitzer");
format(TankInfo[idx][Besitzer],500,Load);
mysql_fetch_field_row(Load, "Erpresser");
format(TankInfo[idx][Erpresser],500,Load);
mysql_fetch_field_row(Load, "Besetzt");
TankInfo[idx][Besetzt] = strval(Load);
mysql_fetch_field_row(Load, "Kasse");
TankInfo[idx][Kasse] = strval(Load);
mysql_fetch_field_row(Load, "X");
TankInfo[idx][TX] = floatstr(Load);
mysql_fetch_field_row(Load, "Y");
TankInfo[idx][TY] = floatstr(Load);
mysql_fetch_field_row(Load, "Z");
TankInfo[idx][TZ] = floatstr(Load);
mysql_fetch_field_row(Load, "TankPreis");
TankInfo[idx][TankPreis] = strval(Load);
mysql_fetch_field_row(Load, "KaufLevel");
TankInfo[idx][KaufLevel] = strval(Load);
mysql_fetch_field_row(Load, "KaufPreis");
TankInfo[idx][KaufPreis] = strval(Load);
mysql_fetch_field_row(Load, "id");
TankInfo[idx][fSQLid] = strval(Load);
CreatePickUpofMap(idx);
idx ++;
}
mysql_free_result();
}
{
new Load[16], idx;
mysql_query("SELECT * FROM tankstellen");
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_fetch_field_row(Load, "Besitzer");
format(TankInfo[idx][Besitzer],500,Load);
mysql_fetch_field_row(Load, "Erpresser");
format(TankInfo[idx][Erpresser],500,Load);
mysql_fetch_field_row(Load, "Besetzt");
TankInfo[idx][Besetzt] = strval(Load);
mysql_fetch_field_row(Load, "Kasse");
TankInfo[idx][Kasse] = strval(Load);
mysql_fetch_field_row(Load, "X");
TankInfo[idx][TX] = floatstr(Load);
mysql_fetch_field_row(Load, "Y");
TankInfo[idx][TY] = floatstr(Load);
mysql_fetch_field_row(Load, "Z");
TankInfo[idx][TZ] = floatstr(Load);
mysql_fetch_field_row(Load, "TankPreis");
TankInfo[idx][TankPreis] = strval(Load);
mysql_fetch_field_row(Load, "KaufLevel");
TankInfo[idx][KaufLevel] = strval(Load);
mysql_fetch_field_row(Load, "KaufPreis");
TankInfo[idx][KaufPreis] = strval(Load);
mysql_fetch_field_row(Load, "id");
TankInfo[idx][fSQLid] = strval(Load);
CreatePickUpofMap(idx);
idx ++;
}
mysql_free_result();
}
stock UpdateFactionCar(id)
{
new Query[128];
if(TankInfo[id][fExist] == true)
{
format(Query, sizeof(Query), "UPDATE tankstellen SET `Kasse` = '%d' WHERE `id` = '%d'", TankInfo[id][Kasse], TankInfo[id][fSQLid]);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE tankstellen SET `X` = '%f' WHERE `id` = '%d'", TankInfo[id][TX], TankInfo[id][fSQLid]);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE tankstellen SET `Y` = '%f' WHERE `id` = '%d'", TankInfo[id][TY], TankInfo[id][fSQLid]);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE tankstellen SET `Z` = '%f' WHERE `id` = '%d'", TankInfo[id][TZ], TankInfo[id][fSQLid]);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE tankstellen SET `TankPreis` = '%d' WHERE `id` = '%d'", TankInfo[id][TankPreis], TankInfo[id][fSQLid]);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE tankstellen SET `KaufLevel` = '%d' WHERE `id` = '%d'", TankInfo[id][KaufLevel], TankInfo[id][fSQLid]);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE tankstellen SET `KaufPreis` = '%d' WHERE `id` = '%d'", TankInfo[id][KaufPreis], TankInfo[id][fSQLid]);
mysql_query(Query);
}
return 1;
}
{
new Query[128];
if(TankInfo[id][fExist] == true)
{
format(Query, sizeof(Query), "UPDATE tankstellen SET `Kasse` = '%d' WHERE `id` = '%d'", TankInfo[id][Kasse], TankInfo[id][fSQLid]);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE tankstellen SET `X` = '%f' WHERE `id` = '%d'", TankInfo[id][TX], TankInfo[id][fSQLid]);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE tankstellen SET `Y` = '%f' WHERE `id` = '%d'", TankInfo[id][TY], TankInfo[id][fSQLid]);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE tankstellen SET `Z` = '%f' WHERE `id` = '%d'", TankInfo[id][TZ], TankInfo[id][fSQLid]);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE tankstellen SET `TankPreis` = '%d' WHERE `id` = '%d'", TankInfo[id][TankPreis], TankInfo[id][fSQLid]);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE tankstellen SET `KaufLevel` = '%d' WHERE `id` = '%d'", TankInfo[id][KaufLevel], TankInfo[id][fSQLid]);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE tankstellen SET `KaufPreis` = '%d' WHERE `id` = '%d'", TankInfo[id][KaufPreis], TankInfo[id][fSQLid]);
mysql_query(Query);
}
return 1;
}
stock CreatePickUpofMap(id)
{
if(TankInfo[id][fExist] == true)
{
new str[128];
TankInfo[id][fPickup] = CreatePickup(1339,2, TankInfo[id][TX], TankInfo[id][TY], TankInfo[id][TZ],0);
if(TankInfo[id][Besetzt] != 1)
{
format(str,sizeof(str),"Diese Tankstelle steht zum verkkauf Tipp:/buyTankst ein\nBesitzer: -KEINER-\nKaufPreis: %d\nKaufLevel: %d",TankInfo[id][KaufPreis],TankInfo[id][KaufLevel]);
TankInfo[id][TankText] = Create3DTextLabel(str,Weiss,0,0,0,15,0,1);
}
else
{
format(str,sizeof(str),"%s\nBesitzer: %s\nErpresser: %d\nTankPreis: %d",TankInfo[id][Besitzer],TankInfo[id][Erpresser],TankInfo[id][TankPreis]);
TankInfo[id][TankText] = Create3DTextLabel(str,Weiss,0,0,0,15,0,1);
}
}
return 1;
}
{
if(TankInfo[id][fExist] == true)
{
new str[128];
TankInfo[id][fPickup] = CreatePickup(1339,2, TankInfo[id][TX], TankInfo[id][TY], TankInfo[id][TZ],0);
if(TankInfo[id][Besetzt] != 1)
{
format(str,sizeof(str),"Diese Tankstelle steht zum verkkauf Tipp:/buyTankst ein\nBesitzer: -KEINER-\nKaufPreis: %d\nKaufLevel: %d",TankInfo[id][KaufPreis],TankInfo[id][KaufLevel]);
TankInfo[id][TankText] = Create3DTextLabel(str,Weiss,0,0,0,15,0,1);
}
else
{
format(str,sizeof(str),"%s\nBesitzer: %s\nErpresser: %d\nTankPreis: %d",TankInfo[id][Besitzer],TankInfo[id][Erpresser],TankInfo[id][TankPreis]);
TankInfo[id][TankText] = Create3DTextLabel(str,Weiss,0,0,0,15,0,1);
}
}
return 1;
}