Guten Abend,
ich kann keine ATMs entfernen. Glaube sogar das es noch Falsch Gespeichert wird.
Code
enum ATMDaten
{
ID,
Float:aX,
Float:aY,
Float:aZ,
Float:aA,
atmobject,
bool:erstellt
}
new ATMInfo[MAX_ATMS][ATMDaten];
Entfernen:
case 0:
{
new id = IsATM(playerid), query[256];
if(id != -1)
{
ATMInfo[id][erstellt] = false;
ATMInfo[id][aX] = 0.0;
ATMInfo[id][aY] = 0.0;
ATMInfo[id][aZ] = 0.0;
DestroyObject(ATMInfo[id][atmobject]);
SendClientMessage(playerid, FARBE_WEISS, "ATM Entfernt!");
format(query, sizeof(query), "SELECT * FROM `ATM` WHERE ID = '%d'", id);
format(query, sizeof(query), "DELETE FROM `ATM` WHERE ID = '%d'", id);
db_query(Datenbank, query);
return 1;
}return SendClientMessage(playerid, FARBE_WEISS, "Kein ATM in der Nähe!!");
}
Erstellen:
case 0:
{
new Float:X, Float:Y, Float:Z, Float:A, query[256];
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
for(new i = 0; i < MAX_ATMS; i++)
{
if(ATMInfo[i][erstellt] == true)continue;
ATMInfo[i][aX] = X;
ATMInfo[i][aY] = X;
ATMInfo[i][aZ] = Z;
ATMInfo[i][aA] = A;
CreateDynamicObject(ATMInfo[i][atmobject], X, Y, Z, 0, 0, A);
format(query, sizeof(query), "INSERT INTO `ATM` (`ID`, `X`, `Y`, `Z`, `A`) VALUES ('%i', '%f', '%f', '%f', '%f')", i, X, Y, Z, A);
db_query(Datenbank, query);
SendClientMessage(playerid, FARBE_WEISS, "ATM Erstellt");
return 1;
}
}
stock IsATM(playerid)
{
new i = 0;
while(i != MAX_ATMS)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, ATMInfo[i][aX], ATMInfo[i][aY], ATMInfo[i][aZ]))
{
return i;
}
i++;
}
return -1;
}
Laden:
stock LoadATM()
{
new DBResult:Result, string[512], rows;
for(new i = 0; i < MAX_ATMS; i++)
{
format(string, sizeof(string), "SELECT * FROM `ATM` WHERE `ID` = '%i'", i);
Result = db_query(Datenbank, string);
rows = db_num_rows(Result);
if(rows == 0)continue;
db_get_field_assoc(Result, "X", string, sizeof(string));
ATMInfo[i][aX] = floatstr(string);
db_get_field_assoc(Result, "Y", string, sizeof(string));
ATMInfo[i][aY] = floatstr(string);
db_get_field_assoc(Result, "Z", string, sizeof(string));
ATMInfo[i][aZ] = floatstr(string);
db_get_field_assoc(Result, "A", string, sizeof(string));
ATMInfo[i][aA] = floatstr(string);
ATMInfo[i][erstellt] = true;
ATMInfo[i][atmobject] = CreateDynamicObject(2942,ATMInfo[i][aX],ATMInfo[i][aY],ATMInfo[i][aZ]-0.5,0,0,ATMInfo[i][aA]);
db_free_result(Result);
}
return 1;
}
Alles anzeigen
MfG. Black_Air
@Jeffry Du ne Idee?