Propper spawning and class selection help
#1

Hello

Well this is kind of a noob question, since it's very basic.
BUT, always when I wanna make a server there are 2 things that make me fail every single time (1: copy pasting -> code will collide and 2: player classes)
So everytime when I come to a point where I say, 'now I am gonna make the server's class selection' I mess the entire server up...

So this time I want to do it perfectly, so I was wondering, what is the best way to do the following:
Just one player skin showing when connecting to the server, (skinid 5), however at 4 or 5 random locations, and when the player clicks spawn it spawns at the place where the class selection was shown (with skin id 5).

Now this all sounds pretty easy to my ears aswell, but I'm just too scared to mess it up and get a terrible class selection...

Thanks in advance =)
Reply
#2

But interior must be 0. If you want to change the interior, then add it to the array.

That should work I guess, change the data to the array. I've added:
X, Y, Z, Angle, Camera Pos X, Camera Pos Y, Camera Pos Z, Camera Look At X, Camera Look At Y, Camera Look At Z.
pawn Код:
new
    Player_RS[ MAX_PLAYERS ],
   
    Float: RandomSpawn[ ][ 10 ] =
    {
        { X, Y, Z, Angle, CameraPos_X, CameraPos_Y, CameraPos_Z, CameraLookAt_X, CameraLookAt_Y, CameraLookAt_Z }, // CHANGE ME!
        { X, Y, Z, Angle, CameraPos_X, CameraPos_Y, CameraPos_Z, CameraLookAt_X, CameraLookAt_Y, CameraLookAt_Z }, // CHANGE ME!
        { X, Y, Z, Angle, CameraPos_X, CameraPos_Y, CameraPos_Z, CameraLookAt_X, CameraLookAt_Y, CameraLookAt_Z } // CHANGE ME!
    }
;
pawn Код:
public OnGameModeInit( )
{
    AddPlayerClass( 5, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0 );
    return 1;
}
pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
    Player_RS = random( sizeof( RandomSpawn ) );
   
    SetPlayerPos( playerid, RandomSpawn[ Player_RS ][ 0 ], RandomSpawn[ Player_RS ][ 1 ], RandomSpawn[ Player_RS ][ 2 ] );
    SetPlayerCameraPos( playerid, RandomSpawn[ Player_RS ][ 4 ], RandomSpawn[ Player_RS ][ 5 ], RandomSpawn[ Player_RS ][ 6 ] );
    SetPlayerCameraLookAt( playerid, RandomSpawn[ Player_RS ][ 7 ], RandomSpawn[ Player_RS ][ 8 ], RandomSpawn[ Player_RS ][ 9 ] );
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos( playerid, RandomSpawn[ Player_RS ][ 0 ], RandomSpawn[ Player_RS ][ 1 ], RandomSpawn[ Player_RS ][ 2 ] );
    SetPlayerFacingAngle( playerid, RandomSpawn[ Player_RS ][ 3 ] );
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)