Changing filterscripts
#1

Hi there,

I wonder how it is possible to change filterscript after some time. I have 2 classes. But I want to change the Spawnposition every 6 minutes for both the classes. I am on a TDM, but I want to know how to change the spawns so they will be spawned in a different map, can someone help me?

Maybe with a script?
Thanks.
Reply
#2

No, easily can be done like this.
pawn Код:
#define MAX_SPAWN_MAPS  (3)
forward ChangeSpawn();
new SpawnTimer,
    Spawn
    ;
public OnGameModeInit() SpawnTimer = SetTImer("ChangeSpawn",6*60*1000 );

public ChangeSpawn() Spawn = random( MAX_SPAWN_MAPS );

public OnPlayerSpawn( playerid )
{

     if ( Spawn == 0 )
     {
          SetPlayerPos(...);
          //Code..Code..Code...
     }
     if ( Spawn == 1 )
     {
          SetPlayerPos(...);
          //Code..Code..Code...
     }
     if ( Spawn == 2 )
     {
          SetPlayerPos(...);
          //Code..Code..Code...
     }
     if ( Spawn == 3 )
     {
          SetPlayerPos(...);
          //Code..Code..Code...
     }
     return 1;
}

Put this in your gamemode in the right callbacks.
Reply
#3

You could do:
pawn Код:
#include <a_samp>

enum e_SPAWN_POINTS
{
    Float:e_fX,
    Float:e_fY,
    Float:e_fZ,
    Float:e_fRot
};

new const g_SpawnPoints[ ][ e_SPAWN_POINTS ] = {
    //  x      y      z     rotation
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 }
};

new g_iSpawnPoint = 0;

public OnGameModeInit( )
{
    SetTimer( "UpdateSpawnPoint", 6 * 60 * 1000, true );
}

forward UpdateSpawnPoint( );
public  UpdateSpawnPoint( )
    g_iSpawnPoint = ( g_iSpawnPoint + 1 ) % sizeof( g_SpawnPoints );

public OnPlayerSpawn( playerid )
{
    SetPlayerPos( playerid, g_SpawnPoints[ g_iSpawnPoint ][ e_fX ], g_SpawnPoints[ g_iSpawnPoint ][ e_fY ], g_SpawnPoints[ g_iSpawnPoint ][ e_fZ ] );
    SetPlayerFacingAngle( playerid, g_SpawnPoints[ g_iSpawnPoint ][ e_fRot ] );
}
Reply
#4

hmm..
Well..

Does this happens when you are aboat to connect? Or is it when the server has started? I want to have it when the server starts. Also it counts for 2 classes...
Reply
#5

Quote:
Originally Posted by timothyinthehouse
Посмотреть сообщение
hmm..
Well..

Does this happens when you are aboat to connect? Or is it when the server has started? I want to have it when the server starts. Also it counts for 2 classes...
Ahh, so what you want is different spawn points for different classes...

Then use OnPlayerRequestSpawn ... or OnPlayerRequestClass


Quote:
Originally Posted by g_aSlice
Посмотреть сообщение
You could do:
pawn Код:
#include <a_samp>

enum e_SPAWN_POINTS
{
    Float:e_fX,
    Float:e_fY,
    Float:e_fZ,
    Float:e_fRot
};

new const g_SpawnPoints[ ][ e_SPAWN_POINTS ] = {
    //  x      y      z     rotation
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 },
    { 123.0, 456.0, 789.0, 0.0 }
};

new g_iSpawnPoint = 0;

public OnGameModeInit( )
{
    SetTimer( "UpdateSpawnPoint", 6 * 60 * 1000, true );
}

forward UpdateSpawnPoint( );
public  UpdateSpawnPoint( )
    g_iSpawnPoint = ( g_iSpawnPoint + 1 ) % sizeof( g_SpawnPoints );

public OnPlayerSpawn( playerid )
{
    SetPlayerPos( playerid, g_SpawnPoints[ g_iSpawnPoint ][ e_fX ], g_SpawnPoints[ g_iSpawnPoint ][ e_fY ], g_SpawnPoints[ g_iSpawnPoint ][ e_fZ ] );
    SetPlayerFacingAngle( playerid, g_SpawnPoints[ g_iSpawnPoint ][ e_fRot ] );
}
May i ask why you used the const at the arrays ? I want to get that clear
Reply
#6

Ill see.
Reply
#7

@Zh3r0: Because it's a constant array.
Reply
#8

hmm.. But how can I change it. this counts for everyplayer, but how can I seperate it for 2 teams?
THNX
Reply
#9

Quote:
Originally Posted by timothyinthehouse
Посмотреть сообщение
hmm.. But how can I change it. this counts for everyplayer, but how can I seperate it for 2 teams?
THNX
GetPlayerTeam or use the variable you got, if you use variables instead of SetPlayerTeam / GetPlayerTeam


@g_aSlice and if i don't use const, isn't the same thing?
Reply
#10

const is used to ensure that code isn`t modified during run-time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)