SA-MP Forums Archive
Auto Spawn Object - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Auto Spawn Object (/showthread.php?tid=166516)



Auto Spawn Object - sheepondrugs - 08.08.2010

Hi,

I'm wanting to spawn an object (health to be specific).

Quote:

Health ID: 1240

Код:
public OnGameModeInit()
{
    CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0, 0, 96);
    return 1;
}

I want it to do this ideally:
Quote:

IF player is on the health object THEN
user hp = 100
destory object
timer 5000
spawn health object


I had a bash at it, but probably screwed it up lol

Код:
public OnGameModeInit()
{
    CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0, 0, 1240);
    SetPlayerHealth(playerid,100);
    DestroyPickup(????);
    return 1;
}
thanks


Re: Auto Spawn Object - (.Aztec); - 08.08.2010

Take a look at this, see if you can figure it out yourself. This does basically the same, but with weapons.

http://pastebin.com/XVbNhXxK


Re: Auto Spawn Object - [L3th4l] - 08.08.2010

pawn Код:
CMD:pickup(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y ,z);
    CreatePickup(1240, 2, x, y, z, 0); // creates a pickup at your location
    return 1;
}
or

new Health;

pawn Код:
public OnGameModeInit()
{
    Health = createpickup(1242, 2, x, y, z);
}
Actually, when you pick that pickup ^ it will respawn after some time. if it is the health one, it will automatically give you health. just insert your coordinates


Re: Auto Spawn Object - sheepondrugs - 09.08.2010

nice thanks very much, I didn't know it was auto built in!