samp-streamer-plugin
samp-streamer-plugin copied to clipboard
Pickup does not update when it's created immediately after destroying
There's problem when you call DestroyDynamicPickup than immediately CreateDynamicPickup (for example if you want to change pickup model id, position...) pickup is not being "reloaded".
I created simple way to reproduce this bug:
new DynamicPickup: pickupid;
public OnPlayerCommandText(playerid, cmdtext[]) {
if (!strcmp(cmdtext, "/createpickup", true)) {
new Float: x, Float: y, Float: z, string[128];
GetPlayerPos(playerid, x, y, z);
pickupid = CreateDynamicPickup(19522, 1, x, y, z);
format(string, sizeof string, "Create pickup id %d", _: pickupid);
SendClientMessage(playerid, -1, string);
} else if (!strcmp(cmdtext, "/setnewmodel", true)) {
new Float: x, Float: y, Float: z, string[128];
GetPlayerPos(playerid, x, y, z);
DestroyDynamicPickup(pickupid);
pickupid = CreateDynamicPickup(19524, 1, x, y, z);
format(string, sizeof string, "New model: 19524, id: %d", _: pickupid);
SendClientMessage(playerid, -1, string);
} else if (!strcmp(cmdtext, "/destroypickup", true)) {
new ret = DestroyDynamicPickup(pickupid);
SendClientMessage(playerid, -1, ret ? "Destroyed" : "Error");
}
return 1;
}
When you type /setnewmodel (after creating pickup) you must manually restream pickup by going away from it (Streamer_Update(playerid, STREAMER_TYPE_PICKUP)
does not work).
actual
I managed to get around this problem by adding a timer to delay the pickup creation by 500ms
Just ran into this, wasted over an hour of my time trying to work out wtf I was doing wrong.....
Only thing I seem to be able to do to fix it is to disable the newly-created pickups and re-enable them on a timer.