SA-MP Forums Archive
Random Loot Spawn - 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: Random Loot Spawn (/showthread.php?tid=621386)



Random Loot Spawn - NealPeteros - 10.11.2016

How do I change the spawn of this loot
PHP код:
RLootObjects[0] = CreateObject(19054, -1956.1447287.109135.4688,   87.72005, -23.879960.00000); 
to a random one. I made the random spawn float variable already. The problem is only here. This is how a player will receive the loot.
PHP код:
if (newkeys KEY_NO)
    {
        if(
IsValidObject(LootObjects[0]) && IsPlayerInRangeOfPoint(playerid,2.0,-1956.1447287.109135.4688))
        {
            
AddItem(playerid,"M4A1",1);
            
SendClientMessage(playeridCOLOR_GREEN"* 1 M4A1 has been added to your inventory");
            
DestroyObject(LootObjects[0]);
        } 
How do I change
Код:
if(IsValidObject(LootObjects[0]) && IsPlayerInRangeOfPoint(playerid,2.0,-1956.1447, 287.1091, 35.4688))
so that when the player is in range of the random loot spawn, he will get the M4A1. Cause I just cant use the random float spawn.

Sorry if I can't explain it well. I'm really confused on this that I don't even know how to explain it.

EDIT: DON'T MIND
Quote:

How do I change the spawn of this loot
PHP код:
RLootObjects[0] = CreateObject(19054, -1956.1447287.109135.4688,   87.72005, -23.879960.00000); 
to a random one.




Re: Random Loot Spawn - NealPeteros - 10.11.2016

Tried my best to simplify it:

Something like this
PHP код:
IsPlayerInRangeOfPoint(playerid,2.0,LootObjects[0]); 
but translated from my confusing language to PAWN language