The Code Stops at Some Point
#1

I am frustrated asf.
I seriously don't know wtf is going on with this retarded /deletedealership command.

Only the part where it supposed to delete it works, then everything that is supposed to happen afterwards doesn't.
For example:

1.It doesn't delete the pickup after it does the query itself.
2.It doesn't execute another query.
3.It doesn't set timers...
4.After I delete an ID already and use that same ID it executes a query and just replaces the var with 0.


So here it is if anyone could actually tell me wtf is going on in here?

pawn Код:
YCMD:destroydealership(playerid, params[], help) {
    new id;
    if(!IsPlayerAdmin(playerid)) return 0;
    else {
        if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_NOTE, "[ ! ] SYNTAX: /DestroyDealership [DS-ID]");
        else {
            new query[128];
            mysql_format(dbHandle, query, sizeof(query), "DELETE FROM `dealerships` WHERE `DsID` = %d", DS[id][DsID]);
            mysql_tquery(dbHandle, query, "destroyDEALERSHIP", "dd", playerid, id);
        }
    }
    return 1;
}


//Here I tried to check maybe if I used id instead of DS[id][DsIcon] would work.
forward delPICKUP(id);
public delPICKUP(id) {
    DestroyPickup(id);
    return 1;
}

forward updateDS();
public updateDS() {
    mysql_tquery(dbHandle, "SELECT * FROM `dealerships`", "loadDEALERSHIPS");
    return 1;
}

forward destroyDEALERSHIP(playerid, id);
public destroyDEALERSHIP(playerid, id) {
    if(cache_affected_rows(dbHandle) > 0) {
        if(id > 0 && id < cache_num_rows(dbHandle)) {
            DestroyPickup(DS[id][DsIcon]);
            printf("Successfully deleted dealership id %d --", id);
            format(ZString, sizeof(ZString), "[ ! ] Successfully DELETED DealerShip ID:%d. (SQL-ROW-ID:%d)", id, DS[id][DsID]); //Thanks to 'rickisme' for helping me with this one.
            SendClientMessage(playerid, COLOR_SUCCESS, ZString);
            mysql_tquery(dbHandle, "SELECT * FROM `dealerships`", "loadDEALERSHIPS");
            SetTimerEx("delPICKUP", 1000, false, "d", id);
            SetTimer("updateDS", 2000, false);
        } else return SendClientMessage(playerid, COLOR_ERROR, "[ ! ] Invalid DEALERSHIP ID.");
    }
    return 1;
}
As you can probably see I tried to load stuff several times maybe it'd fix but no.
Bassicly all I need to do is delete the fucking pickup which it doesn't seem to get delete for some retarded reason and use the loadDEALERSHIPS function again to update the server.
Yet none of this seem to work.
Reply


Messages In This Thread
The Code Stops at Some Point - by Ox1gEN - 01.01.2015, 18:45
Re: The Code Stops at Some Point - by Ox1gEN - 01.01.2015, 18:51
Re: The Code Stops at Some Point - by Abagail - 01.01.2015, 18:53

Forum Jump:


Users browsing this thread: 1 Guest(s)