vendredi 22 juillet 2016

Spawn somewhere near

You could do something like this:

Code:

const
    Float: AreaTeleports[][] = 
    {
        {X, Y, Z, A},
        {X, Y, Z, A}
        //...
    };

public OnPlayerEnterDynamicArea(playerid, areaid)
{
    if (areaid == area_id)
    {
        new Float: last = 10000.0, Float: current, teleid;
        for (new i = 0; i < sizeof (AreaTeleports); i++)
        {
            current = GetPlayerDistanceFromPoint(playerid, AreaTeleports[i][0], AreaTeleports[i][1], AreaTeleports[i][2]);
            if (current < last)
            {
                last = current;
                teleid = i;
            }
        }
        SetPlayerPos(playerid, AreaTeleports[teleid][0], AreaTeleports[teleid][1], AreaTeleports[teleid][2]);
        SetPlayerFacingAngle(playerid, AreaTeleports[teleid][3]);
    }
    return 1;
}

Let's block ads! (Why?)



Spawn somewhere near

Aucun commentaire:

Enregistrer un commentaire