Random Map
#1

Is there any way to make it so when my server GMX's, it will start the gamemode on a random map? For example:

My first spawns are
Код:
new Float:SlapSpawn[][4] =
	{
		{2543.4485,2823.5137,10.8203,269.3489},
		{2607.7544,2829.2144,10.8203,80.7862},
		{2570.9438,2829.6284,12.7647,106.9970}
	};
Let's say I wanted when the players spawn, it can be another location of my choice.
Quote:

new Float:SlapSpawn2[][4] =
{
{BLA BLA BLA},
{BLA BLA BLA},
{BLA BLA BLA}
};

Reply
#2

Код:
public OnPlayerRequestClass(playerid, classid)
{
	switch(classid)
	{
		case 0,3:
		{
		    SetPlayerPos(playerid, SlapSpawn[0][0], SlapSpawn[0][1], SlapSpawn[0][2]);
		    SetPlayerFacingAngle(playerid, 0.0);
		    SetPlayerCameraPos(playerid, SlapSpawn[0][0], SlapSpawn[0][1]+3, SlapSpawn[0][2]);
		    SetPlayerCameraLookAt(playerid, SlapSpawn[0][0], SlapSpawn[0][1], SlapSpawn[0][2]);
		}
		case 1,4:
		{
		    SetPlayerPos(playerid, SlapSpawn[1][0], SlapSpawn[0][1], SlapSpawn[0][2]);
		    SetPlayerFacingAngle(playerid, 0.0);
		    SetPlayerCameraPos(playerid, SlapSpawn[1][0], SlapSpawn[0][1]+3, SlapSpawn[0][2]);
		    SetPlayerCameraLookAt(playerid, SlapSpawn[1][0], SlapSpawn[0][1], SlapSpawn[0][2]);
		}
		case 2,5:
		{
		    SetPlayerPos(playerid, SlapSpawn[2][0], SlapSpawn[0][1], SlapSpawn[0][2]);
		    SetPlayerFacingAngle(playerid, 0.0);
		    SetPlayerCameraPos(playerid, SlapSpawn[2][0], SlapSpawn[0][1]+3, SlapSpawn[0][2]);
		    SetPlayerCameraLookAt(playerid, SlapSpawn[2][0], SlapSpawn[0][1], SlapSpawn[0][2]);
		}
	}
	return 1;
}
That's how they spawn in, btw.
Reply
#3

here?

PHP код:
    public OnPlayerRequestClass(playeridclassid)
{
    new 
acak random(sizeof(SlapSpawn));
    switch(
classid)
    {
        case 
0,3:
        {
            
SetPlayerPos(playeridSlapSpawn[acak]);
            
SetPlayerFacingAngle(playerid0.0);
            
SetPlayerCameraPos(playeridSlapSpawn[acak]);
            
SetPlayerCameraLookAt(playeridSlapSpawn[acak]);
        }
        case 
1,4:
        {
            
SetPlayerPos(playeridSlapSpawn[acak]);
            
SetPlayerFacingAngle(playerid0.0);
            
SetPlayerCameraPos(playeridSlapSpawn[acak]);
            
SetPlayerCameraLookAt(playeridSlapSpawn[acak]);
        }
        case 
2,5:
        {
            
SetPlayerPos(playeridSlapSpawn[acak]);
            
SetPlayerFacingAngle(playerid0.0);
            
SetPlayerCameraPos(playeridSlapSpawn[acak]);
            
SetPlayerCameraLookAt(playeridSlapSpawn[acak]);
        }
    }
    return 
1;

Reply
#4

PHP код:

new CurrentSlapSpawn;
public 
OnPlayerRequestClass(playeridclassid

    new 
acak random(sizeof(SlapSpawn)); 
    switch(
CurrentSlapSpawn)
    {
        case 
0:
        {
            switch(
classid
            { 
                case 
0,3
                { 
                    
SetPlayerPos(playeridSlapSpawn[acak]); 
                    
SetPlayerFacingAngle(playerid0.0); 
                    
SetPlayerCameraPos(playeridSlapSpawn[acak]); 
                    
SetPlayerCameraLookAt(playeridSlapSpawn[acak]); 
                } 
                case 
1,4
                { 
                    
SetPlayerPos(playeridSlapSpawn[acak]); 
                    
SetPlayerFacingAngle(playerid0.0); 
                    
SetPlayerCameraPos(playeridSlapSpawn[acak]); 
                    
SetPlayerCameraLookAt(playeridSlapSpawn[acak]); 
                } 
                case 
2,5
                { 
                    
SetPlayerPos(playeridSlapSpawn[acak]); 
                    
SetPlayerFacingAngle(playerid0.0); 
                    
SetPlayerCameraPos(playeridSlapSpawn[acak]); 
                    
SetPlayerCameraLookAt(playeridSlapSpawn[acak]); 
                } 
            } 
        }
        case 
1:
        {
            switch(
classid
            { 
                case 
0,3
                { 
                    
SetPlayerPos(playeridSlapSpawn2[acak]); 
                    
SetPlayerFacingAngle(playerid0.0); 
                    
SetPlayerCameraPos(playeridSlapSpawn2[acak]); 
                    
SetPlayerCameraLookAt(playeridSlapSpawn2[acak]); 
                } 
                case 
1,4
                { 
                    
SetPlayerPos(playeridSlapSpawn2[acak]); 
                    
SetPlayerFacingAngle(playerid0.0); 
                    
SetPlayerCameraPos(playeridSlapSpawn2[acak]); 
                    
SetPlayerCameraLookAt(playeridSlapSpawn2[acak]); 
                } 
                case 
2,5
                { 
                    
SetPlayerPos(playeridSlapSpawn2[acak]); 
                    
SetPlayerFacingAngle(playerid0.0); 
                    
SetPlayerCameraPos(playeridSlapSpawn2[acak]); 
                    
SetPlayerCameraLookAt(playeridSlapSpawn2[acak]); 
                } 
            } 
        }
    }
    return 
1

Where CurrentSlapSpawn should tell the script which map is currently running.. You can extend it to whatever you like..
Refer:>
https://sampwiki.blast.hk/wiki/SetPlayerPos
https://sampwiki.blast.hk/wiki/SetPlayerCameraPos
https://sampwiki.blast.hk/wiki/SetPlayerCameraLookAt
https://sampwiki.blast.hk/wiki/Control_Structures#switch
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)