Cannot delete ATM ids
#1

Hello,

I'm creating a ATM system, however I'm having issues removing the atms.

pawn Код:
CMD:deleteatm(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 4) return 0;
    new id;
    if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /deleteatm [id]");
    if(ATM_INFO[id][ATM_ID] == -1 || id >= MAX_ATMS || id >= LoadedAtms) return SendClientMessage(playerid, COLOR_RED, "Invalid ATM ID.");
    ATM_INFO[id][ATM_ID] = -1; ATM_INFO[id][LOCATION_X] = -1; ATM_INFO[id][LOCATION_Y] = -1; ATM_INFO[id][LOCATION_Z] = -1;
    ATM_INFO[id][LOCATION_F] = -1; ATM_INFO[id][INTERIOR] = -1; ATM_INFO[id][VIRTUAL_WORLD] = -1; ATM_INFO[id][BALANCE] = -1;
    DestroyDynamicObject(ATM_INFO[id][OBJ_ID]);
    LoadedAtms--;
    new Query[50];
    format(Query, sizeof(Query), "DELETE FROM `AtmInfo` WHERE `ID` = '%d'", id);
    mysql_tquery(conn, Query, "", "");
    format(Query, sizeof(Query), "%s has deleted an ATM. ID: %d", id);
    Log("Logs/AdminLog.txt", Query);
    format(Query, sizeof(Query), "You have successfully deleted ATM: %d.", id);
    SendClientMessage(playerid, COLOR_YELLOW, Query);
    return 1;
}
I can create atms fine, but when if I try to delete that ATM id I get: Invalid ATM ID. However I can delete the first 5 ATMS.

Thanks in advance,

-Isolated.

EDIT: This is no longer an issue, however I delete any ID from 0 to 9, doesn't matter if they are spawned or not.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)