SA-MP Forums Archive
Changing filterscripts - 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: Changing filterscripts (/showthread.php?tid=193230)



Changing filterscripts - Baboon - 25.11.2010

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.


Re: Changing filterscripts - Zh3r0 - 25.11.2010

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.


Re: Changing filterscripts - Slice - 25.11.2010

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 ] );
}



Re: Changing filterscripts - Baboon - 25.11.2010

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...


Re: Changing filterscripts - Zh3r0 - 25.11.2010

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


Re: Changing filterscripts - Baboon - 25.11.2010

Ill see.


Re: Changing filterscripts - Slice - 25.11.2010

@Zh3r0: Because it's a constant array.


Re: Changing filterscripts - Baboon - 25.11.2010

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


Re: Changing filterscripts - Zh3r0 - 25.11.2010

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?


AW: Changing filterscripts - Cank - 25.11.2010

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