SA-MP Forums Archive
Update housepickup_mapicon - 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: Update housepickup_mapicon (/showthread.php?tid=650679)



Update housepickup_mapicon - EvgeniyHostel1992 - 04.03.2018

When you move the house, the pickup and the icon (on the map) are transferred, but the pickup and icon on the old positions remain. Help me decide.

PHP код:
DestroyDynamicMapIcon(hl[idx][hM]);
    
DestroyDynamicPickup(hl[idx][hP]); 
The pickup and icon change position during further transfers, but the initial position of pickups and icons (which is indicated at loading (houses / gamemode) - is not deleted.

Ongamemodeinit :
PHP код:
hl[idx][hP] = AddStaticPickup(hl[idx][hPickup], 0hl[idx][hEnterx], hl[idx][hEntery], hl[idx][hEnterz]);
        
hl[idx][hM] = CreateDynamicMapIcon(hl[idx][hEnterx],hl[idx][hEntery],hl[idx][hEnterz],hl[idx][hMapIcon],-1,-1,-1,-1,200.0); 



Re: Update housepickup_mapicon - ball - 04.03.2018

You use AddStaticPickup to create pickup and use DestroyDynamicPickup to destroy it, you can't do it like that. Use CreateDynamicPickup and DestroyDynamicPickup or CreatePickup and DestroyPickup.

By the way, with streamer better than delete -> create is simply change position with function Streamer_SetFloatData

Код:
SetPickupPos(pickupid, Float:lX, Float:lY, Float:lZ)
{
	Streamer_SetFloatData(STREAMER_TYPE_PICKUP, pickupid, E_STREAMER_X, lX);
	Streamer_SetFloatData(STREAMER_TYPE_PICKUP, pickupid, E_STREAMER_Y, lY);
	Streamer_SetFloatData(STREAMER_TYPE_PICKUP, pickupid, E_STREAMER_Z, lZ);
}



Re: Update housepickup_mapicon - EvgeniyHostel1992 - 04.03.2018

delete


Re: Update housepickup_mapicon - EvgeniyHostel1992 - 04.03.2018

if you leave the game and go in then everything is fine


Re: Update housepickup_mapicon - EvgeniyHostel1992 - 04.03.2018

i dicided

PHP код:
LOADhouse:

hl[idx][hP] = CreateDynamicPickup(hl[idx][hPickup], 1hl[idx][hEnterx], hl[idx][hEntery], hl[idx][hEnterz],-1,-1,-1,30.0,-1,0);
        
hl[idx][hM] = CreateDynamicMapIcon(hl[idx][hEnterx],hl[idx][hEntery],hl[idx][hEnterz],hl[idx][hMapIcon],-1,-1,-1,-1,200.0); 
changehousepos :

PHP код:
DestroyDynamicPickup(hl[idx][hP]);
    
hl[idx][hP] = CreateDynamicPickup(hl[idx][hPickup], 1hl[idx][hEnterx], hl[idx][hEntery], hl[idx][hEnterz],-1,-1,-1,30.0,-1,0);
    
DestroyDynamicMapIcon(hl[idx][hM]);
    
hl[idx][hM] = CreateDynamicMapIcon(hl[idx][hEnterx], hl[idx][hEntery], hl[idx][hEnterz],hl[idx][hMapIcon],-1,-1,-1,-1,200.0);