Save floats to array? [REP]
#2

Store the coordinates in the array "aRandomSpawns" and do as followed:

pawn Код:
// ** INCLUDES

#include <a_samp>

// ** DEFINES

// *** GENERAL

#define MAX_POSITIONS 100

// ** ARRAYS AND ENUMERATORS

enum eRandomSpawns
{
    Float:random_spawn_x,
    Float:random_spawn_y,
    Float:random_spawn_z,
    Float:random_spawn_angle
};

new aRandomSpawns[MAX_POSITIONS][eRandomSpawns];

// ** MAIN

main()
{
    print("Loaded \"random_spawns.amx\".");
}

// ** CALLBACKS

public OnGameModeInit()
{
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    new selected = random(sizeof(aRandomSpawns));
    SetPlayerPos(playerid, aRandomSpawns[selected][random_spawn_x], aRandomSpawns[selected][random_spawn_y], aRandomSpawns[selected][random_spawn_z]);
    SetPlayerFacingAngle(playerid, aRandomSpawns[selected][random_spawn_angle]);
    SetCameraBehindPlayer(playerid);
    return 1;
}
Reply


Messages In This Thread
Save floats to array? [REP] - by TobsenMTA - 17.12.2015, 21:31
Re: Save floats to array? [REP] - by SickAttack - 17.12.2015, 21:57
Re: Save floats to array? [REP] - by TobsenMTA - 17.12.2015, 22:47
Re: Save floats to array? [REP] - by SickAttack - 17.12.2015, 22:51
Re: Save floats to array? [REP] - by TobsenMTA - 18.12.2015, 00:28
Re: Save floats to array? [REP] - by SickAttack - 18.12.2015, 01:35

Forum Jump:


Users browsing this thread: 1 Guest(s)