SA-MP Forums Archive
The Code Stops at Some Point - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: The Code Stops at Some Point (/showthread.php?tid=553983)



The Code Stops at Some Point - Ox1gEN - 01.01.2015

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.


Re: The Code Stops at Some Point - Ox1gEN - 01.01.2015

Quote:
Originally Posted by ******
Посмотреть сообщение
That is usually caused by something crashing, often out-of-bounds array accesses. The crash detect plugin can detect many of these crashes (hence its name), but not all, so in other cases you may need to cover your code in print statements and see exactly which line the code stops on.
I see, I don't get any errors on crash detect aswell so I guess it still crashed but nothing showed up.
I'll comment stuff and print out values.
I'll edit once I'm done/.


Re: The Code Stops at Some Point - Abagail - 01.01.2015

Did you include the .inc file in your GM / script?