Removing a Pickup Once, Trying Again-.. Doesn't Work - 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: Removing a Pickup Once, Trying Again-.. Doesn't Work (
/showthread.php?tid=554009)
Removing a Pickup Once, Trying Again-.. Doesn't Work -
Ox1gEN - 01.01.2015
So I have managed to solve the issues that occured and then as I finally managed to do so, the pickups are fucked up.
Like for the first time I am trying to delete a pickup it gets deleted, then the next time I try to delete another pickup it deletes it from the db but only the pickup is left.
I really don't know why this occurs, the code seems quite fine to me.
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;
}
forward updateDS();
public updateDS() {
mysql_tquery(dbHandle, "SELECT * FROM `dealerships`", "loadDEALERSHIPS");
return 1;
}
forward destroyDEALERSHIP(playerid, id);
public destroyDEALERSHIP(playerid, id) {
new ZString[128];
if(cache_affected_rows(dbHandle) > 0) {
DestroyPickup(DS[id][DsIcon]);
format(ZString, sizeof(ZString), "[ ! ] Successfully destroyed dealership ID:%d (SQL-ID[DS-ID]:%d)", id, DS[id][DsID]);
SendClientMessage(playerid, COLOR_ERROR, ZString);
SetTimer("updateDS", 1000, false);
} else return SendClientMessage(playerid, COLOR_ERROR, "[ ! ] Invalid DEALERSHIP ID.");
return 1;
}
I have a feeling that maybe using streamer may solve the problem and create a pickup using createdynamicpickup and then just delete it and use streamer_update so the pickup would be removed, do anyone thinks that'll solve the issue?